diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/benchmark.py | 5 | ||||
-rw-r--r-- | tools/prebuilt.py | 37 | ||||
-rwxr-xr-x | tools/setup.py | 10 |
3 files changed, 48 insertions, 4 deletions
diff --git a/tools/benchmark.py b/tools/benchmark.py index fe71cc88e..9217eceec 100755 --- a/tools/benchmark.py +++ b/tools/benchmark.py @@ -16,6 +16,7 @@ import tempfile import http_server import throughput_benchmark from http_benchmark import http_benchmark +import prebuilt # The list of the tuples of the benchmark name and arguments exec_time_benchmarks = [ @@ -156,7 +157,9 @@ def main(argv): os.chdir(root_path) import_data_from_gh_pages() - # TODO: Use hyperfine in //third_party + + prebuilt.load_hyperfine() + run([ "hyperfine", "--ignore-failure", "--export-json", benchmark_file, "--warmup", "3" diff --git a/tools/prebuilt.py b/tools/prebuilt.py new file mode 100644 index 000000000..d30b232be --- /dev/null +++ b/tools/prebuilt.py @@ -0,0 +1,37 @@ +import sys +import os +from util import run, root_path +from third_party import tp, google_env + + +def download_prebuilt(sha1_file): + run([ + "python", + tp('depot_tools/download_from_google_storage.py'), + '--platform=' + sys.platform, + '--no_auth', + '--bucket=denoland', + '--sha1_file', + sha1_file, + ], + env=google_env()) + + +def load_sccache(): + if sys.platform == 'win32': + p = "prebuilt/win/sccache.exe" + elif sys.platform.startswith('linux'): + p = "prebuilt/linux64/sccache" + elif sys.platform == 'darwin': + p = "prebuilt/mac/sccache" + download_prebuilt(p + ".sha1") + return os.path.join(root_path, p) + + +def load_hyperfine(): + if sys.platform == 'win32': + download_prebuilt("prebuilt/win/hyperfine.exe.sha1") + elif sys.platform.startswith('linux'): + download_prebuilt("prebuilt/linux64/hyperfine.sha1") + elif sys.platform == 'darwin': + download_prebuilt("prebuilt/mac/hyperfine.sha1") diff --git a/tools/setup.py b/tools/setup.py index 81ef548d6..3ffc631df 100755 --- a/tools/setup.py +++ b/tools/setup.py @@ -7,6 +7,7 @@ import os import re import sys from distutils.spawn import find_executable +import prebuilt def main(): @@ -19,7 +20,6 @@ def main(): third_party.download_clang_format() third_party.download_clang() third_party.maybe_download_sysroot() - write_lastchange() mode = build_mode(default=None) @@ -113,8 +113,12 @@ def generate_gn_args(mode): if "DENO_BUILD_ARGS" in os.environ: out += os.environ["DENO_BUILD_ARGS"].split() + cacher = prebuilt.load_sccache() + if not os.path.exists(cacher): + cacher = find_executable("sccache") or find_executable("ccache") + # Check if ccache or sccache are in the path, and if so we set cc_wrapper. - cc_wrapper = find_executable("sccache") or find_executable("ccache") + cc_wrapper = cacher if cc_wrapper: # The gn toolchain does not shell escape cc_wrapper, so do it here. out += ['cc_wrapper=%s' % gn_string(shell_quote(cc_wrapper))] @@ -124,7 +128,7 @@ def generate_gn_args(mode): out += ["treat_warnings_as_errors=false"] # Look for sccache; if found, set rustc_wrapper. - rustc_wrapper = find_executable("sccache") + rustc_wrapper = cacher if rustc_wrapper: out += ['rustc_wrapper=%s' % gn_string(rustc_wrapper)] |