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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gn.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/build.py
diff --git a/tools/build.py b/tools/build.py
index 910be8d31855fdc9aea13cf80f5cabe74543c9f5..46f674cb0dc8afa136567242cd87047ac559a5c5 100755
--- a/tools/build.py
+++ b/tools/build.py
@@ -393,8 +393,23 @@ def NotifyBuildDone(build_config, success, start):
os.system(command)
+def RunGN(target_os, mode, arch):
+ gn_command = ['tools/gn.py',
+ '-m', mode,
+ '-a', arch,
+ '--os', target_os,
+ '-v',
+ ]
+ process = subprocess.Popen(gn_command)
+ process.wait()
+ if process.returncode != 0:
+ print ("Tried to run GN, but it failed. Try running it manually: \n\t$ " +
+ ' '.join(gn_command))
+
def BuildNinjaCommand(options, target, target_os, mode, arch):
out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os)
+ if not os.path.exists(out_dir):
+ RunGN(target_os, mode, arch)
command = ['ninja', '-C', out_dir]
if options.verbose:
command += ['-v']
@@ -471,21 +486,20 @@ def BuildOneConfig(options, target, target_os, mode, arch, override_tools):
args += [target]
- toolsOverride = None
- if override_tools:
- toolsOverride = SetTools(arch, target_os, options)
- if toolsOverride:
- for k, v in toolsOverride.iteritems():
- args.append( k + "=" + v)
- if options.verbose:
- print k + " = " + v
- if not os.path.isfile(toolsOverride['CC.target']):
- if arch == 'arm':
- print arm_cc_error
- else:
- print "Couldn't find compiler: %s" % toolsOverride['CC.target']
- return 1
-
+ toolsOverride = None
+ if override_tools:
+ toolsOverride = SetTools(arch, target_os, options)
+ if toolsOverride:
+ for k, v in toolsOverride.iteritems():
+ args.append( k + "=" + v)
+ if options.verbose:
+ print k + " = " + v
+ if not os.path.isfile(toolsOverride['CC.target']):
+ if arch == 'arm':
+ print arm_cc_error
+ else:
+ print "Couldn't find compiler: %s" % toolsOverride['CC.target']
+ return 1
print ' '.join(args)
process = None
« 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