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

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: prefer command line over env if both are specified 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..4998aaa062014f28fef49eae98f13ee2d027c203 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."""
+ # GYP generator flags from the command line. We can't use optparse since we
+ # want to ignore all arguments other than "-G".
+ needle = '-Goutput_dir='
+ cmdline_input_items = []
+ for item in sys.argv[1:]:
+ if item.startswith(needle):
+ return item[len(needle):]
+
+ env_items = shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))
+ needle = 'output_dir='
+ for item in env_items:
+ if item.startswith(needle):
+ return item[len(needle):]
+
+ return "out"
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