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

Side by Side Diff: build/gyp_chromium

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | build/gyp_chromium_test.py » ('j') | 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 argparse
10 import glob 11 import glob
11 import gyp_environment 12 import gyp_environment
12 import os 13 import os
13 import re 14 import re
14 import shlex 15 import shlex
15 import subprocess 16 import subprocess
16 import string 17 import string
17 import sys 18 import sys
18 import vs_toolchain 19 import vs_toolchain
19 20
20 script_dir = os.path.dirname(os.path.realpath(__file__)) 21 script_dir = os.path.dirname(os.path.realpath(__file__))
21 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 22 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
22 23
23 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) 24 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
24 import gyp 25 import gyp
25 26
26 # Assume this file is in a one-level-deep subdirectory of the source root. 27 # Assume this file is in a one-level-deep subdirectory of the source root.
27 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 28 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
28 29
29 # Add paths so that pymod_do_main(...) can import files. 30 # Add paths so that pymod_do_main(...) can import files.
31 sys.path.insert(1, os.path.join(chrome_src, 'android_webview', 'tools'))
30 sys.path.insert(1, os.path.join(chrome_src, 'build', 'android', 'gyp')) 32 sys.path.insert(1, os.path.join(chrome_src, 'build', 'android', 'gyp'))
31 sys.path.insert(1, os.path.join(chrome_src, 'tools')) 33 sys.path.insert(1, os.path.join(chrome_src, 'tools'))
32 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'generate_shim_headers')) 34 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'generate_shim_headers'))
33 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) 35 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit'))
34 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) 36 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build'))
35 sys.path.insert(1, os.path.join(chrome_src, 'chromecast', 'tools', 'build')) 37 sys.path.insert(1, os.path.join(chrome_src, 'chromecast', 'tools', 'build'))
36 sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build')) 38 sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build'))
37 sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src', 39 sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src',
38 'build_tools')) 40 'build_tools'))
39 sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build')) 41 sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build'))
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 e.filename = os.path.abspath(supplement) 119 e.filename = os.path.abspath(supplement)
118 raise 120 raise
119 variables = file_data.get('variables', []) 121 variables = file_data.get('variables', [])
120 for v in variables: 122 for v in variables:
121 supp_items += [(v, str(variables[v]))] 123 supp_items += [(v, str(variables[v]))]
122 124
123 # GYP defines from the environment. 125 # GYP defines from the environment.
124 env_items = ProcessGypDefinesItems( 126 env_items = ProcessGypDefinesItems(
125 shlex.split(os.environ.get('GYP_DEFINES', ''))) 127 shlex.split(os.environ.get('GYP_DEFINES', '')))
126 128
127 # GYP defines from the command line. We can't use optparse since we want 129 # GYP defines from the command line.
128 # to ignore all arguments other than "-D". 130 parser = argparse.ArgumentParser()
129 cmdline_input_items = [] 131 parser.add_argument('-D', dest='defines', action='append', default=[])
130 for i in range(len(sys.argv))[1:]: 132 cmdline_input_items = parser.parse_known_args()[0].defines
131 if sys.argv[i].startswith('-D'):
132 if sys.argv[i] == '-D' and i + 1 < len(sys.argv):
133 cmdline_input_items += [sys.argv[i + 1]]
134 elif len(sys.argv[i]) > 2:
135 cmdline_input_items += [sys.argv[i][2:]]
136 cmdline_items = ProcessGypDefinesItems(cmdline_input_items) 133 cmdline_items = ProcessGypDefinesItems(cmdline_input_items)
137 134
138 vars_dict = dict(supp_items + env_items + cmdline_items) 135 vars_dict = dict(supp_items + env_items + cmdline_items)
139 return vars_dict 136 return vars_dict
140 137
141 138
142 def GetOutputDirectory(): 139 def GetOutputDirectory():
143 """Returns the output directory that GYP will use.""" 140 """Returns the output directory that GYP will use."""
144 # GYP generator flags from the command line. We can't use optparse since we 141
145 # want to ignore all arguments other than "-G". 142 # Handle command line generator flags.
146 needle = '-Goutput_dir=' 143 parser = argparse.ArgumentParser()
147 cmdline_input_items = [] 144 parser.add_argument('-G', dest='genflags', default=[], action='append')
148 for item in sys.argv[1:]: 145 genflags = parser.parse_known_args()[0].genflags
146
147 # Handle generator flags from the environment.
148 genflags += shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))
149
150 needle = 'output_dir='
151 for item in genflags:
149 if item.startswith(needle): 152 if item.startswith(needle):
150 return item[len(needle):] 153 return item[len(needle):]
151 154
152 env_items = shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')) 155 return 'out'
153 needle = 'output_dir='
154 for item in env_items:
155 if item.startswith(needle):
156 return item[len(needle):]
157
158 return "out"
159 156
160 157
161 def additional_include_files(supplemental_files, args=[]): 158 def additional_include_files(supplemental_files, args=[]):
162 """ 159 """
163 Returns a list of additional (.gypi) files to include, without duplicating 160 Returns a list of additional (.gypi) files to include, without duplicating
164 ones that are already specified on the command line. The list of supplemental 161 ones that are already specified on the command line. The list of supplemental
165 include files is passed in as an argument. 162 include files is passed in as an argument.
166 """ 163 """
167 # Determine the include files specified on the command line. 164 # Determine the include files specified on the command line.
168 # This doesn't cover all the different option formats you can use, 165 # This doesn't cover all the different option formats you can use,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 323
327 if not use_analyzer: 324 if not use_analyzer:
328 vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() 325 vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
329 if vs2013_runtime_dll_dirs: 326 if vs2013_runtime_dll_dirs:
330 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs 327 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
331 vs_toolchain.CopyVsRuntimeDlls( 328 vs_toolchain.CopyVsRuntimeDlls(
332 os.path.join(chrome_src, GetOutputDirectory()), 329 os.path.join(chrome_src, GetOutputDirectory()),
333 (x86_runtime, x64_runtime)) 330 (x86_runtime, x64_runtime))
334 331
335 sys.exit(gyp_rc) 332 sys.exit(gyp_rc)
OLDNEW
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | build/gyp_chromium_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698