| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 Google Inc. All rights reserved. | 2 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| 11 # copyright notice, this list of conditions and the following disclaimer | 11 # copyright notice, this list of conditions and the following disclaimer |
| 12 # in the documentation and/or other materials provided with the | 12 # in the documentation and/or other materials provided with the |
| 13 # distribution. | 13 # distribution. |
| 14 # * Neither the name of Google Inc. nor the names of its | 14 # * Neither the name of Google Inc. nor the names of its |
| 15 # contributors may be used to endorse or promote products derived from | 15 # contributors may be used to endorse or promote products derived from |
| 16 # this software without specific prior written permission. | 16 # this software without specific prior written permission. |
| 17 # | 17 # |
| 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 from modular_build import read_file, write_file | |
| 31 import os | 30 import os |
| 32 import os.path as path | 31 import os.path as path |
| 33 import generate_protocol_externs | |
| 34 import modular_build | |
| 35 import re | 32 import re |
| 36 import shutil | 33 import shutil |
| 37 import subprocess | 34 import subprocess |
| 38 import sys | 35 import sys |
| 39 import tempfile | 36 import tempfile |
| 37 |
| 38 from build import modular_build |
| 39 from build import generate_protocol_externs |
| 40 |
| 40 try: | 41 try: |
| 41 import simplejson as json | 42 import simplejson as json |
| 42 except ImportError: | 43 except ImportError: |
| 43 import json | 44 import json |
| 44 | 45 |
| 45 | 46 |
| 46 if len(sys.argv) == 2 and sys.argv[1] == '--help': | 47 if len(sys.argv) == 2 and sys.argv[1] == '--help': |
| 47 print("Usage: %s [module_names]" % path.basename(sys.argv[0])) | 48 print("Usage: %s [module_names]" % path.basename(sys.argv[0])) |
| 48 print(" module_names list of modules for which the Closure compilation s
hould run.") | 49 print(" module_names list of modules for which the Closure compilation s
hould run.") |
| 49 print(" If absent, the entire frontend will be compiled.") | 50 print(" If absent, the entire frontend will be compiled.") |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 227 |
| 227 if not is_ok: | 228 if not is_ok: |
| 228 print 'NOTE: Java executable version %d.%d or above not found in $PATH.'
% (required_major, required_minor) | 229 print 'NOTE: Java executable version %d.%d or above not found in $PATH.'
% (required_major, required_minor) |
| 229 sys.exit(1) | 230 sys.exit(1) |
| 230 print 'Java executable: %s%s' % (java_path, '' if has_server_jvm else ' (no
server JVM)') | 231 print 'Java executable: %s%s' % (java_path, '' if has_server_jvm else ' (no
server JVM)') |
| 231 return exec_command | 232 return exec_command |
| 232 | 233 |
| 233 java_exec = find_java() | 234 java_exec = find_java() |
| 234 | 235 |
| 235 closure_compiler_jar = to_platform_path(path.join(scripts_path, 'closure', 'comp
iler.jar')) | 236 closure_compiler_jar = to_platform_path(path.join(scripts_path, 'closure', 'comp
iler.jar')) |
| 236 closure_runner_jar = to_platform_path(path.join(scripts_path, 'compiler-runner',
'closure-runner.jar')) | 237 closure_runner_jar = to_platform_path(path.join(scripts_path, 'closure', 'closur
e_runner', 'closure_runner.jar')) |
| 237 jsdoc_validator_jar = to_platform_path(path.join(scripts_path, 'jsdoc-validator'
, 'jsdoc-validator.jar')) | 238 jsdoc_validator_jar = to_platform_path(path.join(scripts_path, 'jsdoc_validator'
, 'jsdoc_validator.jar')) |
| 238 | 239 |
| 239 modules_dir = tempfile.mkdtemp() | 240 modules_dir = tempfile.mkdtemp() |
| 240 common_closure_args = [ | 241 common_closure_args = [ |
| 241 '--summary_detail_level', '3', | 242 '--summary_detail_level', '3', |
| 242 '--jscomp_error', 'visibility', | 243 '--jscomp_error', 'visibility', |
| 243 '--compilation_level', 'SIMPLE_OPTIMIZATIONS', | 244 '--compilation_level', 'SIMPLE_OPTIMIZATIONS', |
| 244 '--warning_level', 'VERBOSE', | 245 '--warning_level', 'VERBOSE', |
| 245 '--language_in=ES6_STRICT', | 246 '--language_in=ES6_STRICT', |
| 246 '--language_out=ES5_STRICT', | 247 '--language_out=ES5_STRICT', |
| 247 '--extra_annotation_name', 'suppressReceiverCheck', | 248 '--extra_annotation_name', 'suppressReceiverCheck', |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 print 'devtools.js compilation output:%s' % os.linesep, devtools_js_compile_out | 459 print 'devtools.js compilation output:%s' % os.linesep, devtools_js_compile_out |
| 459 errors_found |= has_errors(devtools_js_compile_out) | 460 errors_found |= has_errors(devtools_js_compile_out) |
| 460 | 461 |
| 461 os.remove(compiler_args_file.name) | 462 os.remove(compiler_args_file.name) |
| 462 os.remove(protocol_externs_file) | 463 os.remove(protocol_externs_file) |
| 463 shutil.rmtree(modules_dir, True) | 464 shutil.rmtree(modules_dir, True) |
| 464 | 465 |
| 465 if errors_found: | 466 if errors_found: |
| 466 print 'ERRORS DETECTED' | 467 print 'ERRORS DETECTED' |
| 467 sys.exit(1) | 468 sys.exit(1) |
| OLD | NEW |