OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2009 The Closure Library Authors. All Rights Reserved. | 3 # Copyright 2009 The Closure Library Authors. All Rights Reserved. |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 elif output_mode == 'script': | 239 elif output_mode == 'script': |
240 out.writelines([js_source.GetSource() for js_source in deps]) | 240 out.writelines([js_source.GetSource() for js_source in deps]) |
241 elif output_mode == 'compiled': | 241 elif output_mode == 'compiled': |
242 logging.warning("""\ | 242 logging.warning("""\ |
243 Closure Compiler now natively understands and orders Closure dependencies and | 243 Closure Compiler now natively understands and orders Closure dependencies and |
244 is prefererred over using this script for performing JavaScript compilation. | 244 is prefererred over using this script for performing JavaScript compilation. |
245 | 245 |
246 Please migrate your codebase. | 246 Please migrate your codebase. |
247 | 247 |
248 See: | 248 See: |
249 https://code.google.com/p/closure-compiler/wiki/ManageClosureDependencies | 249 https://github.com/google/closure-compiler/wiki/Manage-Closure-Dependencies |
250 """) | 250 """) |
251 | 251 |
252 # Make sure a .jar is specified. | 252 # Make sure a .jar is specified. |
253 if not options.compiler_jar: | 253 if not options.compiler_jar: |
254 logging.error('--compiler_jar flag must be specified if --output is ' | 254 logging.error('--compiler_jar flag must be specified if --output is ' |
255 '"compiled"') | 255 '"compiled"') |
256 sys.exit(2) | 256 sys.exit(2) |
257 | 257 |
258 # Will throw an error if the compilation fails. | 258 # Will throw an error if the compilation fails. |
259 compiled_source = jscompiler.Compile( | 259 compiled_source = jscompiler.Compile( |
260 options.compiler_jar, | 260 options.compiler_jar, |
261 [js_source.GetPath() for js_source in deps], | 261 [js_source.GetPath() for js_source in deps], |
262 jvm_flags=options.jvm_flags, | 262 jvm_flags=options.jvm_flags, |
263 compiler_flags=options.compiler_flags) | 263 compiler_flags=options.compiler_flags) |
264 | 264 |
265 logging.info('JavaScript compilation succeeded.') | 265 logging.info('JavaScript compilation succeeded.') |
266 out.write(compiled_source) | 266 out.write(compiled_source) |
267 | 267 |
268 else: | 268 else: |
269 logging.error('Invalid value for --output flag.') | 269 logging.error('Invalid value for --output flag.') |
270 sys.exit(2) | 270 sys.exit(2) |
271 | 271 |
272 | 272 |
273 if __name__ == '__main__': | 273 if __name__ == '__main__': |
274 main() | 274 main() |
OLD | NEW |