Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: Source/devtools/scripts/compile_frontend.py

Issue 1156823005: DevTools: delete JavaScriptCallFrame.idl (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/injected_script_externs.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return output.strip().replace('\\', '\\\\') 71 return output.strip().replace('\\', '\\\\')
72 72
73 scripts_path = path.dirname(path.abspath(__file__)) 73 scripts_path = path.dirname(path.abspath(__file__))
74 devtools_path = path.dirname(scripts_path) 74 devtools_path = path.dirname(scripts_path)
75 inspector_path = path.join(path.dirname(devtools_path), 'core', 'inspector') 75 inspector_path = path.join(path.dirname(devtools_path), 'core', 'inspector')
76 devtools_frontend_path = path.join(devtools_path, 'front_end') 76 devtools_frontend_path = path.join(devtools_path, 'front_end')
77 patched_es6_externs_file = to_platform_path(path.join(devtools_frontend_path, 'e s6.js')) 77 patched_es6_externs_file = to_platform_path(path.join(devtools_frontend_path, 'e s6.js'))
78 global_externs_file = to_platform_path(path.join(devtools_frontend_path, 'extern s.js')) 78 global_externs_file = to_platform_path(path.join(devtools_frontend_path, 'extern s.js'))
79 protocol_externs_file = path.join(devtools_frontend_path, 'protocol_externs.js') 79 protocol_externs_file = path.join(devtools_frontend_path, 'protocol_externs.js')
80 injected_script_source_name = path.join(inspector_path, 'InjectedScriptSource.js ') 80 injected_script_source_name = path.join(inspector_path, 'InjectedScriptSource.js ')
81 injected_script_externs_static_file = path.join(inspector_path, 'injected_script _externs.js')
81 injected_script_externs_idl_names = [ 82 injected_script_externs_idl_names = [
82 path.join(inspector_path, 'InjectedScriptHost.idl'), 83 path.join(inspector_path, 'InjectedScriptHost.idl'),
83 path.join(inspector_path, 'JavaScriptCallFrame.idl'),
84 ] 84 ]
85 85
86 jsmodule_name_prefix = 'jsmodule_' 86 jsmodule_name_prefix = 'jsmodule_'
87 runtime_module_name = '_runtime' 87 runtime_module_name = '_runtime'
88 88
89 type_checked_jsdoc_tags_list = ['param', 'return', 'type', 'enum'] 89 type_checked_jsdoc_tags_list = ['param', 'return', 'type', 'enum']
90 type_checked_jsdoc_tags_or = '|'.join(type_checked_jsdoc_tags_list) 90 type_checked_jsdoc_tags_or = '|'.join(type_checked_jsdoc_tags_list)
91 91
92 # Basic regex for invalid JsDoc types: an object type name ([A-Z][A-Za-z0-9.]+[A -Za-z0-9]) not preceded by '!', '?', ':' (this, new), or '.' (object property). 92 # Basic regex for invalid JsDoc types: an object type name ([A-Z][A-Za-z0-9.]+[A -Za-z0-9]) not preceded by '!', '?', ':' (this, new), or '.' (object property).
93 invalid_type_regex = re.compile(r'@(?:' + type_checked_jsdoc_tags_or + r')\s*\{. *(?<![!?:.A-Za-z0-9])([A-Z][A-Za-z0-9.]+[A-Za-z0-9])[^/]*\}') 93 invalid_type_regex = re.compile(r'@(?:' + type_checked_jsdoc_tags_or + r')\s*\{. *(?<![!?:.A-Za-z0-9])([A-Z][A-Za-z0-9.]+[A-Za-z0-9])[^/]*\}')
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 # Replace the "var Object" override with a "self.Object" one 379 # Replace the "var Object" override with a "self.Object" one
380 source = re.sub(r'\nvar Object =', '\nself.Object =', source, count=1) 380 source = re.sub(r'\nvar Object =', '\nself.Object =', source, count=1)
381 381
382 write_file(outFileName, source) 382 write_file(outFileName, source)
383 383
384 injectedScriptSourceTmpFile = to_platform_path(path.join(inspector_path, 'Inject edScriptSourceTmp.js')) 384 injectedScriptSourceTmpFile = to_platform_path(path.join(inspector_path, 'Inject edScriptSourceTmp.js'))
385 385
386 unclosure_injected_script(injected_script_source_name, injectedScriptSourceTmpFi le) 386 unclosure_injected_script(injected_script_source_name, injectedScriptSourceTmpFi le)
387 387
388 print 'Compiling InjectedScriptSource.js...' 388 print 'Compiling InjectedScriptSource.js...'
389 injected_script_externs_file = tempfile.NamedTemporaryFile(mode='wt', delete=Fal se) 389 injected_script_externs_generated_file = tempfile.NamedTemporaryFile(mode='wt', delete=False)
390 try: 390 try:
391 generate_injected_script_externs.generate_injected_script_externs(injected_s cript_externs_idl_names, injected_script_externs_file) 391 generate_injected_script_externs.generate_injected_script_externs(injected_s cript_externs_idl_names, injected_script_externs_generated_file)
392 finally: 392 finally:
393 injected_script_externs_file.close() 393 injected_script_externs_generated_file.close()
394 394
395 spawned_compiler_command = '%s -jar %s %s' % (java_exec, closure_compiler_jar, c ommon_closure_args) 395 spawned_compiler_command = '%s -jar %s %s' % (java_exec, closure_compiler_jar, c ommon_closure_args)
396 396
397 command = spawned_compiler_command 397 command = spawned_compiler_command
398 command += ' --externs ' + to_platform_path_exact(injected_script_externs_fil e.name) 398 command += ' --externs ' + to_platform_path_exact(injected_script_externs_gen erated_file.name)
399 command += ' --externs ' + to_platform_path(injected_script_externs_static_fi le)
399 command += ' --externs ' + to_platform_path(protocol_externs_file) 400 command += ' --externs ' + to_platform_path(protocol_externs_file)
400 command += ' --module ' + jsmodule_name_prefix + 'injected_script' + ':1' 401 command += ' --module ' + jsmodule_name_prefix + 'injected_script' + ':1'
401 command += ' --js ' + to_platform_path(injectedScriptSourceTmpFile) 402 command += ' --js ' + to_platform_path(injectedScriptSourceTmpFile)
402 403
403 injectedScriptCompileProc = run_in_shell(command) 404 injectedScriptCompileProc = run_in_shell(command)
404 405
405 print 'Compiling devtools.js...' 406 print 'Compiling devtools.js...'
406 spawned_compiler_command = '%s -jar %s %s' % (java_exec, closure_compiler_jar, c ommon_closure_args) 407 spawned_compiler_command = '%s -jar %s %s' % (java_exec, closure_compiler_jar, c ommon_closure_args)
407 command = spawned_compiler_command 408 command = spawned_compiler_command
408 command += ' --externs ' + to_platform_path(global_externs_file) 409 command += ' --externs ' + to_platform_path(global_externs_file)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 498
498 (validateInjectedScriptOut, _) = validateInjectedScriptProc.communicate() 499 (validateInjectedScriptOut, _) = validateInjectedScriptProc.communicate()
499 print 'Validate InjectedScriptSource.js output:%s' % os.linesep, (validateInject edScriptOut if validateInjectedScriptOut else '<empty>') 500 print 'Validate InjectedScriptSource.js output:%s' % os.linesep, (validateInject edScriptOut if validateInjectedScriptOut else '<empty>')
500 errors_found |= hasErrors(validateInjectedScriptOut) 501 errors_found |= hasErrors(validateInjectedScriptOut)
501 502
502 if errors_found: 503 if errors_found:
503 print 'ERRORS DETECTED' 504 print 'ERRORS DETECTED'
504 505
505 os.remove(injectedScriptSourceTmpFile) 506 os.remove(injectedScriptSourceTmpFile)
506 os.remove(compiler_args_file.name) 507 os.remove(compiler_args_file.name)
507 os.remove(injected_script_externs_file.name) 508 os.remove(injected_script_externs_generated_file.name)
508 os.remove(protocol_externs_file) 509 os.remove(protocol_externs_file)
509 shutil.rmtree(modules_dir, True) 510 shutil.rmtree(modules_dir, True)
OLDNEW
« no previous file with comments | « Source/core/inspector/injected_script_externs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698