diff --git a/tools/build.py b/tools/build.py index e66f1f0948..82426f5b26 100755 --- a/tools/build.py +++ b/tools/build.py @@ -1,16 +1,27 @@ #!/usr/bin/env python # 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") + def main(argv): enable_ansi_colors() - ninja_args = argv[1:] + 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:] if not "-C" in ninja_args: if not os.path.isdir(build_path()): print("Build directory '%s' does not exist." % build_path(), diff --git a/website/manual.md b/website/manual.md index e5104e6052..8d0dacabca 100644 --- a/website/manual.md +++ b/website/manual.md @@ -176,7 +176,7 @@ Extra steps for Windows users: ./third_party/depot_tools/ninja -C target/debug # Build a release binary. -DENO_BUILD_MODE=release ./tools/build.py :deno +./tools/build.py --release deno # List executable targets. ./third_party/depot_tools/gn ls target/debug //:* --as=output --type=executable @@ -622,9 +622,8 @@ To start profiling, ```sh # Make sure we're only building release. -export DENO_BUILD_MODE=release # Build deno and V8's d8. -./tools/build.py d8 deno +./tools/build.py --release d8 deno # Start the program we want to benchmark with --prof ./target/release/deno tests/http_bench.ts --allow-net --prof & # Exercise it.