Skip to content
Permalink
Browse files

Add Deno.version.gnArgs (#1845)

To display specific build args passed to GN.
  • Loading branch information...
kt3k authored and ry committed Mar 2, 2019
1 parent 8c310d3 commit a7bb8ccce85c6e8bd619cce32d34a5d372ef85b7
Showing with 39 additions and 3 deletions.
  1. +12 −0 BUILD.gn
  2. +3 −1 js/version.ts
  3. +4 −0 js/version_test.ts
  4. +3 −1 rollup.config.js
  5. +1 −1 tools/setup.py
  6. +16 −0 tools/write_gn_args.py
@@ -221,6 +221,10 @@ bundle("main_bundle") {
deps = [
":deno_runtime_declaration",
":msg_ts",
":write_gn_args",
]
data = [
"$target_gen_dir/gn_args.txt",
]
}

@@ -260,3 +264,11 @@ snapshot("snapshot_compiler") {
":compiler_bundle",
]
}

action("write_gn_args") {
script = "//tools/write_gn_args.py"
outputs = [
"$target_gen_dir/gn_args.txt",
]
args = [ rebase_path(outputs[0], root_build_dir) ]
}
@@ -3,12 +3,14 @@ interface Version {
deno: string;
v8: string;
typescript: string;
gnArgs: string;
}

export const version: Version = {
deno: "",
v8: "",
typescript: "TS_VERSION" // This string will be replaced by rollup
typescript: "TS_VERSION", // This string will be replaced by rollup
gnArgs: `GN_ARGS` // This string will be replaced by rollup
};

/**
@@ -6,3 +6,7 @@ test(function version() {
assert(pattern.test(Deno.version.v8));
assert(pattern.test(Deno.version.typescript));
});

test(function versionGnArgs() {
assert(Deno.version.gnArgs.length > 100);
});
@@ -20,6 +20,7 @@ const typescriptPath = path.resolve(
__dirname,
"third_party/node_modules/typescript/lib/typescript.js"
);
const gnArgs = fs.readFileSync("gen/gn_args.txt", "utf-8").trim();

// We will allow generated modules to be resolvable by TypeScript based on
// the current build path
@@ -228,7 +229,8 @@ export default function makeConfig(commandOptions) {

// replace strings
replace({
TS_VERSION: typescript.version
TS_VERSION: typescript.version,
GN_ARGS: gnArgs
}),

// would prefer to use `rollup-plugin-virtual` to inject the empty module, but there
@@ -2,7 +2,7 @@
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import third_party
from util import build_mode, build_path, enable_ansi_colors, root_path, run
from util import shell_quote
from util import shell_quote, run_output
import os
import re
import sys
@@ -0,0 +1,16 @@
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import os
import sys
import third_party
from util import run_output, build_path

out_filename = sys.argv[1]

args_list = run_output([
third_party.gn_path, "args",
build_path(), "--list", "--short", "--overrides-only"
],
env=third_party.google_env())

with open(out_filename, "w") as f:
f.write(args_list)

0 comments on commit a7bb8cc

Please sign in to comment.
You can’t perform that action at this time.