mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
Add Deno.version.gnArgs (#1845)
To display specific build args passed to GN.
This commit is contained in:
parent
8c310d3d56
commit
a7bb8ccce8
6 changed files with 39 additions and 3 deletions
12
BUILD.gn
12
BUILD.gn
|
@ -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
|
||||
|
|
16
tools/write_gn_args.py
Normal file
16
tools/write_gn_args.py
Normal file
|
@ -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)
|
Loading…
Reference in a new issue