Chromium Code Reviews| 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..1efa41426111b54a87d0192f569ad7edc29b69e7 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,7 +265,8 @@ 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] |
| + runner_args = ["--%s" % arg for arg in runner_args or []] |
|
aberent
2016/08/02 10:52:24
Using the same variable for both the processed and
Dan Beam
2016/08/02 19:36:33
Done.
|
| + runner_args += ["--compiler-args-file=%s" % args_file] |
| _, stderr = self._run_jar(self._runner_jar, runner_args) |
| errors = stderr.strip().split("\n\n") |
| @@ -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: |