| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import convert_gn_xcodeproj | 7 import convert_gn_xcodeproj |
| 8 import errno | 8 import errno |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| 11 import shutil | 11 import shutil |
| 12 import subprocess | 12 import subprocess |
| 13 import sys | 13 import sys |
| 14 import tempfile | 14 import tempfile |
| 15 import ConfigParser | 15 import ConfigParser |
| 16 | 16 |
| 17 try: | 17 try: |
| 18 import cStringIO as StringIO | 18 import cStringIO as StringIO |
| 19 except ImportError: | 19 except ImportError: |
| 20 import StringIO | 20 import StringIO |
| 21 | 21 |
| 22 | 22 |
| 23 SUPPORTED_TARGETS = ('iphoneos', 'iphonesimulator') | 23 SUPPORTED_TARGETS = ('iphoneos', 'iphonesimulator') |
| 24 SUPPORTED_CONFIGS = ('Debug', 'Release', 'Profile', 'Official') | 24 SUPPORTED_CONFIGS = ('Debug', 'Release', 'Profile', 'Official', 'Coverage') |
| 25 | 25 |
| 26 | 26 |
| 27 class ConfigParserWithStringInterpolation(ConfigParser.SafeConfigParser): | 27 class ConfigParserWithStringInterpolation(ConfigParser.SafeConfigParser): |
| 28 | 28 |
| 29 '''A .ini file parser that supports strings and environment variables.''' | 29 '''A .ini file parser that supports strings and environment variables.''' |
| 30 | 30 |
| 31 ENV_VAR_PATTERN = re.compile('\$([A-Za-z0-9_]+)') | 31 ENV_VAR_PATTERN = re.compile('\$([A-Za-z0-9_]+)') |
| 32 | 32 |
| 33 def values(self, section): | 33 def values(self, section): |
| 34 return map( | 34 return map( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 is not a dictionary as the order needs to be preserved). | 83 is not a dictionary as the order needs to be preserved). |
| 84 """ | 84 """ |
| 85 args = [] | 85 args = [] |
| 86 | 86 |
| 87 if self._settings.getboolean('goma', 'enabled'): | 87 if self._settings.getboolean('goma', 'enabled'): |
| 88 args.append(('use_goma', True)) | 88 args.append(('use_goma', True)) |
| 89 goma_dir = self._settings.getstring('goma', 'install') | 89 goma_dir = self._settings.getstring('goma', 'install') |
| 90 if goma_dir: | 90 if goma_dir: |
| 91 args.append(('goma_dir', '"%s"' % os.path.expanduser(goma_dir))) | 91 args.append(('goma_dir', '"%s"' % os.path.expanduser(goma_dir))) |
| 92 | 92 |
| 93 args.append(('is_debug', self._config == 'Debug')) | 93 args.append(('is_debug', self._config in ('Debug', 'Coverage'))) |
| 94 args.append(('enable_dsyms', self._config in ('Profile', 'Official'))) | 94 args.append(('enable_dsyms', self._config in ('Profile', 'Official'))) |
| 95 args.append(('enable_stripping', 'enable_dsyms')) | 95 args.append(('enable_stripping', 'enable_dsyms')) |
| 96 args.append(('is_official_build', self._config == 'Official')) | 96 args.append(('is_official_build', self._config == 'Official')) |
| 97 args.append(('is_chrome_branded', 'is_official_build')) | 97 args.append(('is_chrome_branded', 'is_official_build')) |
| 98 args.append(('use_xcode_clang', 'is_official_build')) | 98 args.append(('use_xcode_clang', 'is_official_build')) |
| 99 args.append(('ios_enable_coverage', self._config == 'Coverage')) |
| 99 if os.environ.get('FORCE_MAC_TOOLCHAIN', '0') == '1': | 100 if os.environ.get('FORCE_MAC_TOOLCHAIN', '0') == '1': |
| 100 args.append(('use_system_xcode', False)) | 101 args.append(('use_system_xcode', False)) |
| 101 | 102 |
| 102 cpu_values = self.TARGET_CPU_VALUES[self._target] | 103 cpu_values = self.TARGET_CPU_VALUES[self._target] |
| 103 build_arch = self._settings.getstring('build', 'arch') | 104 build_arch = self._settings.getstring('build', 'arch') |
| 104 if build_arch == 'fat': | 105 if build_arch == 'fat': |
| 105 target_cpu = cpu_values[self.FAT_BUILD_DEFAULT_ARCH] | 106 target_cpu = cpu_values[self.FAT_BUILD_DEFAULT_ARCH] |
| 106 args.append(('target_cpu', target_cpu)) | 107 args.append(('target_cpu', target_cpu)) |
| 107 args.append(('additional_target_cpus', | 108 args.append(('additional_target_cpus', |
| 108 [cpu for cpu in cpu_values.itervalues() if cpu != target_cpu])) | 109 [cpu for cpu in cpu_values.itervalues() if cpu != target_cpu])) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 out_dir = os.path.join(args.root, 'out') | 340 out_dir = os.path.join(args.root, 'out') |
| 340 if not os.path.isdir(out_dir): | 341 if not os.path.isdir(out_dir): |
| 341 os.makedirs(out_dir) | 342 os.makedirs(out_dir) |
| 342 | 343 |
| 343 GenerateXcodeProject(gn_path, args.root, out_dir, settings) | 344 GenerateXcodeProject(gn_path, args.root, out_dir, settings) |
| 344 GenerateGnBuildRules(gn_path, args.root, out_dir, settings) | 345 GenerateGnBuildRules(gn_path, args.root, out_dir, settings) |
| 345 | 346 |
| 346 | 347 |
| 347 if __name__ == '__main__': | 348 if __name__ == '__main__': |
| 348 sys.exit(Main(sys.argv[1:])) | 349 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |