OLD | NEW |
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 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return vars_dict | 108 return vars_dict |
109 | 109 |
110 | 110 |
111 def GetArgsStringForGN(supplemental_files): | 111 def GetArgsStringForGN(supplemental_files): |
112 """Returns the args to pass to GN. | 112 """Returns the args to pass to GN. |
113 Based on a subset of the GYP variables that have been rewritten a bit.""" | 113 Based on a subset of the GYP variables that have been rewritten a bit.""" |
114 | 114 |
115 vars_dict = GetGypVarsForGN(supplemental_files) | 115 vars_dict = GetGypVarsForGN(supplemental_files) |
116 gn_args = '' | 116 gn_args = '' |
117 | 117 |
118 # Map "component=shared_library" to "is_component_build=true" | 118 # These tuples of (key, value, gn_arg_string) use the gn_arg_string for |
119 if "component" in vars_dict and vars_dict["component"] == "shared_library": | 119 # gn when the key is set to the given value in the GYP arguments. |
120 gn_args += ' is_component_build=true' | 120 remap_cases = [ |
| 121 ('branding', 'Chrome', 'is_chrome_branded=true'), |
| 122 ('buildtype', 'Official', 'is_official_build=true'), |
| 123 ('component', 'shared_library', 'is_component_build=true'), |
| 124 ] |
| 125 for i in remap_cases: |
| 126 if i[0] in vars_dict and vars_dict[i[0]] == i[1]: |
| 127 gn_args += ' ' + i[2] |
121 | 128 |
122 # These string arguments get passed directly. | 129 # These string arguments get passed directly. |
123 for v in ['window_sdk_path']: | 130 for v in ['windows_sdk_path']: |
124 if v in vars_dict: | 131 if v in vars_dict: |
125 gn_args += ' ' + v + '="' + EscapeStringForGN(vars_dict[v]) + '"' | 132 gn_args += ' ' + v + '="' + EscapeStringForGN(vars_dict[v]) + '"' |
126 | 133 |
127 # Set the GYP flag so BUILD files know they're being invoked in GYP mode. | 134 # Set the GYP flag so BUILD files know they're being invoked in GYP mode. |
128 gn_args += ' is_gyp=true' | 135 gn_args += ' is_gyp=true' |
129 return gn_args.strip() | 136 return gn_args.strip() |
130 | 137 |
131 | 138 |
132 def additional_include_files(supplemental_files, args=[]): | 139 def additional_include_files(supplemental_files, args=[]): |
133 """ | 140 """ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 # to enfore syntax checking. | 312 # to enfore syntax checking. |
306 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 313 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
307 if syntax_check and int(syntax_check): | 314 if syntax_check and int(syntax_check): |
308 args.append('--check') | 315 args.append('--check') |
309 | 316 |
310 print 'Updating projects from gyp files...' | 317 print 'Updating projects from gyp files...' |
311 sys.stdout.flush() | 318 sys.stdout.flush() |
312 | 319 |
313 # Off we go... | 320 # Off we go... |
314 sys.exit(gyp.main(args)) | 321 sys.exit(gyp.main(args)) |
OLD | NEW |