| Index: third_party/closure_compiler/compile.py
|
| diff --git a/third_party/closure_compiler/compile.py b/third_party/closure_compiler/compile.py
|
| index 99d0d103d4d8ba7a3f2d5a9609a5b5629e61f8d0..9132b7d7801d51714aa408e0feea144f2be938e3 100755
|
| --- a/third_party/closure_compiler/compile.py
|
| +++ b/third_party/closure_compiler/compile.py
|
| @@ -183,7 +183,7 @@ class Checker(object):
|
| tmp_file.write(contents)
|
| return tmp_file.name
|
|
|
| - def _run_js_check(self, sources, out_file=None, externs=None,
|
| + def _run_js_check(self, sources, out_file, externs=None,
|
| closure_args=None):
|
| """Check |sources| for type errors.
|
|
|
| @@ -199,10 +199,15 @@ class Checker(object):
|
| """
|
| args = ["--js=%s" % s for s in sources]
|
|
|
| - if out_file:
|
| - out_dir = os.path.dirname(out_file)
|
| - if not os.path.exists(out_dir):
|
| - os.makedirs(out_dir)
|
| + assert out_file
|
| +
|
| + out_dir = os.path.dirname(out_file)
|
| + if not os.path.exists(out_dir):
|
| + os.makedirs(out_dir)
|
| +
|
| + checks_only = 'checks_only' in closure_args
|
| +
|
| + if not checks_only:
|
| args += ["--js_output_file=%s" % out_file]
|
| args += ["--create_source_map=%s" % (self._MAP_FILE_FORMAT % out_file)]
|
|
|
| @@ -227,11 +232,17 @@ class Checker(object):
|
| self._nuke_temp_files()
|
| sys.exit(1)
|
|
|
| - if errors and out_file:
|
| + if errors:
|
| if os.path.exists(out_file):
|
| os.remove(out_file)
|
| if os.path.exists(self._MAP_FILE_FORMAT % out_file):
|
| os.remove(self._MAP_FILE_FORMAT % out_file)
|
| + elif checks_only:
|
| + # Compile succeeded but --checks_only disables --js_output_file from
|
| + # actually writing a file. Write a file ourselves so incremental builds
|
| + # still work.
|
| + with open(out_file, 'w') as f:
|
| + f.write('')
|
|
|
| return errors, stderr
|
|
|
| @@ -323,7 +334,7 @@ if __name__ == "__main__":
|
| help="Process all source files as a group")
|
| parser.add_argument("-d", "--depends", nargs=argparse.ZERO_OR_MORE)
|
| parser.add_argument("-e", "--externs", nargs=argparse.ZERO_OR_MORE)
|
| - parser.add_argument("-o", "--out_file",
|
| + parser.add_argument("-o", "--out_file", required=True,
|
| help="A file where the compiled output is written to")
|
| parser.add_argument("-c", "--closure_args", nargs=argparse.ZERO_OR_MORE,
|
| help="Arguments passed directly to the Closure compiler")
|
|
|