Commit c7566749 authored by Christopher Lam's avatar Christopher Lam Committed by Commit Bot

[Closure Compiler GN] Enable checks_only flag for type checking compilations.

This CL adds the checks_only flag to JS Closure Compilations that are only
doing type checking to improve build time.

Before:
5869.41s user 189.50s system 3350% cpu
5861.34s user 190.37s system 3284% cpu

After:
4143.98s user 159.46s system 3020% cpu
4184.40s user 158.95s system 3073% cpu

Bug: 632206
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I68ebdce5a4cf98176d3f55b971e33fc62848d2d4
Reviewed-on: https://chromium-review.googlesource.com/1139840Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: calamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575918}
parent 9eba4d43
......@@ -153,6 +153,7 @@ template("js_binary") {
"closure_flags",
"externs_list",
"extra_deps",
"checks_only",
])
args = [
"--compiler",
......@@ -202,6 +203,9 @@ template("js_binary") {
if (!defined(closure_flags)) {
closure_flags = default_closure_args
}
if (defined(checks_only) && checks_only) {
args += [ "--checks-only" ]
}
args += [ "--flags" ] + closure_flags
args += [
"--externs",
......@@ -227,6 +231,7 @@ template("js_type_check") {
if (closure_compile) {
js_binary(target_name) {
sources = []
checks_only = true
forward_variables_from(invoker, [ "deps" ])
}
} else {
......
......@@ -77,6 +77,8 @@ def main():
'Do not include leading dashes')
parser.add_argument('-e', '--externs', nargs='*', default=[],
help='A list of extern files to pass to the compiler')
parser.add_argument('-co', '--checks-only', action='store_true',
help='Only performs checks and writes an empty output')
args = parser.parse_args()
sources, externs = CrawlDepsTree(args.deps, args.sources, args.externs)
......@@ -93,6 +95,10 @@ def main():
compiler_args += args.config
compiler_args += sources
if args.checks_only:
compiler_args += ['--checks-only']
open(args.output, 'w').close()
returncode, errors = compile2.Checker().run_jar(args.compiler, compiler_args)
if returncode != 0:
print errors
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment