summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/benchmark.py35
-rwxr-xr-xtools/benchmark_test.py6
-rwxr-xr-xtools/format.py18
3 files changed, 35 insertions, 24 deletions
diff --git a/tools/benchmark.py b/tools/benchmark.py
index 8615a17d9..d6c45259d 100755
--- a/tools/benchmark.py
+++ b/tools/benchmark.py
@@ -11,7 +11,8 @@ import sys
import json
import time
import shutil
-from util import root_path, run, run_output, build_path, executable_suffix
+from util import find_exts, root_path, run, run_output
+from util import build_path, executable_suffix
import tempfile
import http_server
import throughput_benchmark
@@ -59,22 +60,26 @@ def import_data_from_gh_pages():
def get_binary_sizes(build_dir):
+ # Because cargo's OUT_DIR is not predictable, we have to search the build
+ # tree for these files...
+ files = find_exts([build_dir], ["js", "map", "bin"])
path_dict = {
- "deno":
- os.path.join(build_dir, "deno" + executable_suffix),
- "main.js":
- os.path.join(build_dir, "gen/cli/bundle/main.js"),
- "main.js.map":
- os.path.join(build_dir, "gen/cli/bundle/main.js.map"),
- "compiler.js":
- os.path.join(build_dir, "gen/cli/bundle/compiler.js"),
- "compiler.js.map":
- os.path.join(build_dir, "gen/cli/bundle/compiler.js.map"),
- "snapshot_deno.bin":
- os.path.join(build_dir, "gen/cli/snapshot_deno.bin"),
- "snapshot_compiler.bin":
- os.path.join(build_dir, "gen/cli/snapshot_compiler.bin")
+ "deno": os.path.join(build_dir, "deno" + executable_suffix),
}
+ for f in files:
+ if f.endswith("CLI_SNAPSHOT.js"):
+ path_dict["CLI_SNAPSHOT.js"] = f
+ elif f.endswith("CLI_SNAPSHOT.js.map"):
+ path_dict["CLI_SNAPSHOT.js.map"] = f
+ elif f.endswith("CLI_SNAPSHOT.bin"):
+ path_dict["CLI_SNAPSHOT.bin"] = f
+ elif f.endswith("COMPILER_SNAPSHOT.js"):
+ path_dict["COMPILER_SNAPSHOT.js"] = f
+ elif f.endswith("COMPILER_SNAPSHOT.js.map"):
+ path_dict["COMPILER_SNAPSHOT.js.map"] = f
+ elif f.endswith("COMPILER_SNAPSHOT.bin"):
+ path_dict["COMPILER_SNAPSHOT.bin"] = f
+
sizes = {}
for name, path in path_dict.items():
assert os.path.exists(path)
diff --git a/tools/benchmark_test.py b/tools/benchmark_test.py
index a49db7b74..d84451494 100755
--- a/tools/benchmark_test.py
+++ b/tools/benchmark_test.py
@@ -32,9 +32,9 @@ class TestBenchmark(DenoTestCase):
def test_binary_size(self):
binary_size_dict = benchmark.get_binary_sizes(self.build_dir)
assert binary_size_dict["deno"] > 0
- assert binary_size_dict["main.js"] > 0
- assert binary_size_dict["main.js.map"] > 0
- assert binary_size_dict["snapshot_deno.bin"] > 0
+ assert binary_size_dict["CLI_SNAPSHOT.js"] > 0
+ assert binary_size_dict["CLI_SNAPSHOT.js.map"] > 0
+ assert binary_size_dict["CLI_SNAPSHOT.bin"] > 0
@unittest.skipIf("linux" not in sys.platform,
"strace only supported on linux")
diff --git a/tools/format.py b/tools/format.py
index c7465516a..aa2208b01 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -64,13 +64,15 @@ def rustfmt():
"rustfmt",
"--config-path",
rustfmt_config,
- ] + find_exts(["cli", "core", "tools"], [".rs"]))
+ ] + find_exts(["cli", "core", "tools", "deno_typescript", "cli_snapshots"],
+ [".rs"]))
def gn_format():
print "gn format"
- for fn in ["BUILD.gn", ".gn"] + find_exts(["build_extra", "cli", "core"],
- [".gn", ".gni"]):
+ for fn in ["BUILD.gn", ".gn"] + find_exts(
+ ["build_extra", "cli", "core", "deno_typescript", "cli_snapshots"],
+ [".gn", ".gni"]):
qrun(["third_party/depot_tools/gn", "format", fn], env=google_env())
@@ -78,14 +80,18 @@ def yapf():
print "yapf"
qrun(
[sys.executable, "third_party/python_packages/bin/yapf", "-i"] +
- find_exts(["tools", "build_extra"], [".py"], skip=["tools/clang"]),
+ find_exts(["tools", "build_extra", "deno_typescript", "cli_snapshots"],
+ [".py"],
+ skip=["tools/clang"]),
env=python_env())
def prettier():
print "prettier"
- files = find_exts([".github", "js", "tests", "tools", "website", "core"],
- [".js", ".json", ".ts", ".md"],
+ files = find_exts([
+ ".github", "js", "tests", "tools", "website", "core",
+ "deno_typescript", "cli_snapshots"
+ ], [".js", ".json", ".ts", ".md"],
skip=["tools/clang", "js/deps", "js/gen"])
qrun(["node", prettier_path, "--write", "--loglevel=error"] +
["rollup.config.js"] + files)