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

Side by Side Diff: tools/build.py

Issue 2397623003: Run GN from build.py if the output directory doesn't exist (Closed)
Patch Set: Created 4 years, 2 months 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
« no previous file with comments | « no previous file | tools/gn.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import re 10 import re
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 "$n.showballoontip(%d, '%s', '%s', " 386 "$n.showballoontip(%d, '%s', '%s', "
387 "[system.windows.forms.tooltipicon]::%s);\"") % ( 387 "[system.windows.forms.tooltipicon]::%s);\"") % (
388 5000, # Notification stays on for this many milliseconds 388 5000, # Notification stays on for this many milliseconds
389 message, title, icon) 389 message, title, icon)
390 390
391 if command: 391 if command:
392 # Ignore return code, if this command fails, it doesn't matter. 392 # Ignore return code, if this command fails, it doesn't matter.
393 os.system(command) 393 os.system(command)
394 394
395 395
396 def RunGN(target_os, mode, arch):
397 gn_command = ['tools/gn.py',
398 '-m', mode,
399 '-a', arch,
400 '--os', target_os,
401 '-v',
402 ]
403 process = subprocess.Popen(gn_command)
404 process.wait()
405 if process.returncode != 0:
406 print ("Tried to run GN, but it failed. Try running it manually: \n\t$ " +
407 ' '.join(gn_command))
408
396 def BuildNinjaCommand(options, target, target_os, mode, arch): 409 def BuildNinjaCommand(options, target, target_os, mode, arch):
397 out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os) 410 out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os)
411 if not os.path.exists(out_dir):
412 RunGN(target_os, mode, arch)
398 command = ['ninja', '-C', out_dir] 413 command = ['ninja', '-C', out_dir]
399 if options.verbose: 414 if options.verbose:
400 command += ['-v'] 415 command += ['-v']
401 command += [target] 416 command += [target]
402 return command 417 return command
403 418
404 419
405 filter_xcodebuild_output = False 420 filter_xcodebuild_output = False
406 def BuildOneConfig(options, target, target_os, mode, arch, override_tools): 421 def BuildOneConfig(options, target, target_os, mode, arch, override_tools):
407 global filter_xcodebuild_output 422 global filter_xcodebuild_output
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 options.j, 479 options.j,
465 'BUILDTYPE=' + build_config, 480 'BUILDTYPE=' + build_config,
466 ] 481 ]
467 if target_os != HOST_OS: 482 if target_os != HOST_OS:
468 args += ['builddir_name=' + utils.GetBuildDir(HOST_OS)] 483 args += ['builddir_name=' + utils.GetBuildDir(HOST_OS)]
469 if options.verbose: 484 if options.verbose:
470 args += ['V=1'] 485 args += ['V=1']
471 486
472 args += [target] 487 args += [target]
473 488
474 toolsOverride = None 489 toolsOverride = None
475 if override_tools: 490 if override_tools:
476 toolsOverride = SetTools(arch, target_os, options) 491 toolsOverride = SetTools(arch, target_os, options)
477 if toolsOverride: 492 if toolsOverride:
478 for k, v in toolsOverride.iteritems(): 493 for k, v in toolsOverride.iteritems():
479 args.append( k + "=" + v) 494 args.append( k + "=" + v)
480 if options.verbose: 495 if options.verbose:
481 print k + " = " + v 496 print k + " = " + v
482 if not os.path.isfile(toolsOverride['CC.target']): 497 if not os.path.isfile(toolsOverride['CC.target']):
483 if arch == 'arm': 498 if arch == 'arm':
484 print arm_cc_error 499 print arm_cc_error
485 else: 500 else:
486 print "Couldn't find compiler: %s" % toolsOverride['CC.target'] 501 print "Couldn't find compiler: %s" % toolsOverride['CC.target']
487 return 1 502 return 1
488
489 503
490 print ' '.join(args) 504 print ' '.join(args)
491 process = None 505 process = None
492 if filter_xcodebuild_output: 506 if filter_xcodebuild_output:
493 process = subprocess.Popen(args, 507 process = subprocess.Popen(args,
494 stdin=None, 508 stdin=None,
495 bufsize=1, # Line buffered. 509 bufsize=1, # Line buffered.
496 stdout=subprocess.PIPE, 510 stdout=subprocess.PIPE,
497 stderr=subprocess.STDOUT) 511 stderr=subprocess.STDOUT)
498 FilterEmptyXcodebuildSections(process) 512 FilterEmptyXcodebuildSections(process)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 else: 586 else:
573 if BuildOneConfig(options, target, target_os, 587 if BuildOneConfig(options, target, target_os,
574 mode, arch, cross_build) != 0: 588 mode, arch, cross_build) != 0:
575 return 1 589 return 1
576 590
577 return 0 591 return 0
578 592
579 593
580 if __name__ == '__main__': 594 if __name__ == '__main__':
581 sys.exit(Main()) 595 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | tools/gn.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698