Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 cmdline_input_items += [sys.argv[i][2:]] | 135 cmdline_input_items += [sys.argv[i][2:]] |
| 136 cmdline_items = ProcessGypDefinesItems(cmdline_input_items) | 136 cmdline_items = ProcessGypDefinesItems(cmdline_input_items) |
| 137 | 137 |
| 138 vars_dict = dict(supp_items + env_items + cmdline_items) | 138 vars_dict = dict(supp_items + env_items + cmdline_items) |
| 139 return vars_dict | 139 return vars_dict |
| 140 | 140 |
| 141 | 141 |
| 142 def GetOutputDirectory(): | 142 def GetOutputDirectory(): |
| 143 """Returns the output directory that GYP will use.""" | 143 """Returns the output directory that GYP will use.""" |
| 144 # GYP generator flags from the command line. We can't use optparse since we | 144 # GYP generator flags from the command line. We can't use optparse since we |
| 145 # want to ignore all arguments other than "-G". | 145 # want to ignore all arguments other than "-G". |
|
scottmg
2015/02/03 00:21:32
I'm a little skeptical of this comment (though sin
Sam Clegg
2015/02/03 01:20:10
Done.
| |
| 146 needle = '-Goutput_dir=' | 146 flag = '-G' |
| 147 cmdline_input_items = [] | 147 found_flag = False |
| 148 needle = 'output_dir=' | |
| 148 for item in sys.argv[1:]: | 149 for item in sys.argv[1:]: |
| 149 if item.startswith(needle): | 150 if item == flag: |
| 150 return item[len(needle):] | 151 found_flag = True |
| 152 continue | |
| 153 | |
| 154 # Handle the two flag case (['-G', 'output_dir=foo']) | |
| 155 if found_flag: | |
| 156 found_flag = False | |
| 157 if item.startswith(needle): | |
| 158 return item[len(needle):] | |
| 159 continue | |
| 160 | |
| 161 # Handle the single flag case (['-Goutput_dir=foo']) | |
| 162 if item.startswith(flag): | |
| 163 item = item[len(flag):] | |
| 164 if item.startswith(needle): | |
| 165 return item[len(needle):] | |
| 151 | 166 |
| 152 env_items = shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')) | 167 env_items = shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')) |
| 153 needle = 'output_dir=' | 168 needle = 'output_dir=' |
| 154 for item in env_items: | 169 for item in env_items: |
| 155 if item.startswith(needle): | 170 if item.startswith(needle): |
| 156 return item[len(needle):] | 171 return item[len(needle):] |
| 157 | 172 |
| 158 return "out" | 173 return 'out' |
| 159 | 174 |
| 160 | 175 |
| 161 def additional_include_files(supplemental_files, args=[]): | 176 def additional_include_files(supplemental_files, args=[]): |
| 162 """ | 177 """ |
| 163 Returns a list of additional (.gypi) files to include, without duplicating | 178 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 | 179 ones that are already specified on the command line. The list of supplemental |
| 165 include files is passed in as an argument. | 180 include files is passed in as an argument. |
| 166 """ | 181 """ |
| 167 # Determine the include files specified on the command line. | 182 # Determine the include files specified on the command line. |
| 168 # This doesn't cover all the different option formats you can use, | 183 # This doesn't cover all the different option formats you can use, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 | 341 |
| 327 if not use_analyzer: | 342 if not use_analyzer: |
| 328 vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() | 343 vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() |
| 329 if vs2013_runtime_dll_dirs: | 344 if vs2013_runtime_dll_dirs: |
| 330 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs | 345 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs |
| 331 vs_toolchain.CopyVsRuntimeDlls( | 346 vs_toolchain.CopyVsRuntimeDlls( |
| 332 os.path.join(chrome_src, GetOutputDirectory()), | 347 os.path.join(chrome_src, GetOutputDirectory()), |
| 333 (x86_runtime, x64_runtime)) | 348 (x86_runtime, x64_runtime)) |
| 334 | 349 |
| 335 sys.exit(gyp_rc) | 350 sys.exit(gyp_rc) |
| OLD | NEW |