Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: scripts/slave/recipe_modules/goma/example.py

Issue 2480193002: Stop to use contextmanager for goma.build_with_goma (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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))
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/goma/api.py ('k') | scripts/slave/recipe_modules/goma/example.expected/linux.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698