| 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 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 processed_modules[name] = True | 327 processed_modules[name] = True |
| 328 module = modules_by_name[name] | 328 module = modules_by_name[name] |
| 329 | 329 |
| 330 command = '' | 330 command = '' |
| 331 dependencies = module.get('dependencies', []) | 331 dependencies = module.get('dependencies', []) |
| 332 if recursively: | 332 if recursively: |
| 333 for dependency in dependencies: | 333 for dependency in dependencies: |
| 334 command += dump_module(dependency, recursively, processed_modules) | 334 command += dump_module(dependency, recursively, processed_modules) |
| 335 command += module_arg(name) + ':' | 335 command += module_arg(name) + ':' |
| 336 filtered_scripts = descriptors.module_compiled_files(name) | 336 filtered_scripts = descriptors.module_compiled_files(name) |
| 337 filtered_scripts = [path.join(devtools_frontend_path, name, script) for scri
pt in filtered_scripts] |
| 338 # TODO(dgozman): move to separate module |
| 339 if name == 'sdk': |
| 340 filtered_scripts.append(protocol_externs_file) |
| 337 command += str(len(filtered_scripts)) | 341 command += str(len(filtered_scripts)) |
| 338 first_dependency = True | 342 first_dependency = True |
| 339 for dependency in dependencies + [runtime_module_name]: | 343 for dependency in dependencies + [runtime_module_name]: |
| 340 if first_dependency: | 344 if first_dependency: |
| 341 command += ':' | 345 command += ':' |
| 342 else: | 346 else: |
| 343 command += ',' | 347 command += ',' |
| 344 first_dependency = False | 348 first_dependency = False |
| 345 command += jsmodule_name_prefix + dependency | 349 command += jsmodule_name_prefix + dependency |
| 346 for script in filtered_scripts: | 350 for script in filtered_scripts: |
| 347 command += ' --js ' + to_platform_path(path.join(devtools_frontend_path,
name, script)) | 351 command += ' --js ' + to_platform_path(script) |
| 348 return command | 352 return command |
| 349 | 353 |
| 350 print 'Compiling frontend...' | 354 print 'Compiling frontend...' |
| 351 | 355 |
| 352 compiler_args_file = tempfile.NamedTemporaryFile(mode='wt', delete=False) | 356 compiler_args_file = tempfile.NamedTemporaryFile(mode='wt', delete=False) |
| 353 try: | 357 try: |
| 354 platform_protocol_externs_file = to_platform_path(protocol_externs_file) | |
| 355 runtime_js_path = to_platform_path(path.join(devtools_frontend_path, 'Runtim
e.js')) | 358 runtime_js_path = to_platform_path(path.join(devtools_frontend_path, 'Runtim
e.js')) |
| 356 checked_modules = modules_to_check() | 359 checked_modules = modules_to_check() |
| 357 for name in checked_modules: | 360 for name in checked_modules: |
| 358 closure_args = ' '.join(common_closure_args) | 361 closure_args = ' '.join(common_closure_args) |
| 359 closure_args += ' --externs ' + to_platform_path(global_externs_file) | 362 closure_args += ' --externs ' + to_platform_path(global_externs_file) |
| 360 closure_args += ' --externs ' + platform_protocol_externs_file | |
| 361 runtime_module = module_arg(runtime_module_name) + ':1 --js ' + runtime_
js_path | 363 runtime_module = module_arg(runtime_module_name) + ':1 --js ' + runtime_
js_path |
| 362 closure_args += runtime_module + dump_module(name, True, {}) | 364 closure_args += runtime_module + dump_module(name, True, {}) |
| 363 compiler_args_file.write('%s %s%s' % (name, closure_args, os.linesep)) | 365 compiler_args_file.write('%s %s%s' % (name, closure_args, os.linesep)) |
| 364 finally: | 366 finally: |
| 365 compiler_args_file.close() | 367 compiler_args_file.close() |
| 366 | 368 |
| 367 modular_compiler_proc = popen(java_exec + ['-jar', closure_runner_jar, '--compil
er-args-file', to_platform_path_exact(compiler_args_file.name)]) | 369 modular_compiler_proc = popen(java_exec + ['-jar', closure_runner_jar, '--compil
er-args-file', to_platform_path_exact(compiler_args_file.name)]) |
| 368 | 370 |
| 369 spawned_compiler_command = java_exec + [ | 371 spawned_compiler_command = java_exec + [ |
| 370 '-jar', | 372 '-jar', |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 print 'devtools.js compilation output:%s' % os.linesep, devtools_js_compile_out | 458 print 'devtools.js compilation output:%s' % os.linesep, devtools_js_compile_out |
| 457 errors_found |= has_errors(devtools_js_compile_out) | 459 errors_found |= has_errors(devtools_js_compile_out) |
| 458 | 460 |
| 459 os.remove(compiler_args_file.name) | 461 os.remove(compiler_args_file.name) |
| 460 os.remove(protocol_externs_file) | 462 os.remove(protocol_externs_file) |
| 461 shutil.rmtree(modules_dir, True) | 463 shutil.rmtree(modules_dir, True) |
| 462 | 464 |
| 463 if errors_found: | 465 if errors_found: |
| 464 print 'ERRORS DETECTED' | 466 print 'ERRORS DETECTED' |
| 465 sys.exit(1) | 467 sys.exit(1) |
| OLD | NEW |