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

Unified Diff: trunk/src/build/gyp_chromium

Issue 102923002: Revert 238454 "Hook up GN to the GYP build system." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/build/gyp_chromium
===================================================================
--- trunk/src/build/gyp_chromium (revision 238457)
+++ trunk/src/build/gyp_chromium (working copy)
@@ -21,9 +21,6 @@
sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
import gyp
-# Assume this file is in a one-level-deep subdirectory of the source root.
-SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-
# Add paths so that pymod_do_main(...) can import files.
sys.path.insert(1, os.path.join(chrome_src, 'tools', 'generate_shim_headers'))
sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit'))
@@ -54,49 +51,10 @@
else:
psyco = None
-
-def GetSupplementalFiles():
- """Returns a list of the supplemental files that are included in all GYP
- sources."""
- return glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
-
-
-def GetVarsStringForGN(supplemental_files):
- vars_dict = {}
-
- for supplement in supplemental_files:
- with open(supplement, 'r') as f:
- try:
- file_data = eval(f.read(), {'__builtins__': None}, None)
- except SyntaxError, e:
- e.filename = os.path.abspath(supplement)
- raise
- variables = file_data.get('variables')
- for v in variables:
- vars_dict[v] = '"' + variables[v] + '"'
-
- env_string = os.environ.get('GYP_DEFINES', [])
- items = shlex.split(env_string)
- for item in items:
- tokens = item.split('=', 1)
- if len(tokens) == 2:
- # Escape $ characters which have special meaning to GN.
- vars_dict[tokens[0]] = '"' + tokens[1].replace("$", "\\$") + '"'
- else:
- # No value supplied, treat it as a boolean and set it.
- vars_dict[tokens[0]] = 'true'
-
- vars_string = ''
- for v in vars_dict:
- vars_string = vars_string + v + '=' + vars_dict[v] + ' '
- return vars_string.strip() # Remove trailing space.
-
-
-def additional_include_files(supplemental_files, args=[]):
+def additional_include_files(args=[]):
"""
- Returns a list of additional (.gypi) files to include, without duplicating
- ones that are already specified on the command line. The list of supplemental
- include files is passed in as an argument.
+ Returns a list of additional (.gypi) files to include, without
+ duplicating ones that are already specified on the command line.
"""
# Determine the include files specified on the command line.
# This doesn't cover all the different option formats you can use,
@@ -116,46 +74,12 @@
AddInclude(os.path.join(script_dir, 'common.gypi'))
# Optionally add supplemental .gypi files if present.
- for supplement in supplemental_files:
+ supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
+ for supplement in supplements:
AddInclude(supplement)
return result
-
-def RunGN(supplemental_includes):
- """Runs GN, returning True if it succeeded, printing an error and returning
- false if not."""
-
- # The binaries in platform-specific subdirectories in src/tools/gn/bin.
- gnpath = SRC_DIR + '/tools/gn/bin/'
- if sys.platform == 'win32':
- gnpath += 'win/gn.exe'
- elif sys.platform.startswith('linux'):
- # On Linux we have 32-bit and 64-bit versions. Checking /sbin/init avoids
- # uname's confusion when running a 32-bit userland on a 64-bit kernel.
- if subprocess.check_output(["file", "/sbin/init"]).find("ELF 64-bit") >= 0:
- gnpath += 'linux/gn'
- else:
- gnpath += 'linux/gn32'
- elif sys.platform == 'darwin':
- gnpath += 'mac/gn'
- else:
- print 'Unknown platform for GN: ', sys.platform
- return False
-
- print 'Generating gyp files from GN...'
- gyp_vars = GetVarsStringForGN(supplemental_includes)
-
- # Need to pass both the source root (the bots don't run this command from
- # within the source tree) as well as set the is_gyp value so the BUILD files
- # to know they're being run under GYP.
- args = [gnpath, 'gyp', '-q',
- '--root=' + chrome_src,
- '--args=is_gyp=true',
- '--gyp_vars=' + gyp_vars + '']
- return subprocess.call(args) == 0
-
-
if __name__ == '__main__':
args = sys.argv[1:]
@@ -202,14 +126,8 @@
else:
args.append(os.path.join(script_dir, 'all.gyp'))
- supplemental_includes = GetSupplementalFiles()
+ args.extend(['-I' + i for i in additional_include_files(args)])
- if not RunGN(supplemental_includes):
- sys.exit(1)
-
- args.extend(
- ['-I' + i for i in additional_include_files(supplemental_includes, args)])
-
# There shouldn't be a circular dependency relationship between .gyp files,
# but in Chromium's .gyp files, on non-Mac platforms, circular relationships
# currently exist. The check for circular dependencies is currently
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698