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

Side by Side Diff: scripts/slave/recipe_modules/chromium/api.py

Issue 2480193002: Stop to use contextmanager for goma.build_with_goma (Closed)
Patch Set: update Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 from recipe_engine import recipe_api 7 from recipe_engine import recipe_api
8 from recipe_engine import util as recipe_util 8 from recipe_engine import util as recipe_util
9 9
10 class TestLauncherFilterFileInputPlaceholder(recipe_util.InputPlaceholder): 10 class TestLauncherFilterFileInputPlaceholder(recipe_util.InputPlaceholder):
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 target_output_dir = self.m.path.abspath( 272 target_output_dir = self.m.path.abspath(
273 self.m.path.join(self.m.path['checkout'], out_dir, 273 self.m.path.join(self.m.path['checkout'], out_dir,
274 target or self.c.build_config_fs)) 274 target or self.c.build_config_fs))
275 275
276 command = [str(self.m.depot_tools.ninja_path), '-w', 'dupbuild=err', 276 command = [str(self.m.depot_tools.ninja_path), '-w', 'dupbuild=err',
277 '-C', target_output_dir] 277 '-C', target_output_dir]
278 278
279 if self.c.compile_py.build_args: 279 if self.c.compile_py.build_args:
280 command.extend(self.c.compile_py.build_args) 280 command.extend(self.c.compile_py.build_args)
281 281
282 if use_goma_module:
283 # Set -j just before 'with self.m.goma.build_with_goma('
284 # for ninja_log_command being set correctly if starting goma
285 # fails.
286 command += ['-j', self.m.goma.recommended_goma_jobs]
287
288 if targets is not None: 282 if targets is not None:
289 # Add build targets to command ('All', 'chrome' etc). 283 # Add build targets to command ('All', 'chrome' etc).
290 command += targets 284 command += targets
291 285
292 kwargs.pop('env', {}) 286 kwargs.pop('env', {})
293 287
294 # TODO(tikuta): Set disable_local_fallback option appropriately.
295 if use_goma_module: 288 if use_goma_module:
296 with self.m.goma.build_with_goma( 289 with self.m.goma.build_with_goma(
297 env=goma_env, 290 env=goma_env,
298 ninja_log_outdir=target_output_dir, 291 ninja_log_outdir=target_output_dir,
299 ninja_log_compiler=self.c.compile_py.compiler or 'goma', 292 ninja_log_compiler=self.c.compile_py.compiler or 'goma',
300 ninja_log_command=command, 293 ninja_log_command=command,
301 allow_build_without_goma=allow_build_without_goma): 294 allow_build_without_goma=allow_build_without_goma) as (
302 if 'GOMA_DISABLED' in goma_env: 295 env_update, ninja_command):
303 self.m.goma.remove_j_flag(command) 296 ninja_env.update(env_update)
304 ninja_env['GOMA_DISABLED'] = 'true' 297 if self.m.platform.is_win and 'GOMA_DISABLED' in env_update:
ukai 2016/11/10 02:47:02 edge case: GOMA_DISABLED=false or GOMA_DISABLED=0
tikuta 2016/11/11 08:14:55 Done.
305 if self.m.platform.is_win: 298 goma_env.update(env_update)
306 self.m.python('update windows env', 299 self.m.python('update windows env',
307 script=self.package_repo_resource( 300 script=self.package_repo_resource(
308 'scripts', 'slave', 'update_windows_env.py'), 301 'scripts', 'slave', 'update_windows_env.py'),
309 args=['--envfile-dir', str(target_output_dir)], 302 args=['--envfile-dir', str(target_output_dir)],
310 env=goma_env) 303 env=goma_env)
311 self.m.step(name or 'compile with ninja', 304 self.m.step(name or 'compile with ninja',
312 command, 305 ninja_command,
313 env=ninja_env, 306 env=ninja_env,
314 **kwargs) 307 **kwargs)
315 else: 308 else:
316 self.m.step(name or 'compile with ninja', 309 self.m.step(name or 'compile with ninja',
317 command, 310 command,
318 env=ninja_env, 311 env=ninja_env,
319 **kwargs) 312 **kwargs)
320 return 313 return
321 314
322 env = self.get_env() 315 env = self.get_env()
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 })) 904 }))
912 905
913 def get_annotate_by_test_name(self, test_name): 906 def get_annotate_by_test_name(self, test_name):
914 return 'graphing' 907 return 'graphing'
915 908
916 def download_lto_plugin(self): 909 def download_lto_plugin(self):
917 return self.m.python( 910 return self.m.python(
918 name='download LTO plugin', 911 name='download LTO plugin',
919 script=self.m.path['checkout'].join( 912 script=self.m.path['checkout'].join(
920 'build', 'download_gold_plugin.py')) 913 'build', 'download_gold_plugin.py'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698