Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print gn args with -vv option #1845

Merged
merged 4 commits into from Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions BUILD.gn
Expand Up @@ -219,6 +219,7 @@ bundle("main_bundle") {
deps = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add data = [ "$target_gen_dir/gn_args.txt" ]

(if it doesn't work, at least add a TODO to do it)

":deno_runtime_declaration",
":msg_ts",
":write_gn_args",
]
}

Expand Down Expand Up @@ -258,3 +259,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) ]
}
4 changes: 3 additions & 1 deletion js/version.ts
Expand Up @@ -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
};

/**
Expand Down
4 changes: 4 additions & 0 deletions js/version_test.ts
Expand Up @@ -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);
});
4 changes: 3 additions & 1 deletion rollup.config.js
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/setup.py
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions 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)