summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn12
-rw-r--r--js/version.ts4
-rw-r--r--js/version_test.ts4
-rw-r--r--rollup.config.js4
-rwxr-xr-xtools/setup.py2
-rw-r--r--tools/write_gn_args.py16
6 files changed, 39 insertions, 3 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 4e7ab41ad..6c2528704 100644
--- a/BUILD.gn
+++ b/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) ]
+}
diff --git a/js/version.ts b/js/version.ts
index 805e565a0..984550a74 100644
--- a/js/version.ts
+++ b/js/version.ts
@@ -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
};
/**
diff --git a/js/version_test.ts b/js/version_test.ts
index d3d1bc3df..bef00dbc3 100644
--- a/js/version_test.ts
+++ b/js/version_test.ts
@@ -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);
+});
diff --git a/rollup.config.js b/rollup.config.js
index 34f998b73..9c69fcf2a 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -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
diff --git a/tools/setup.py b/tools/setup.py
index 4958cca2a..95b3b880a 100755
--- a/tools/setup.py
+++ b/tools/setup.py
@@ -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
diff --git a/tools/write_gn_args.py b/tools/write_gn_args.py
new file mode 100644
index 000000000..764dcc6c1
--- /dev/null
+++ b/tools/write_gn_args.py
@@ -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)