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 DEPS = [ | 5 DEPS = [ |
| 6 'depot_tools/gclient', | 6 'depot_tools/gclient', |
| 7 'depot_tools/bot_update', | 7 'depot_tools/bot_update', |
| 8 'goma', | |
| 8 'recipe_engine/path', | 9 'recipe_engine/path', |
| 9 'recipe_engine/platform', | 10 'recipe_engine/platform', |
| 10 'recipe_engine/properties', | 11 'recipe_engine/properties', |
| 11 'recipe_engine/python', | 12 'recipe_engine/python', |
| 12 'recipe_engine/step', | 13 'recipe_engine/step', |
| 13 ] | 14 ] |
| 14 | 15 |
| 15 from recipe_engine.recipe_api import Property | 16 from recipe_engine.recipe_api import Property |
| 16 | 17 |
| 17 PROPERTIES = { | 18 PROPERTIES = { |
| 18 'skia': Property(default=False, kind=bool), | 19 'skia': Property(default=False, kind=bool), |
| 19 'xfa': Property(default=False, kind=bool), | 20 'xfa': Property(default=False, kind=bool), |
| 20 'memory_tool': Property(default=None, kind=str), | 21 'memory_tool': Property(default=None, kind=str), |
| 21 'v8': Property(default=True, kind=bool), | 22 'v8': Property(default=True, kind=bool), |
| 22 'target_cpu': Property(default=None, kind=str), | 23 'target_cpu': Property(default=None, kind=str), |
| 23 'clang': Property(default=False, kind=bool), | 24 'clang': Property(default=False, kind=bool), |
| 24 'rel': Property(default=False, kind=bool), | 25 'rel': Property(default=False, kind=bool), |
| 25 'skip_test': Property(default=False, kind=bool), | 26 'skip_test': Property(default=False, kind=bool), |
| 26 'target_os': Property(default=None, kind=str), | 27 'target_os': Property(default=None, kind=str), |
| 28 'goma': Property(default=True, kind=bool), | |
|
Paweł Hajdan Jr.
2016/09/07 16:02:10
Why is goma being added as build property?
If it'
tikuta
2016/09/13 09:30:11
Removed
| |
| 27 } | 29 } |
| 28 | 30 |
| 29 def _CheckoutSteps(api, memory_tool, skia, xfa, v8, target_cpu, clang, | 31 def _CheckoutSteps(api, memory_tool, skia, xfa, v8, target_cpu, clang, |
| 30 target_os): | 32 target_os): |
| 31 # Checkout pdfium and its dependencies (specified in DEPS) using gclient. | 33 # Checkout pdfium and its dependencies (specified in DEPS) using gclient. |
| 32 api.gclient.set_config('pdfium') | 34 api.gclient.set_config('pdfium') |
| 33 if target_os: | 35 if target_os: |
| 34 api.gclient.c.target_os = {target_os} | 36 api.gclient.c.target_os = {target_os} |
| 35 api.bot_update.ensure_checkout(force=True) | 37 api.bot_update.ensure_checkout(force=True) |
| 36 | 38 |
| 37 api.gclient.runhooks() | 39 api.gclient.runhooks() |
| 38 | 40 |
| 39 | 41 |
| 40 def _GNGenBuilds(api, memory_tool, skia, xfa, v8, target_cpu, clang, rel, | 42 def _GNGenBuilds(api, memory_tool, skia, xfa, v8, target_cpu, clang, rel, |
| 41 target_os, out_dir): | 43 target_os, goma, out_dir): |
| 42 gn_bool = {True: 'true', False: 'false'} | 44 gn_bool = {True: 'true', False: 'false'} |
| 43 # Generate build files by GN. | 45 # Generate build files by GN. |
| 44 checkout = api.path['checkout'] | 46 checkout = api.path['checkout'] |
| 45 gn_cmd = api.path['depot_tools'].join('gn.py') | 47 gn_cmd = api.path['depot_tools'].join('gn.py') |
| 46 | 48 |
| 47 # Prepare the arguments to pass in. | 49 # Prepare the arguments to pass in. |
| 48 args = [ | 50 args = [ |
| 49 'is_debug=%s' % gn_bool[not rel], | 51 'is_debug=%s' % gn_bool[not rel], |
| 50 'is_component_build=false', | 52 'is_component_build=false', |
| 51 'pdf_enable_v8=%s' % gn_bool[v8], | 53 'pdf_enable_v8=%s' % gn_bool[v8], |
| 52 'pdf_enable_xfa=%s' % gn_bool[xfa], | 54 'pdf_enable_xfa=%s' % gn_bool[xfa], |
| 53 'pdf_use_skia=%s' % gn_bool[skia], | 55 'pdf_use_skia=%s' % gn_bool[skia], |
| 54 'pdf_is_standalone=true', | 56 'pdf_is_standalone=true', |
| 57 'use_goma=%s' % gn_bool[goma], | |
| 55 ] | 58 ] |
| 56 if api.platform.is_win and not memory_tool: | 59 if api.platform.is_win and not memory_tool: |
| 57 args.append('symbol_level=1') | 60 args.append('symbol_level=1') |
| 58 if api.platform.is_linux: | 61 if api.platform.is_linux: |
| 59 args.append('use_sysroot=false') | 62 args.append('use_sysroot=false') |
| 60 if clang: | 63 if clang: |
| 61 args.append('is_clang=true') | 64 args.append('is_clang=true') |
| 62 if memory_tool == 'asan': | 65 if memory_tool == 'asan': |
| 63 args.append('is_asan=true') | 66 args.append('is_asan=true') |
| 64 if target_os: | 67 if target_os: |
| 65 args.append('target_os="%s"' % target_os) | 68 args.append('target_os="%s"' % target_os) |
| 66 if target_cpu == 'x86': | 69 if target_cpu == 'x86': |
| 67 args.append('target_cpu="x86"') | 70 args.append('target_cpu="x86"') |
| 68 | 71 |
| 69 api.python('gn gen', gn_cmd, | 72 api.python('gn gen', gn_cmd, |
| 70 ['--root=' + str(checkout), 'gen', '//out/' + out_dir, | 73 ['--root=' + str(checkout), 'gen', '//out/' + out_dir, |
| 71 '--args=' + ' '.join(args)], | 74 '--args=' + ' '.join(args)], |
| 72 cwd=checkout) | 75 cwd=checkout) |
| 73 | 76 |
| 74 def _BuildSteps(api, out_dir): | 77 def _BuildSteps(api, goma, clang, out_dir): |
| 78 if goma: | |
| 79 api.goma.ensure_goma() | |
| 80 api.goma.start() | |
| 81 | |
| 75 # Build sample file using Ninja | 82 # Build sample file using Ninja |
| 76 debug_path = api.path['checkout'].join('out', out_dir) | 83 debug_path = api.path['checkout'].join('out', out_dir) |
| 77 api.step('compile with ninja', ['ninja', '-C', debug_path]) | 84 ninja_cmd = ['ninja', '-C', debug_path] |
| 85 if goma: | |
| 86 ninja_cmd.extend(['-j', api.goma.recommended_goma_jobs]) | |
| 87 step_result = api.step('compile with ninja', ninja_cmd) | |
| 88 | |
| 89 if goma: | |
|
Paweł Hajdan Jr.
2016/09/07 16:02:10
Instead of two "if goma" blocks, could you introdu
Dirk Pranke
2016/09/08 22:01:56
Paweł, as far as I know we don't do this anywhere
Paweł Hajdan Jr.
2016/09/09 08:56:55
I was mostly thinking about duplicated "if goma" a
tikuta
2016/09/13 09:30:11
use build_with_goma context
| |
| 90 api.goma.stop( | |
| 91 ninja_log_outdir=debug_path, | |
| 92 ninja_log_compiler= 'clang' if clang else 'unknown', | |
| 93 ninja_log_command=ninja_cmd, | |
| 94 ninja_log_exit_status=step_result.retcode, | |
| 95 ) | |
| 78 | 96 |
| 79 | 97 |
| 80 def _RunDrMemoryTests(api, v8): | 98 def _RunDrMemoryTests(api, v8): |
| 81 pdfium_tests_py = str(api.path['checkout'].join('tools', | 99 pdfium_tests_py = str(api.path['checkout'].join('tools', |
| 82 'drmemory', | 100 'drmemory', |
| 83 'scripts', | 101 'scripts', |
| 84 'pdfium_tests.py')) | 102 'pdfium_tests.py')) |
| 85 api.python('unittests', pdfium_tests_py, | 103 api.python('unittests', pdfium_tests_py, |
| 86 args=['--test', 'pdfium_unittests'], | 104 args=['--test', 'pdfium_unittests'], |
| 87 cwd=api.path['checkout']) | 105 cwd=api.path['checkout']) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 api.python('pixel tests', pixel_tests_path, script_args, | 156 api.python('pixel tests', pixel_tests_path, script_args, |
| 139 cwd=api.path['checkout'], env=env) | 157 cwd=api.path['checkout'], env=env) |
| 140 | 158 |
| 141 corpus_tests_path = str(api.path['checkout'].join('testing', 'tools', | 159 corpus_tests_path = str(api.path['checkout'].join('testing', 'tools', |
| 142 'run_corpus_tests.py')) | 160 'run_corpus_tests.py')) |
| 143 api.python('corpus tests', corpus_tests_path, script_args, | 161 api.python('corpus tests', corpus_tests_path, script_args, |
| 144 cwd=api.path['checkout'], env=env) | 162 cwd=api.path['checkout'], env=env) |
| 145 | 163 |
| 146 | 164 |
| 147 def RunSteps(api, memory_tool, skia, xfa, v8, target_cpu, clang, rel, skip_test, | 165 def RunSteps(api, memory_tool, skia, xfa, v8, target_cpu, clang, rel, skip_test, |
| 148 target_os): | 166 target_os, goma): |
| 149 _CheckoutSteps(api, memory_tool, skia, xfa, v8, target_cpu, clang, target_os) | 167 _CheckoutSteps(api, memory_tool, skia, xfa, v8, target_cpu, clang, target_os) |
| 150 | 168 |
| 151 out_dir = 'Release' if rel else 'Debug' | 169 out_dir = 'Release' if rel else 'Debug' |
| 152 | 170 |
| 153 _GNGenBuilds(api, memory_tool, skia, xfa, v8, target_cpu, clang, rel, | 171 _GNGenBuilds(api, memory_tool, skia, xfa, v8, target_cpu, clang, rel, |
| 154 target_os, out_dir) | 172 target_os, goma, out_dir) |
| 155 | 173 |
| 156 _BuildSteps(api, out_dir) | 174 _BuildSteps(api, goma, clang, out_dir) |
| 157 | 175 |
| 158 if skip_test: | 176 if skip_test: |
| 159 return | 177 return |
| 160 | 178 |
| 161 with api.step.defer_results(): | 179 with api.step.defer_results(): |
| 162 _RunTests(api, memory_tool, v8, out_dir) | 180 _RunTests(api, memory_tool, v8, out_dir) |
| 163 | 181 |
| 164 | 182 |
| 165 def GenTests(api): | 183 def GenTests(api): |
| 166 yield ( | 184 yield ( |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 | 390 |
| 373 yield ( | 391 yield ( |
| 374 api.test('android') + | 392 api.test('android') + |
| 375 api.platform('linux', 64) + | 393 api.platform('linux', 64) + |
| 376 api.properties(mastername='client.pdfium', | 394 api.properties(mastername='client.pdfium', |
| 377 buildername='android', | 395 buildername='android', |
| 378 slavename='test_slave', | 396 slavename='test_slave', |
| 379 target_os='android', | 397 target_os='android', |
| 380 skip_test=True) | 398 skip_test=True) |
| 381 ) | 399 ) |
| OLD | NEW |