Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 from recipe_engine.types import freeze | |
| 6 | |
| 7 DEPS = [ | |
| 8 'chromium_tests', | |
| 9 'depot_tools/bot_update', | |
| 10 'depot_tools/gclient', | |
| 11 'depot_tools/git', | |
| 12 'recipe_engine/path', | |
| 13 'recipe_engine/properties', | |
| 14 'recipe_engine/python', | |
| 15 'recipe_engine/raw_io', | |
| 16 'recipe_engine/shutil', | |
| 17 'recipe_engine/step', | |
| 18 ] | |
| 19 | |
| 20 MASTERS = freeze({ | |
| 21 'chromium.fyi': { | |
| 22 'buildername': 'Chromium DevTools Linux', | |
| 23 'testname': 'devtools_fyi', | |
| 24 }, | |
| 25 }) | |
| 26 | |
| 27 def RunSteps(api): | |
| 28 api.gclient.set_config('chromium') | |
| 29 api.bot_update.ensure_checkout(force=True) | |
| 30 | |
| 31 has_devtools_file = False | |
| 32 files = api.chromium_tests.get_files_affected_by_patch() | |
| 33 for f in files: | |
| 34 if f.startswith('third_party/WebKit/Source/devtools'): | |
| 35 has_devtools_file = True | |
| 36 | |
| 37 if not has_devtools_file: | |
| 38 api.step('skip checks', ['echo', 'no devtools file in patch']) | |
| 39 return | |
| 40 | |
| 41 def get_devtools_path(*sub_paths): | |
| 42 devtools_sub_path = ('third_party', 'WebKit', 'Source', 'devtools') | |
| 43 joined_path = devtools_sub_path + sub_paths | |
| 44 return api.path['checkout'].join(*joined_path) | |
| 45 | |
| 46 devtools_path = get_devtools_path() | |
| 47 npm_path = get_devtools_path('scripts', 'buildbot', 'npm.py') | |
| 48 npm_modules_checkout_path = get_devtools_path('npm_modules') | |
| 49 node_modules_src_path = get_devtools_path( | |
| 50 'npm_modules', 'devtools', 'node_modules') | |
| 51 node_modules_dest_path = get_devtools_path('node_modules') | |
| 52 | |
| 53 api.python('install node.js and npm', npm_path, ['--version']) | |
| 54 | |
| 55 api.git.checkout( | |
|
Ryan Tseng
2016/09/02 18:49:04
add todo to add this to DEPS
chenwilliam
2016/09/02 20:51:04
Done.
| |
| 56 url='https://chromium.googlesource.com/deps/third_party/npm_modules', | |
| 57 ref='master', | |
|
Ryan Tseng
2016/09/02 18:49:04
May want to pin this?
chenwilliam
2016/09/02 20:51:04
Added a todo.
| |
| 58 dir_path=npm_modules_checkout_path) | |
| 59 | |
| 60 api.shutil.rmtree(node_modules_dest_path) | |
|
Ryan Tseng
2016/09/02 18:49:04
Document why you have to do this
chenwilliam
2016/09/02 20:51:04
Done.
| |
| 61 api.shutil.copytree( | |
| 62 'copy npm modules', node_modules_src_path, node_modules_dest_path) | |
| 63 | |
| 64 api.python('run eslint', npm_path, ['run', 'lint'], cwd=devtools_path) | |
| 65 | |
| 66 def GenTests(api): | |
| 67 for mastername, config in MASTERS.iteritems(): | |
| 68 yield ( | |
| 69 api.test(config['testname'] + '_no_devtools_file') + | |
| 70 api.properties.generic( | |
| 71 buildername=config['buildername'], | |
| 72 mastername=mastername, | |
| 73 ) | |
| 74 ) | |
| 75 yield ( | |
| 76 api.test(config['testname'] + '_with_devtools_file') + | |
| 77 api.properties.generic( | |
| 78 buildername=config['buildername'], | |
| 79 mastername=mastername, | |
| 80 ) + | |
| 81 api.override_step_data( | |
| 82 'git diff to analyze patch', | |
| 83 api.raw_io.stream_output( | |
| 84 'third_party/WebKit/Source/devtools/fake.js\n') | |
| 85 ) | |
| 86 ) | |
| OLD | NEW |