| 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 import re | 5 import re |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'goma', | 8 'goma', |
| 9 'recipe_engine/platform', | 9 'recipe_engine/platform', |
| 10 'recipe_engine/properties', | 10 'recipe_engine/properties', |
| 11 'recipe_engine/step', | 11 'recipe_engine/step', |
| 12 ] | 12 ] |
| 13 | 13 |
| 14 def RunSteps(api): | 14 def RunSteps(api): |
| 15 api.goma.ensure_goma() | 15 api.goma.ensure_goma() |
| 16 api.step('gn', ['gn', 'gen', 'out/Release', | 16 api.step('gn', ['gn', 'gen', 'out/Release', |
| 17 '--args=use_goma=true goma_dir=%s' % api.goma.goma_dir]) | 17 '--args=use_goma=true goma_dir=%s' % api.goma.goma_dir]) |
| 18 | 18 |
| 19 command = list(api.properties.get('build_command')) | 19 command = list(api.properties.get('build_command')) |
| 20 env = {} | 20 env = {} |
| 21 allow_build_without_goma = api.properties.get( | 21 allow_build_without_goma = api.properties.get( |
| 22 'allow_build_without_goma', False) | 22 'allow_build_without_goma', False) |
| 23 | 23 |
| 24 with api.goma.build_with_goma( | 24 api.goma.build_with_goma( |
| 25 name='ninja', |
| 25 ninja_log_outdir=api.properties.get('ninja_log_outdir'), | 26 ninja_log_outdir=api.properties.get('ninja_log_outdir'), |
| 26 ninja_log_compiler=api.properties.get('ninja_log_compiler'), | 27 ninja_log_compiler=api.properties.get('ninja_log_compiler'), |
| 27 ninja_log_command=command, | 28 ninja_command=command, |
| 28 allow_build_without_goma=allow_build_without_goma, | 29 allow_build_without_goma=allow_build_without_goma, |
| 29 env=env): | 30 goma_env=env) |
| 30 if 'GOMA_DISABLED' in env: | 31 |
| 31 api.goma.remove_j_flag(command) | |
| 32 api.step('ninja', command, env=env) | |
| 33 else: | |
| 34 # build something using goma. | |
| 35 api.step('echo goma jobs', | |
| 36 ['echo', str(api.goma.recommended_goma_jobs)]) | |
| 37 api.step('echo goma jobs second', | |
| 38 ['echo', str(api.goma.recommended_goma_jobs)]) | |
| 39 api.step('ninja', command, env=env) | |
| 40 | 32 |
| 41 def GenTests(api): | 33 def GenTests(api): |
| 42 for platform in ('linux', 'win', 'mac'): | 34 for platform in ('linux', 'win', 'mac'): |
| 43 properties = { | 35 properties = { |
| 44 'buildername': 'test_builder', | 36 'buildername': 'test_builder', |
| 45 'mastername': 'test_master', | 37 'mastername': 'test_master', |
| 46 'slavename': 'test_slave', | 38 'slavename': 'test_slave', |
| 47 'clobber': '1', | 39 'clobber': '1', |
| 48 'build_command': ['ninja', '-C', 'out/Release', '-j', '500'], | 40 'build_command': ['ninja', '-j', '80', '-C', 'out/Release'], |
| 49 'ninja_log_outdir': 'out/Release', | 41 'ninja_log_outdir': 'out/Release', |
| 50 'ninja_log_compiler': 'goma', | 42 'ninja_log_compiler': 'goma', |
| 51 'build_data_dir': 'build_data_dir', | 43 'build_data_dir': 'build_data_dir', |
| 52 } | 44 } |
| 53 | 45 |
| 54 yield (api.test(platform) + api.platform.name(platform) + | 46 yield (api.test(platform) + api.platform.name(platform) + |
| 55 api.properties.generic(**properties)) | 47 api.properties.generic(**properties)) |
| 56 | 48 |
| 57 yield (api.test('%s_goma_disabled' % platform) + | 49 yield (api.test('%s_goma_disabled' % platform) + |
| 58 api.step_data('preprocess_for_goma.start_goma', retcode=1) + | 50 api.step_data('preprocess_for_goma.start_goma', retcode=1) + |
| 59 api.platform.name(platform) + | 51 api.platform.name(platform) + |
| 60 api.properties(allow_build_without_goma=True) + | 52 api.properties(allow_build_without_goma=True) + |
| 61 api.properties.generic(**properties)) | 53 api.properties.generic(**properties)) |
| OLD | NEW |