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

Side by Side Diff: webrtc/build/gyp_webrtc.py

Issue 2380533002: Roll chromium_revision f86fb54ec3..dd442d4812 (420104:421425) (Closed)
Patch Set: Fixed PyLint complaints Created 4 years, 2 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 | « webrtc/build/chromium_common.gypi ('k') | 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) 2014 The WebRTC project authors. All Rights Reserved. 3 # Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license 5 # Use of this source code is governed by a BSD-style license
6 # that can be found in the LICENSE file in the root of the source 6 # that can be found in the LICENSE file in the root of the source
7 # tree. An additional intellectual property rights grant can be found 7 # tree. An additional intellectual property rights grant can be found
8 # in the file PATENTS. All contributing project authors may 8 # in the file PATENTS. All contributing project authors may
9 # be found in the AUTHORS file in the root of the source tree. 9 # be found in the AUTHORS file in the root of the source tree.
10 10
11 # This script is used to run GYP for WebRTC. It contains selected parts of the 11 # This script is used to run GYP for WebRTC. It contains selected parts of the
12 # main function from the src/build/gyp_chromium.py file while other parts are 12 # main function from the src/build/gyp_chromium.py file while other parts are
13 # reused to minimize code duplication. 13 # reused to minimize code duplication.
14 14
15 import argparse
15 import gc 16 import gc
16 import glob 17 import glob
17 import os 18 import os
19 import shlex
18 import sys 20 import sys
19 21
20 script_dir = os.path.dirname(os.path.realpath(__file__)) 22 script_dir = os.path.dirname(os.path.realpath(__file__))
21 checkout_root = os.path.abspath(os.path.join(script_dir, os.pardir, os.pardir)) 23 checkout_root = os.path.abspath(os.path.join(script_dir, os.pardir, os.pardir))
22 24
23 sys.path.insert(0, os.path.join(checkout_root, 'build')) 25 sys.path.insert(0, os.path.join(checkout_root, 'build'))
24 import gyp_chromium 26 import gyp_chromium
25 import gyp_helper 27 import gyp_helper
26 import vs_toolchain 28 import vs_toolchain
27 29
28 sys.path.insert(0, os.path.join(checkout_root, 'tools', 'gyp', 'pylib')) 30 sys.path.insert(0, os.path.join(checkout_root, 'tools', 'gyp', 'pylib'))
29 import gyp 31 import gyp
30 32
31 33
32 def GetSupplementalFiles(): 34 def GetSupplementalFiles():
33 """Returns a list of the supplemental files. 35 """Returns a list of the supplemental files.
34 36
35 A supplemental file is included in all GYP sources. Such files can be used to 37 A supplemental file is included in all GYP sources. Such files can be used to
36 override default values. 38 override default values.
37 """ 39 """
38 # Can't use the one in gyp_chromium since the directory location of the root 40 # Can't use the one in gyp_chromium since the directory location of the root
39 # is different. 41 # is different.
40 return glob.glob(os.path.join(checkout_root, '*', 'supplement.gypi')) 42 return glob.glob(os.path.join(checkout_root, '*', 'supplement.gypi'))
41 43
42 44
45 def GetOutputDirectory():
46 """Returns the output directory that GYP will use."""
47
48 # Handle command line generator flags.
49 parser = argparse.ArgumentParser()
50 parser.add_argument('-G', dest='genflags', default=[], action='append')
51 genflags = parser.parse_known_args()[0].genflags
52
53 # Handle generator flags from the environment.
54 genflags += shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))
55
56 needle = 'output_dir='
57 for item in genflags:
58 if item.startswith(needle):
59 return item[len(needle):]
60
61 return 'out'
62
63
64 def additional_include_files(supplemental_files, args=None):
65 """
66 Returns a list of additional (.gypi) files to include, without duplicating
67 ones that are already specified on the command line. The list of supplemental
68 include files is passed in as an argument.
69 """
70 # Determine the include files specified on the command line.
71 # This doesn't cover all the different option formats you can use,
72 # but it's mainly intended to avoid duplicating flags on the automatic
73 # makefile regeneration which only uses this format.
74 specified_includes = set()
75 args = args or []
76 for arg in args:
77 if arg.startswith('-I') and len(arg) > 2:
78 specified_includes.add(os.path.realpath(arg[2:]))
79 result = []
80 def AddInclude(path):
81 if os.path.realpath(path) not in specified_includes:
82 result.append(path)
83 if os.environ.get('GYP_INCLUDE_FIRST') != None:
84 AddInclude(os.path.join(checkout_root, os.environ.get('GYP_INCLUDE_FIRST')))
85 # Always include Chromium's common.gypi, which we now have a copy of.
86 AddInclude(os.path.join(script_dir, 'chromium_common.gypi'))
87 # Optionally add supplemental .gypi files if present.
88 for supplement in supplemental_files:
89 AddInclude(supplement)
90 if os.environ.get('GYP_INCLUDE_LAST') != None:
91 AddInclude(os.path.join(checkout_root, os.environ.get('GYP_INCLUDE_LAST')))
92 return result
93
94
43 def main(): 95 def main():
44 # Disabling garbage collection saves about 5% processing time. Since this is a 96 # Disabling garbage collection saves about 5% processing time. Since this is a
45 # short-lived process it's not a problem. 97 # short-lived process it's not a problem.
46 gc.disable() 98 gc.disable()
47 99
48 args = sys.argv[1:] 100 args = sys.argv[1:]
49 101
50 if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)): 102 if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)):
51 print 'Skipping gyp_webrtc.py due to GYP_CHROMIUM_NO_ACTION env var.' 103 print 'Skipping gyp_webrtc.py due to GYP_CHROMIUM_NO_ACTION env var.'
52 sys.exit(0) 104 sys.exit(0)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 147
96 supplemental_includes = GetSupplementalFiles() 148 supplemental_includes = GetSupplementalFiles()
97 gyp_vars = gyp_chromium.GetGypVars(supplemental_includes) 149 gyp_vars = gyp_chromium.GetGypVars(supplemental_includes)
98 150
99 # Automatically turn on crosscompile support for platforms that need it. 151 # Automatically turn on crosscompile support for platforms that need it.
100 if all(('ninja' in os.environ.get('GYP_GENERATORS', ''), 152 if all(('ninja' in os.environ.get('GYP_GENERATORS', ''),
101 gyp_vars.get('OS') in ['android', 'ios'], 153 gyp_vars.get('OS') in ['android', 'ios'],
102 'GYP_CROSSCOMPILE' not in os.environ)): 154 'GYP_CROSSCOMPILE' not in os.environ)):
103 os.environ['GYP_CROSSCOMPILE'] = '1' 155 os.environ['GYP_CROSSCOMPILE'] = '1'
104 156
105 args.extend(['-I' + i for i in 157 args.extend(['-I' + i for i in additional_include_files(supplemental_includes,
106 gyp_chromium.additional_include_files(supplemental_includes, 158 args)])
107 args)])
108 159
109 # Set the gyp depth variable to the root of the checkout. 160 # Set the gyp depth variable to the root of the checkout.
110 args.append('--depth=' + os.path.relpath(checkout_root)) 161 args.append('--depth=' + os.path.relpath(checkout_root))
111 162
112 print 'Updating projects from gyp files...' 163 print 'Updating projects from gyp files...'
113 sys.stdout.flush() 164 sys.stdout.flush()
114 165
115 # Off we go... 166 # Off we go...
116 gyp_rc = gyp.main(args) 167 gyp_rc = gyp.main(args)
117 168
118 if vs2013_runtime_dll_dirs: 169 if vs2013_runtime_dll_dirs:
119 # pylint: disable=unpacking-non-sequence 170 # pylint: disable=unpacking-non-sequence
120 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs 171 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
121 vs_toolchain.CopyVsRuntimeDlls( 172 vs_toolchain.CopyVsRuntimeDlls(
122 os.path.join(checkout_root, gyp_chromium.GetOutputDirectory()), 173 os.path.join(checkout_root, GetOutputDirectory()),
123 (x86_runtime, x64_runtime)) 174 (x86_runtime, x64_runtime))
124 175
125 sys.exit(gyp_rc) 176 sys.exit(gyp_rc)
126 177
127 178
128 if __name__ == '__main__': 179 if __name__ == '__main__':
129 sys.exit(main()) 180 sys.exit(main())
130 181
OLDNEW
« no previous file with comments | « webrtc/build/chromium_common.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698