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

Unified Diff: build/gyp_chromium

Issue 142223002: Support -Goutput_dir=blahblah in GN-GYP hybrid mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix up GYP_GENERATOR_FLAGS parsing Created 6 years, 11 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 | « build/config/BUILDCONFIG.gn ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/gyp_chromium
diff --git a/build/gyp_chromium b/build/gyp_chromium
index f8fa93664642b73b23e673a31e8225c235e0dc1d..cca3add31c8dd5b89430af6d054b5b2cbdb53aa4 100755
--- a/build/gyp_chromium
+++ b/build/gyp_chromium
@@ -127,6 +127,23 @@ def GetGypVarsForGN(supplemental_files):
return dict(supp_items + env_items + cmdline_items)
+def GetOutputDirectory():
+ """Returns the output directory that GYP will use."""
+ env_items = shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))
+ for i in range(len(env_items)):
piman 2014/01/18 00:44:27 nit: 'for item in env_items' is simpler
+ print env_items[i]
piman 2014/01/18 00:44:27 hi
+ if env_items[i].startswith('output_dir='):
+ print "yay %s %s" % (env_items[i], env_items[i][12:])
piman 2014/01/18 00:44:27 yay!
+ return env_items[i][11:]
+
+ # GYP generator flags from the command line. We can't use optparse since we
+ # want to ignore all arguments other than "-G".
+ cmdline_input_items = []
+ for i in range(len(sys.argv))[1:]:
piman 2014/01/18 00:44:27 for arg in sys.argv[1:]
+ if sys.argv[i].startswith('-Goutput_dir='):
+ return sys.argv[i][13:]
Nico 2014/01/18 00:38:44 s/13/len('-Goutput_dir=')/
piman 2014/01/18 00:44:27 arg.split("=")[2] ?
Nico 2014/01/18 00:46:52 arg.split("=")[1] ?
+
+ return "out_foo"
Nico 2014/01/18 00:38:44 _foo?
def GetArgsStringForGN(supplemental_files):
"""Returns the args to pass to GN.
@@ -224,6 +241,10 @@ def GetArgsStringForGN(supplemental_files):
# Set the GYP flag so BUILD files know they're being invoked in GYP mode.
gn_args += ' is_gyp=true'
+
+ gyp_outdir = GetOutputDirectory()
+ gn_args += ' gyp_output_dir=\"%s\"' % gyp_outdir
+
return gn_args.strip()
@@ -284,7 +305,8 @@ def RunGN(supplemental_includes):
# to know they're being run under GYP.
args = [gnpath, 'gyp', '-q',
'--root=' + chrome_src,
- '--args=' + GetArgsStringForGN(supplemental_includes)]
+ '--args=' + GetArgsStringForGN(supplemental_includes),
+ '--output=//' + GetOutputDirectory() + '/gn_build/']
return subprocess.call(args) == 0
@@ -397,6 +419,8 @@ if __name__ == '__main__':
args.extend(
['-I' + i for i in additional_include_files(supplemental_includes, args)])
+ args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()])
+
print 'Updating projects from gyp files...'
sys.stdout.flush()
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698