| 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 # TODO(chenwilliam): instead of checkout here, add it as DEPS |
| 56 api.git.checkout( |
| 57 url='https://chromium.googlesource.com/deps/third_party/npm_modules', |
| 58 # TODO(chenwilliam): pin this ref to a specific commit |
| 59 ref='master', |
| 60 dir_path=npm_modules_checkout_path) |
| 61 |
| 62 # Moving the node_modules folder within the npm_modules git checkout |
| 63 # because npm expects a certain directory layout |
| 64 # this is a naive approach to ensure we're using the latest npm_modules |
| 65 api.shutil.rmtree(node_modules_dest_path) |
| 66 api.shutil.copytree( |
| 67 'copy npm modules', node_modules_src_path, node_modules_dest_path) |
| 68 |
| 69 api.python('run eslint', npm_path, ['run', 'lint'], cwd=devtools_path) |
| 70 |
| 71 def GenTests(api): |
| 72 for mastername, config in MASTERS.iteritems(): |
| 73 yield ( |
| 74 api.test(config['testname'] + '_no_devtools_file') + |
| 75 api.properties.generic( |
| 76 buildername=config['buildername'], |
| 77 mastername=mastername, |
| 78 ) |
| 79 ) |
| 80 yield ( |
| 81 api.test(config['testname'] + '_with_devtools_file') + |
| 82 api.properties.generic( |
| 83 buildername=config['buildername'], |
| 84 mastername=mastername, |
| 85 ) + |
| 86 api.override_step_data( |
| 87 'git diff to analyze patch', |
| 88 api.raw_io.stream_output( |
| 89 'third_party/WebKit/Source/devtools/fake.js\n') |
| 90 ) |
| 91 ) |
| OLD | NEW |