Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from recipe_engine.types import freeze | 5 from recipe_engine.types import freeze |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'chromium_tests', | 8 'chromium_checkout', |
| 9 'depot_tools/bot_update', | 9 'depot_tools/bot_update', |
| 10 'depot_tools/gclient', | 10 'depot_tools/gclient', |
| 11 'depot_tools/git', | 11 'depot_tools/git', |
| 12 'depot_tools/tryserver', | |
| 12 'recipe_engine/path', | 13 'recipe_engine/path', |
| 13 'recipe_engine/properties', | 14 'recipe_engine/properties', |
| 14 'recipe_engine/python', | 15 'recipe_engine/python', |
| 15 'recipe_engine/raw_io', | 16 'recipe_engine/raw_io', |
| 16 'recipe_engine/shutil', | 17 'recipe_engine/shutil', |
| 17 'recipe_engine/step', | 18 'recipe_engine/step', |
| 18 ] | 19 ] |
| 19 | 20 |
| 20 MASTERS = freeze({ | 21 MASTERS = freeze({ |
| 21 'chromium.fyi': { | 22 'chromium.fyi': { |
| 22 'buildername': 'Chromium DevTools Linux', | 23 'buildername': 'Chromium DevTools Linux', |
| 23 'testname': 'devtools_fyi', | 24 'testname': 'devtools_fyi', |
| 24 }, | 25 }, |
| 25 }) | 26 }) |
| 26 | 27 |
| 28 def should_skip_checks(api): | |
| 29 if not api.tryserver.is_tryserver: | |
| 30 return False | |
| 31 | |
| 32 files = api.chromium_checkout.get_files_affected_by_patch() | |
| 33 for f in files: | |
| 34 if f.startswith('third_party/WebKit/Source/devtools'): | |
| 35 return False | |
| 36 return True | |
|
iannucci
2016/09/07 01:46:11
# gloabally
AFFECTED_PATHS = (
'third_party/WebK
chenwilliam
2016/09/07 17:35:03
Done.
| |
| 37 | |
| 27 def RunSteps(api): | 38 def RunSteps(api): |
| 28 api.gclient.set_config('chromium') | 39 api.gclient.set_config('chromium') |
| 29 api.bot_update.ensure_checkout(force=True) | 40 api.bot_update.ensure_checkout(force=True) |
| 30 | 41 |
| 31 has_devtools_file = False | 42 if should_skip_checks(api): |
| 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']) | 43 api.step('skip checks', ['echo', 'no devtools file in patch']) |
| 39 return | 44 return |
| 40 | 45 |
| 41 def get_devtools_path(*sub_paths): | 46 def get_devtools_path(*sub_paths): |
| 42 devtools_sub_path = ('third_party', 'WebKit', 'Source', 'devtools') | 47 devtools_sub_path = ('third_party', 'WebKit', 'Source', 'devtools') |
| 43 joined_path = devtools_sub_path + sub_paths | 48 joined_path = devtools_sub_path + sub_paths |
| 44 return api.path['checkout'].join(*joined_path) | 49 return api.path['checkout'].join(*joined_path) |
|
iannucci
2016/09/07 01:46:11
this looks duplicated, but maybe it's rietveld?
chenwilliam
2016/09/07 17:35:02
I think this is just the rietveld diff.
| |
| 45 | 50 |
| 46 devtools_path = get_devtools_path() | 51 devtools_path = get_devtools_path() |
| 47 npm_path = get_devtools_path('scripts', 'buildbot', 'npm.py') | 52 node_path = get_devtools_path('scripts', 'buildbot', 'node.py') |
| 48 npm_modules_checkout_path = get_devtools_path('npm_modules') | 53 npm_modules_checkout_path = get_devtools_path('npm_modules') |
| 49 node_modules_src_path = get_devtools_path( | 54 eslint_path = get_devtools_path( |
| 50 'npm_modules', 'devtools', 'node_modules') | 55 'npm_modules', 'node_modules', '.bin', 'eslint') |
| 51 node_modules_dest_path = get_devtools_path('node_modules') | |
| 52 | 56 |
| 53 api.python('install node.js and npm', npm_path, ['--version']) | 57 api.python('install node.js and npm', node_path, ['--version']) |
| 54 | 58 |
| 55 # TODO(chenwilliam): instead of checkout here, add it as DEPS | 59 # TODO(chenwilliam): instead of checkout here, add it as DEPS |
| 56 api.git.checkout( | 60 api.git.checkout( |
| 57 url='https://chromium.googlesource.com/deps/third_party/npm_modules', | 61 url='https://chromium.googlesource.com/deps/third_party/npm_modules', |
| 58 # TODO(chenwilliam): pin this ref to a specific commit | 62 ref='8451e3a3fae09eaa18ddeed0c069a8e2f0e3541c', |
| 59 ref='master', | |
| 60 dir_path=npm_modules_checkout_path) | 63 dir_path=npm_modules_checkout_path) |
| 61 | 64 |
| 62 # Moving the node_modules folder within the npm_modules git checkout | 65 eslint_args = [ |
| 63 # because npm expects a certain directory layout | 66 eslint_path, '-c', 'front_end/.eslintrc.js', |
| 64 # this is a naive approach to ensure we're using the latest npm_modules | 67 '--ignore-path', 'front_end/.eslintignore', 'front_end' |
| 65 api.shutil.rmtree(node_modules_dest_path) | 68 ] |
| 66 api.shutil.copytree( | 69 api.python('run eslint', node_path, eslint_args, cwd=devtools_path) |
| 67 'copy npm modules', node_modules_src_path, node_modules_dest_path) | |
| 68 | 70 |
| 69 api.python('run eslint', npm_path, ['run', 'lint'], cwd=devtools_path) | 71 |
| 72 def tryserver_properties(api, mastername, config): | |
| 73 return api.properties.generic( | |
| 74 buildername=config['buildername'], | |
| 75 mastername=mastername, | |
| 76 rietveld=True, | |
|
iannucci
2016/09/07 01:46:11
this should be rietveld='https://rietveld.example.
chenwilliam
2016/09/07 17:35:03
Done.
| |
| 77 issue=1, | |
| 78 patchset=2, | |
| 79 ) | |
| 70 | 80 |
| 71 def GenTests(api): | 81 def GenTests(api): |
| 72 for mastername, config in MASTERS.iteritems(): | 82 for mastername, config in MASTERS.iteritems(): |
| 73 yield ( | 83 yield ( |
| 74 api.test(config['testname'] + '_no_devtools_file') + | 84 api.test(config['testname'] + '_main') + |
| 75 api.properties.generic( | 85 api.properties.generic( |
| 76 buildername=config['buildername'], | 86 buildername=config['buildername'], |
| 77 mastername=mastername, | 87 mastername=mastername, |
| 78 ) | 88 ) |
| 79 ) | 89 ) |
| 80 yield ( | 90 yield ( |
| 81 api.test(config['testname'] + '_with_devtools_file') + | 91 api.test(config['testname'] + '_tryserver_no_devtools') + |
| 82 api.properties.generic( | 92 tryserver_properties(api, mastername, config) |
| 83 buildername=config['buildername'], | 93 ) |
| 84 mastername=mastername, | 94 yield ( |
| 85 ) + | 95 api.test(config['testname'] + '_tryserver_with_devtools') + |
| 96 tryserver_properties(api, mastername, config) + | |
| 86 api.override_step_data( | 97 api.override_step_data( |
| 87 'git diff to analyze patch', | 98 'git diff to analyze patch', |
| 88 api.raw_io.stream_output( | 99 api.raw_io.stream_output( |
| 89 'third_party/WebKit/Source/devtools/fake.js\n') | 100 'third_party/WebKit/Source/devtools/fake.js\n') |
| 90 ) | 101 ) |
| 91 ) | 102 ) |
| OLD | NEW |