Chromium Code Reviews| Index: scripts/slave/recipes/devtools.py |
| diff --git a/scripts/slave/recipes/devtools.py b/scripts/slave/recipes/devtools.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a615e3680d8d4056d9d1c87ea69d38fce93d1d4f |
| --- /dev/null |
| +++ b/scripts/slave/recipes/devtools.py |
| @@ -0,0 +1,86 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from recipe_engine.types import freeze |
| + |
| +DEPS = [ |
| + 'chromium_tests', |
| + 'depot_tools/bot_update', |
| + 'depot_tools/gclient', |
| + 'depot_tools/git', |
| + 'recipe_engine/path', |
| + 'recipe_engine/properties', |
| + 'recipe_engine/python', |
| + 'recipe_engine/raw_io', |
| + 'recipe_engine/shutil', |
| + 'recipe_engine/step', |
| +] |
| + |
| +MASTERS = freeze({ |
| + 'chromium.fyi': { |
| + 'buildername': 'Chromium DevTools Linux', |
| + 'testname': 'devtools_fyi', |
| + }, |
| +}) |
| + |
| +def RunSteps(api): |
| + api.gclient.set_config('chromium') |
| + api.bot_update.ensure_checkout(force=True) |
| + |
| + has_devtools_file = False |
| + files = api.chromium_tests.get_files_affected_by_patch() |
| + for f in files: |
| + if f.startswith('third_party/WebKit/Source/devtools'): |
| + has_devtools_file = True |
| + |
| + if not has_devtools_file: |
| + api.step('skip checks', ['echo', 'no devtools file in patch']) |
| + return |
| + |
| + def get_devtools_path(*sub_paths): |
| + devtools_sub_path = ('third_party', 'WebKit', 'Source', 'devtools') |
| + joined_path = devtools_sub_path + sub_paths |
| + return api.path['checkout'].join(*joined_path) |
| + |
| + devtools_path = get_devtools_path() |
| + npm_path = get_devtools_path('scripts', 'buildbot', 'npm.py') |
| + npm_modules_checkout_path = get_devtools_path('npm_modules') |
| + node_modules_src_path = get_devtools_path( |
| + 'npm_modules', 'devtools', 'node_modules') |
| + node_modules_dest_path = get_devtools_path('node_modules') |
| + |
| + api.python('install node.js and npm', npm_path, ['--version']) |
| + |
| + 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.
|
| + url='https://chromium.googlesource.com/deps/third_party/npm_modules', |
| + 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.
|
| + dir_path=npm_modules_checkout_path) |
| + |
| + 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.
|
| + api.shutil.copytree( |
| + 'copy npm modules', node_modules_src_path, node_modules_dest_path) |
| + |
| + api.python('run eslint', npm_path, ['run', 'lint'], cwd=devtools_path) |
| + |
| +def GenTests(api): |
| + for mastername, config in MASTERS.iteritems(): |
| + yield ( |
| + api.test(config['testname'] + '_no_devtools_file') + |
| + api.properties.generic( |
| + buildername=config['buildername'], |
| + mastername=mastername, |
| + ) |
| + ) |
| + yield ( |
| + api.test(config['testname'] + '_with_devtools_file') + |
| + api.properties.generic( |
| + buildername=config['buildername'], |
| + mastername=mastername, |
| + ) + |
| + api.override_step_data( |
| + 'git diff to analyze patch', |
| + api.raw_io.stream_output( |
| + 'third_party/WebKit/Source/devtools/fake.js\n') |
| + ) |
| + ) |