Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 'depot_tools/bot_update', | 8 'depot_tools/bot_update', |
| 9 'chromium', | 9 'chromium', |
| 10 'commit_position', | 10 'commit_position', |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 'tools/deps2git': '%s/chromium/tools/deps2git' % CHROMIUM_GIT_URL, | 38 'tools/deps2git': '%s/chromium/tools/deps2git' % CHROMIUM_GIT_URL, |
| 39 'tools/gsd_generate_index':\ | 39 'tools/gsd_generate_index':\ |
| 40 '%s/chromium/tools/gsd_generate_index' % CHROMIUM_GIT_URL, | 40 '%s/chromium/tools/gsd_generate_index' % CHROMIUM_GIT_URL, |
| 41 'tools/perf': '%s/chromium/tools/perf' % CHROMIUM_GIT_URL, | 41 'tools/perf': '%s/chromium/tools/perf' % CHROMIUM_GIT_URL, |
| 42 }) | 42 }) |
| 43 | 43 |
| 44 LINUX_GN_ARGS = [ | 44 LINUX_GN_ARGS = [ |
| 45 'is_clang=true', | 45 'is_clang=true', |
| 46 'is_component_build=true', | 46 'is_component_build=true', |
| 47 'is_debug=true', | 47 'is_debug=true', |
| 48 'goma_dir="/b/build/goma"', | |
| 49 'symbol_level=1', | 48 'symbol_level=1', |
| 50 'target_cpu="x64"', | 49 'target_cpu="x64"', |
| 51 'use_goma=true', | |
| 52 ] | 50 ] |
| 53 | 51 |
| 54 CHROMEOS_GN_ARGS = LINUX_GN_ARGS + [ | 52 CHROMEOS_GN_ARGS = LINUX_GN_ARGS + [ |
| 55 'target_os="chromeos"', | 53 'target_os="chromeos"', |
| 56 'use_ozone=true', | 54 'use_ozone=true', |
| 57 ] | 55 ] |
| 58 | 56 |
| 59 SPEC = freeze({ | 57 SPEC = freeze({ |
| 60 # The builders have the following parameters: | 58 # The builders have the following parameters: |
| 61 # - compile_targets: the compile targets. | 59 # - compile_targets: the compile targets. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 'platform': 'chromeos', | 94 'platform': 'chromeos', |
| 97 }, | 95 }, |
| 98 }, | 96 }, |
| 99 }) | 97 }) |
| 100 | 98 |
| 101 def GenerateCompilationDatabase(api, debug_path, targets, platform): | 99 def GenerateCompilationDatabase(api, debug_path, targets, platform): |
| 102 # TODO(akuegel): If we ever build on Windows or Mac, this needs to be | 100 # TODO(akuegel): If we ever build on Windows or Mac, this needs to be |
| 103 # adjusted. | 101 # adjusted. |
| 104 gn_path = api.path['checkout'].join('buildtools', 'linux64', 'gn') | 102 gn_path = api.path['checkout'].join('buildtools', 'linux64', 'gn') |
| 105 args = LINUX_GN_ARGS if platform == 'linux' else CHROMEOS_GN_ARGS | 103 args = LINUX_GN_ARGS if platform == 'linux' else CHROMEOS_GN_ARGS |
| 104 if (hasattr(api.chromium.c.compile_py, 'goma_dir') and | |
| 105 api.chromium.c.compile_py.goma_dir): | |
| 106 args.append('use_goma=true') | |
|
ukai
2016/09/14 04:10:06
also add goma_dir?
tikuta
2016/09/14 04:13:57
Done.
| |
| 106 command = [gn_path, 'gen', debug_path, '--args=%s' % ' '.join(args)] | 107 command = [gn_path, 'gen', debug_path, '--args=%s' % ' '.join(args)] |
| 107 api.step('generate build files for %s' % platform, command, | 108 api.step('generate build files for %s' % platform, command, |
| 108 cwd=api.path['checkout']) | 109 cwd=api.path['checkout']) |
| 109 command = ['ninja', '-C', debug_path] + list(targets) | 110 command = ['ninja', '-C', debug_path] + list(targets) |
| 110 # Add the parameters for creating the compilation database. | 111 # Add the parameters for creating the compilation database. |
| 111 command += ['-t', 'compdb', 'cc', 'cxx', 'objc', 'objcxx'] | 112 command += ['-t', 'compdb', 'cc', 'cxx', 'objc', 'objcxx'] |
| 112 return api.step('generate compilation database for %s' % platform, | 113 return api.step('generate compilation database for %s' % platform, |
| 113 command, | 114 command, |
| 114 stdout=api.raw_io.output()) | 115 stdout=api.raw_io.output()) |
| 115 | 116 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 133 | 134 |
| 134 # Remove the llvm-build directory, so that gclient runhooks will download | 135 # Remove the llvm-build directory, so that gclient runhooks will download |
| 135 # the pre-built clang binary and not use the locally compiled binary from | 136 # the pre-built clang binary and not use the locally compiled binary from |
| 136 # the 'compile translation_unit clang tool' step. | 137 # the 'compile translation_unit clang tool' step. |
| 137 api.file.rmtree('llvm-build', | 138 api.file.rmtree('llvm-build', |
| 138 api.path['checkout'].join('third_party', 'llvm-build')) | 139 api.path['checkout'].join('third_party', 'llvm-build')) |
| 139 | 140 |
| 140 debug_path = api.path['checkout'].join('out', 'Debug') | 141 debug_path = api.path['checkout'].join('out', 'Debug') |
| 141 targets = bot_config.get('compile_targets', []) | 142 targets = bot_config.get('compile_targets', []) |
| 142 api.chromium.set_config('codesearch', BUILD_CONFIG='Debug') | 143 api.chromium.set_config('codesearch', BUILD_CONFIG='Debug') |
| 144 api.chromium.ensure_goma() | |
| 143 api.chromium.runhooks() | 145 api.chromium.runhooks() |
| 144 | 146 |
| 145 result = GenerateCompilationDatabase(api, debug_path, targets, platform) | 147 result = GenerateCompilationDatabase(api, debug_path, targets, platform) |
| 146 | 148 |
| 147 try: | 149 try: |
| 148 api.chromium.compile(targets) | 150 api.chromium.compile(targets) |
| 149 except api.step.StepFailure as f: # pragma: no cover | 151 except api.step.StepFailure as f: # pragma: no cover |
| 150 # Even if compilation fails, the Grok indexer may still be able to extract | 152 # Even if compilation fails, the Grok indexer may still be able to extract |
| 151 # (almost) all cross references. And the downside of failing on compile | 153 # (almost) all cross references. And the downside of failing on compile |
| 152 # error is that Codesearch gets stale. | 154 # error is that Codesearch gets stale. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 api.test( | 258 api.test( |
| 257 'full_%s_fail' % _sanitize_nonalpha('ChromiumOS Codesearch')) + | 259 'full_%s_fail' % _sanitize_nonalpha('ChromiumOS Codesearch')) + |
| 258 api.step_data('generate compilation database for chromeos', | 260 api.step_data('generate compilation database for chromeos', |
| 259 stdout=api.raw_io.output('some compilation data')) + | 261 stdout=api.raw_io.output('some compilation data')) + |
| 260 api.step_data('generate compilation database for linux', | 262 api.step_data('generate compilation database for linux', |
| 261 stdout=api.raw_io.output('some compilation data')) + | 263 stdout=api.raw_io.output('some compilation data')) + |
| 262 api.step_data('run translation_unit clang tool', retcode=2) + | 264 api.step_data('run translation_unit clang tool', retcode=2) + |
| 263 api.properties.generic(buildername='ChromiumOS Codesearch', | 265 api.properties.generic(buildername='ChromiumOS Codesearch', |
| 264 mastername='chromium.infra.cron') | 266 mastername='chromium.infra.cron') |
| 265 ) | 267 ) |
| OLD | NEW |