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

Side by Side Diff: build/gyp_chromium

Issue 104803006: Revert of Re-enable GN in the GYP build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # This script is wrapper for Chromium that adds some support for how GYP 7 # This script is wrapper for Chromium that adds some support for how GYP
8 # is invoked by Chromium beyond what can be done in the gclient hooks. 8 # is invoked by Chromium beyond what can be done in the gclient hooks.
9 9
10 import glob 10 import glob
11 import gyp_helper 11 import gyp_helper
12 import os 12 import os
13 import pipes 13 import pipes
14 import shlex 14 import shlex
15 import subprocess 15 import subprocess
16 import string
17 import sys 16 import sys
18 17
19 script_dir = os.path.dirname(os.path.realpath(__file__)) 18 script_dir = os.path.dirname(os.path.realpath(__file__))
20 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 19 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
21 20
22 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) 21 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
23 import gyp 22 import gyp
24 23
25 # Assume this file is in a one-level-deep subdirectory of the source root. 24 # Assume this file is in a one-level-deep subdirectory of the source root.
26 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 25 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
(...skipping 29 matching lines...) Expand all
56 else: 55 else:
57 psyco = None 56 psyco = None
58 57
59 58
60 def GetSupplementalFiles(): 59 def GetSupplementalFiles():
61 """Returns a list of the supplemental files that are included in all GYP 60 """Returns a list of the supplemental files that are included in all GYP
62 sources.""" 61 sources."""
63 return glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) 62 return glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
64 63
65 64
66 def FormatKeyForGN(key):
67 """Returns the given GYP key reformatted for GN.
68
69 GYP dictionary keys can be almost anything, but in GN they are identifiers
70 and must follow the same rules. This reformats such keys to be valid GN
71 identifiers."""
72 return ''.join([c if c in string.ascii_letters else '_' for c in key])
73
74
75 def GetVarsStringForGN(supplemental_files): 65 def GetVarsStringForGN(supplemental_files):
76 vars_dict = {} 66 vars_dict = {}
77 67
78 for supplement in supplemental_files: 68 for supplement in supplemental_files:
79 with open(supplement, 'r') as f: 69 with open(supplement, 'r') as f:
80 try: 70 try:
81 file_data = eval(f.read(), {'__builtins__': None}, None) 71 file_data = eval(f.read(), {'__builtins__': None}, None)
82 except SyntaxError, e: 72 except SyntaxError, e:
83 e.filename = os.path.abspath(supplement) 73 e.filename = os.path.abspath(supplement)
84 raise 74 raise
85 variables = file_data.get('variables') 75 variables = file_data.get('variables')
86 for v in variables: 76 for v in variables:
87 vars_dict[v] = '"' + str(variables[v]) + '"' 77 vars_dict[v] = '"' + str(variables[v]) + '"'
88 78
89 env_string = os.environ.get('GYP_DEFINES', '') 79 env_string = os.environ.get('GYP_DEFINES', '')
90 items = shlex.split(env_string) 80 items = shlex.split(env_string)
91 for item in items: 81 for item in items:
92 tokens = item.split('=', 1) 82 tokens = item.split('=', 1)
93 # Some GYP variables have hyphens, which we don't support. 83 # Some GYP variables have hyphens, which we don't support.
94 key = FormatKeyForGN(tokens[0]) 84 key = tokens[0].replace("-", "_")
95 if len(tokens) == 2: 85 if len(tokens) == 2:
96 # Escape $ characters which have special meaning to GN. 86 # Escape $ characters which have special meaning to GN.
97 vars_dict[key] = '"' + tokens[1].replace("$", "\\$") + '"' 87 vars_dict[key] = '"' + tokens[1].replace("$", "\\$") + '"'
98 else: 88 else:
99 # No value supplied, treat it as a boolean and set it. 89 # No value supplied, treat it as a boolean and set it.
100 vars_dict[key] = 'true' 90 vars_dict[key] = 'true'
101 91
102 vars_string = '' 92 vars_string = ''
103 for v in vars_dict: 93 for v in vars_dict:
104 vars_string = vars_string + v + '=' + vars_dict[v] + ' ' 94 vars_string = vars_string + v + '=' + vars_dict[v] + ' '
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 gyp_file = os.environ.get('CHROMIUM_GYP_FILE') 199 gyp_file = os.environ.get('CHROMIUM_GYP_FILE')
210 if gyp_file: 200 if gyp_file:
211 # Note that CHROMIUM_GYP_FILE values can't have backslashes as 201 # Note that CHROMIUM_GYP_FILE values can't have backslashes as
212 # path separators even on Windows due to the use of shlex.split(). 202 # path separators even on Windows due to the use of shlex.split().
213 args.extend(shlex.split(gyp_file)) 203 args.extend(shlex.split(gyp_file))
214 else: 204 else:
215 args.append(os.path.join(script_dir, 'all.gyp')) 205 args.append(os.path.join(script_dir, 'all.gyp'))
216 206
217 supplemental_includes = GetSupplementalFiles() 207 supplemental_includes = GetSupplementalFiles()
218 208
219 if not RunGN(supplemental_includes): 209 # Temporarily disabled until it is debugged.
220 sys.exit(1) 210 # TODO(brettw) re-enable this code.
211 #if not RunGN(supplemental_includes):
Nico 2013/12/05 16:50:37 This change is enough to revert. Please undo the o
212 # sys.exit(1)
221 213
222 args.extend( 214 args.extend(
223 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) 215 ['-I' + i for i in additional_include_files(supplemental_includes, args)])
224 216
225 # There shouldn't be a circular dependency relationship between .gyp files, 217 # There shouldn't be a circular dependency relationship between .gyp files,
226 # but in Chromium's .gyp files, on non-Mac platforms, circular relationships 218 # but in Chromium's .gyp files, on non-Mac platforms, circular relationships
227 # currently exist. The check for circular dependencies is currently 219 # currently exist. The check for circular dependencies is currently
228 # bypassed on other platforms, but is left enabled on the Mac, where a 220 # bypassed on other platforms, but is left enabled on the Mac, where a
229 # violation of the rule causes Xcode to misbehave badly. 221 # violation of the rule causes Xcode to misbehave badly.
230 # TODO(mark): Find and kill remaining circular dependencies, and remove this 222 # TODO(mark): Find and kill remaining circular dependencies, and remove this
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 # to enfore syntax checking. 269 # to enfore syntax checking.
278 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') 270 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK')
279 if syntax_check and int(syntax_check): 271 if syntax_check and int(syntax_check):
280 args.append('--check') 272 args.append('--check')
281 273
282 print 'Updating projects from gyp files...' 274 print 'Updating projects from gyp files...'
283 sys.stdout.flush() 275 sys.stdout.flush()
284 276
285 # Off we go... 277 # Off we go...
286 sys.exit(gyp.main(args)) 278 sys.exit(gyp.main(args))
OLDNEW
« 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