Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(874)

Unified Diff: third_party/closure_compiler/compile2.py

Issue 2117653002: Add the ability to pass arguments to runner.jar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@enable-chrome-pass
Patch Set: merge Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/closure_compiler/compile.py ('k') | third_party/closure_compiler/compile_js.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/closure_compiler/compile2.py
diff --git a/third_party/closure_compiler/compile2.py b/third_party/closure_compiler/compile2.py
index df844d129109dc082700ee9e89fe45d6dc534117..20376ed5550245d44e06d51cddb158af26cbafc6 100755
--- a/third_party/closure_compiler/compile2.py
+++ b/third_party/closure_compiler/compile2.py
@@ -189,7 +189,7 @@ class Checker(object):
tmp_file.write(contents)
return tmp_file.name
- def check(self, sources, out_file=None, closure_args=None,
+ def check(self, sources, out_file=None, runner_args=None, closure_args=None,
custom_sources=True):
"""Closure compile |sources| while checking for errors.
@@ -198,6 +198,7 @@ class Checker(object):
sources[1:] are externs and dependencies in topological order. Order
is not guaranteed if custom_sources is True.
out_file: A file where the compiled output is written to.
+ runner_args: Arguments passed to runner.jar.
closure_args: Arguments passed directly to the Closure compiler.
custom_sources: Whether |sources| was customized by the target (e.g. not
in GYP dependency order).
@@ -264,8 +265,9 @@ class Checker(object):
args_file = self._create_temp_file(args_file_content)
self._log_debug("Args file: %s" % args_file)
- runner_args = ["--compiler-args-file=%s" % args_file]
- _, stderr = self._run_jar(self._runner_jar, runner_args)
+ processed_runner_args = ["--%s" % arg for arg in runner_args or []]
+ processed_runner_args += ["--compiler-args-file=%s" % args_file]
+ _, stderr = self._run_jar(self._runner_jar, processed_runner_args)
errors = stderr.strip().split("\n\n")
maybe_summary = errors.pop()
@@ -308,6 +310,8 @@ if __name__ == "__main__":
help="Whether this rules has custom sources.")
parser.add_argument("-o", "--out_file",
help="A file where the compiled output is written to")
+ parser.add_argument("-r", "--runner_args", nargs=argparse.ZERO_OR_MORE,
+ help="Arguments passed to runner.jar")
parser.add_argument("-c", "--closure_args", nargs=argparse.ZERO_OR_MORE,
help="Arguments passed directly to the Closure compiler")
parser.add_argument("-v", "--verbose", action="store_true",
@@ -318,6 +322,7 @@ if __name__ == "__main__":
found_errors, stderr = checker.check(opts.sources, out_file=opts.out_file,
closure_args=opts.closure_args,
+ runner_args=opts.runner_args,
custom_sources=opts.custom_sources)
if found_errors:
« no previous file with comments | « third_party/closure_compiler/compile.py ('k') | third_party/closure_compiler/compile_js.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698