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

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

Issue 1073863003: DevTools: remove Canvas profiler from DevTools source base. See details in the bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tests gone Created 5 years, 8 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
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 # pylint: disable=E1103 70 # pylint: disable=E1103
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 webgl_rendering_context_idl_path = path.join(path.dirname(devtools_path), 'core' , 'html', 'canvas', 'WebGLRenderingContextBase.idl')
81 injected_script_source_name = path.join(inspector_path, 'InjectedScriptSource.js ') 80 injected_script_source_name = path.join(inspector_path, 'InjectedScriptSource.js ')
82 canvas_injected_script_source_name = path.join(inspector_path, 'InjectedScriptCa nvasModuleSource.js')
83 injected_script_externs_idl_names = [ 81 injected_script_externs_idl_names = [
84 path.join(inspector_path, 'InjectedScriptHost.idl'), 82 path.join(inspector_path, 'InjectedScriptHost.idl'),
85 path.join(inspector_path, 'JavaScriptCallFrame.idl'), 83 path.join(inspector_path, 'JavaScriptCallFrame.idl'),
86 ] 84 ]
87 85
88 jsmodule_name_prefix = 'jsmodule_' 86 jsmodule_name_prefix = 'jsmodule_'
89 runtime_module_name = '_runtime' 87 runtime_module_name = '_runtime'
90 88
91 type_checked_jsdoc_tags_list = ['param', 'return', 'type', 'enum'] 89 type_checked_jsdoc_tags_list = ['param', 'return', 'type', 'enum']
92 type_checked_jsdoc_tags_or = '|'.join(type_checked_jsdoc_tags_list) 90 type_checked_jsdoc_tags_or = '|'.join(type_checked_jsdoc_tags_list)
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 375
378 # Comment out its return statement 376 # Comment out its return statement
379 source = re.sub(r'\n(\s*return\s+[^;]+;\s*\n\}\)\s*)$', '\n/*\\1*/', source) 377 source = re.sub(r'\n(\s*return\s+[^;]+;\s*\n\}\)\s*)$', '\n/*\\1*/', source)
380 378
381 # Replace the "var Object" override with a "self.Object" one 379 # Replace the "var Object" override with a "self.Object" one
382 source = re.sub(r'\nvar Object =', '\nself.Object =', source, count=1) 380 source = re.sub(r'\nvar Object =', '\nself.Object =', source, count=1)
383 381
384 write_file(outFileName, source) 382 write_file(outFileName, source)
385 383
386 injectedScriptSourceTmpFile = to_platform_path(path.join(inspector_path, 'Inject edScriptSourceTmp.js')) 384 injectedScriptSourceTmpFile = to_platform_path(path.join(inspector_path, 'Inject edScriptSourceTmp.js'))
387 injectedScriptCanvasModuleSourceTmpFile = path.join(inspector_path, 'InjectedScr iptCanvasModuleSourceTmp.js')
388 385
389 unclosure_injected_script(injected_script_source_name, injectedScriptSourceTmpFi le) 386 unclosure_injected_script(injected_script_source_name, injectedScriptSourceTmpFi le)
390 unclosure_injected_script(canvas_injected_script_source_name, injectedScriptCanv asModuleSourceTmpFile)
391 387
392 print 'Compiling InjectedScriptSource.js and InjectedScriptCanvasModuleSource.js ...' 388 print 'Compiling InjectedScriptSource.js...'
393 injected_script_externs_file = tempfile.NamedTemporaryFile(mode='wt', delete=Fal se) 389 injected_script_externs_file = tempfile.NamedTemporaryFile(mode='wt', delete=Fal se)
394 try: 390 try:
395 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_file)
396 finally: 392 finally:
397 injected_script_externs_file.close() 393 injected_script_externs_file.close()
398 394
399 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)
400 396
401 command = spawned_compiler_command 397 command = spawned_compiler_command
402 command += ' --externs ' + to_platform_path_exact(injected_script_externs_fil e.name) 398 command += ' --externs ' + to_platform_path_exact(injected_script_externs_fil e.name)
403 command += ' --externs ' + to_platform_path(protocol_externs_file) 399 command += ' --externs ' + to_platform_path(protocol_externs_file)
404 command += ' --module ' + jsmodule_name_prefix + 'injected_script' + ':1' 400 command += ' --module ' + jsmodule_name_prefix + 'injected_script' + ':1'
405 command += ' --js ' + to_platform_path(injectedScriptSourceTmpFile) 401 command += ' --js ' + to_platform_path(injectedScriptSourceTmpFile)
406 command += ' --module ' + jsmodule_name_prefix + 'injected_canvas_script' + ' :1:' + jsmodule_name_prefix + 'injected_script'
407 command += ' --js ' + to_platform_path(injectedScriptCanvasModuleSourceTm pFile)
408 402
409 injectedScriptCompileProc = run_in_shell(command) 403 injectedScriptCompileProc = run_in_shell(command)
410 404
411 print 'Verifying JSDoc comments...' 405 print 'Verifying JSDoc comments...'
412 additional_jsdoc_check_files = [injectedScriptSourceTmpFile, injectedScriptCanva sModuleSourceTmpFile] 406 additional_jsdoc_check_files = [injectedScriptSourceTmpFile]
413 errors_found |= verify_jsdoc(additional_jsdoc_check_files) 407 errors_found |= verify_jsdoc(additional_jsdoc_check_files)
414 jsdocValidatorProc, jsdocValidatorFileList = verify_jsdoc_extra(additional_jsdoc _check_files) 408 jsdocValidatorProc, jsdocValidatorFileList = verify_jsdoc_extra(additional_jsdoc _check_files)
415 409
416 print 'Checking generated code in InjectedScriptCanvasModuleSource.js...'
417 webgl_check_script_path = path.join(scripts_path, "check_injected_webgl_calls_in fo.py")
418 check_injected_webgl_calls_command = '%s %s %s' % (webgl_check_script_path, webg l_rendering_context_idl_path, canvas_injected_script_source_name)
419 canvasModuleCompileProc = run_in_shell(check_injected_webgl_calls_command)
420
421 print 'Validating InjectedScriptSource.js...' 410 print 'Validating InjectedScriptSource.js...'
422 injectedscript_check_script_path = path.join(scripts_path, "check_injected_scrip t_source.py") 411 injectedscript_check_script_path = path.join(scripts_path, "check_injected_scrip t_source.py")
423 check_injected_script_command = '%s %s' % (injectedscript_check_script_path, inj ected_script_source_name) 412 check_injected_script_command = '%s %s' % (injectedscript_check_script_path, inj ected_script_source_name)
424 validateInjectedScriptProc = run_in_shell(check_injected_script_command) 413 validateInjectedScriptProc = run_in_shell(check_injected_script_command)
425 414
426 print 415 print
427 416
428 (jsdocValidatorOut, _) = jsdocValidatorProc.communicate() 417 (jsdocValidatorOut, _) = jsdocValidatorProc.communicate()
429 if jsdocValidatorOut: 418 if jsdocValidatorOut:
430 print ('JSDoc validator output:%s%s' % (os.linesep, jsdocValidatorOut)) 419 print ('JSDoc validator output:%s%s' % (os.linesep, jsdocValidatorOut))
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 print os.linesep.join(module_output) 472 print os.linesep.join(module_output)
484 473
485 if not has_module_output: 474 if not has_module_output:
486 print moduleCompileOut 475 print moduleCompileOut
487 476
488 if error_count: 477 if error_count:
489 print 'Total Closure errors: %d%s' % (error_count, os.linesep) 478 print 'Total Closure errors: %d%s' % (error_count, os.linesep)
490 errors_found = True 479 errors_found = True
491 480
492 (injectedScriptCompileOut, _) = injectedScriptCompileProc.communicate() 481 (injectedScriptCompileOut, _) = injectedScriptCompileProc.communicate()
493 print 'InjectedScriptSource.js and InjectedScriptCanvasModuleSource.js compilati on output:%s' % os.linesep, injectedScriptCompileOut 482 print 'InjectedScriptSource.js compilation output:%s' % os.linesep, injectedScri ptCompileOut
494 errors_found |= hasErrors(injectedScriptCompileOut) 483 errors_found |= hasErrors(injectedScriptCompileOut)
495 484
496 (canvasModuleCompileOut, _) = canvasModuleCompileProc.communicate()
497 print 'InjectedScriptCanvasModuleSource.js generated code check output:%s' % os. linesep, canvasModuleCompileOut
498 errors_found |= hasErrors(canvasModuleCompileOut)
499
500 (validateInjectedScriptOut, _) = validateInjectedScriptProc.communicate() 485 (validateInjectedScriptOut, _) = validateInjectedScriptProc.communicate()
501 print 'Validate InjectedScriptSource.js output:%s' % os.linesep, (validateInject edScriptOut if validateInjectedScriptOut else '<empty>') 486 print 'Validate InjectedScriptSource.js output:%s' % os.linesep, (validateInject edScriptOut if validateInjectedScriptOut else '<empty>')
502 errors_found |= hasErrors(validateInjectedScriptOut) 487 errors_found |= hasErrors(validateInjectedScriptOut)
503 488
504 if errors_found: 489 if errors_found:
505 print 'ERRORS DETECTED' 490 print 'ERRORS DETECTED'
506 491
507 os.remove(injectedScriptSourceTmpFile) 492 os.remove(injectedScriptSourceTmpFile)
508 os.remove(injectedScriptCanvasModuleSourceTmpFile)
509 os.remove(compiler_args_file.name) 493 os.remove(compiler_args_file.name)
510 os.remove(injected_script_externs_file.name) 494 os.remove(injected_script_externs_file.name)
511 os.remove(protocol_externs_file) 495 os.remove(protocol_externs_file)
512 shutil.rmtree(modules_dir, True) 496 shutil.rmtree(modules_dir, True)
OLDNEW
« no previous file with comments | « Source/devtools/scripts/check_injected_webgl_calls_info.py ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698