| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 java_exec = "java -Xms1024m -server -XX:+TieredCompilation" | 55 java_exec = "java -Xms1024m -server -XX:+TieredCompilation" |
| 56 | 56 |
| 57 generate_protocol_externs.generate_protocol_externs(protocol_externs_file, path.
join(devtools_path, "protocol.json")) | 57 generate_protocol_externs.generate_protocol_externs(protocol_externs_file, path.
join(devtools_path, "protocol.json")) |
| 58 | 58 |
| 59 jsmodule_name_prefix = "jsmodule_" | 59 jsmodule_name_prefix = "jsmodule_" |
| 60 frontend_modules_name = "frontend_modules.json" | 60 frontend_modules_name = "frontend_modules.json" |
| 61 runtime_module_name = "_runtime" | 61 runtime_module_name = "_runtime" |
| 62 module_initializer_name = "_module.js" | 62 module_initializer_name = "_module.js" |
| 63 | 63 |
| 64 | 64 |
| 65 def log_error(message): |
| 66 print "ERROR: " + message |
| 67 |
| 68 |
| 65 def error_excepthook(exctype, value, traceback): | 69 def error_excepthook(exctype, value, traceback): |
| 66 print "ERROR:" | 70 print "ERROR:" |
| 67 sys.__excepthook__(exctype, value, traceback) | 71 sys.__excepthook__(exctype, value, traceback) |
| 68 sys.excepthook = error_excepthook | 72 sys.excepthook = error_excepthook |
| 69 | 73 |
| 70 try: | 74 try: |
| 71 with open(path.join(scripts_path, frontend_modules_name), "rt") as js_module
s_file: | 75 with open(path.join(scripts_path, frontend_modules_name), "rt") as js_module
s_file: |
| 72 modules = json.loads(js_modules_file.read()) | 76 modules = json.loads(js_modules_file.read()) |
| 73 except: | 77 except: |
| 74 log_error("Failed to read %s" % frontend_modules_name) | 78 log_error("Failed to read %s" % frontend_modules_name) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 90 | 94 |
| 91 | 95 |
| 92 def run_in_shell(command_line): | 96 def run_in_shell(command_line): |
| 93 return subprocess.Popen(command_line, stdout=subprocess.PIPE, stderr=subproc
ess.STDOUT, shell=True) | 97 return subprocess.Popen(command_line, stdout=subprocess.PIPE, stderr=subproc
ess.STDOUT, shell=True) |
| 94 | 98 |
| 95 | 99 |
| 96 def hasErrors(output): | 100 def hasErrors(output): |
| 97 return re.search(error_warning_regex, output) != None | 101 return re.search(error_warning_regex, output) != None |
| 98 | 102 |
| 99 | 103 |
| 100 def log_error(message): | |
| 101 print "ERROR: " + message | |
| 102 | |
| 103 def verify_importScript_usage(): | 104 def verify_importScript_usage(): |
| 104 errors_found = False | 105 errors_found = False |
| 105 for module in modules: | 106 for module in modules: |
| 106 for file_name in module["sources"]: | 107 for file_name in module["sources"]: |
| 107 if path.basename(file_name) == module_initializer_name: | 108 if path.basename(file_name) == module_initializer_name: |
| 108 log_error("Module initializer (%s) may not be listed among modul
e's scripts; found in '%s'" % (module_initializer_name, module["name"])) | 109 log_error("Module initializer (%s) may not be listed among modul
e's scripts; found in '%s'" % (module_initializer_name, module["name"])) |
| 109 errors_found = True | 110 errors_found = True |
| 110 continue | 111 continue |
| 111 try: | 112 try: |
| 112 with open(path.join(devtools_frontend_path, file_name), "r") as
sourceFile: | 113 with open(path.join(devtools_frontend_path, file_name), "r") as
sourceFile: |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 errors_found |= hasErrors(validateInjectedScriptOut) | 406 errors_found |= hasErrors(validateInjectedScriptOut) |
| 406 | 407 |
| 407 if errors_found: | 408 if errors_found: |
| 408 print "ERRORS DETECTED" | 409 print "ERRORS DETECTED" |
| 409 | 410 |
| 410 os.remove(injectedScriptSourceTmpFile) | 411 os.remove(injectedScriptSourceTmpFile) |
| 411 os.remove(injectedScriptCanvasModuleSourceTmpFile) | 412 os.remove(injectedScriptCanvasModuleSourceTmpFile) |
| 412 os.remove(compiler_args_file.name) | 413 os.remove(compiler_args_file.name) |
| 413 os.remove(protocol_externs_file) | 414 os.remove(protocol_externs_file) |
| 414 shutil.rmtree(modules_dir, True) | 415 shutil.rmtree(modules_dir, True) |
| OLD | NEW |