1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-23 15:16:54 -05:00
denoland-deno/tools/build.py

39 lines
1 KiB
Python
Raw Normal View History

#!/usr/bin/env python
2019-01-21 14:03:30 -05:00
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
from __future__ import print_function
import argparse
import os
import sys
import third_party
from util import build_path, enable_ansi_colors, run
parser = argparse.ArgumentParser()
parser.add_argument(
"--release", help="Use target/release", action="store_true")
2018-10-17 19:05:10 -04:00
def main(argv):
enable_ansi_colors()
args, rest_argv = parser.parse_known_args(argv)
if "DENO_BUILD_MODE" not in os.environ:
if args.release:
os.environ["DENO_BUILD_MODE"] = "release"
ninja_args = rest_argv[1:]
2018-10-17 19:05:10 -04:00
if not "-C" in ninja_args:
if not os.path.isdir(build_path()):
print("Build directory '%s' does not exist." % build_path(),
"Run tools/setup.py")
sys.exit(1)
ninja_args = ["-C", build_path()] + ninja_args
run([third_party.ninja_path] + ninja_args,
env=third_party.google_env(),
quiet=True)
if __name__ == '__main__':
sys.exit(main(sys.argv))