| 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 """Convert GN Xcode projects to platform and configuration independent targets. | 6 """Convert GN Xcode projects to platform and configuration independent targets. |
| 7 | 7 |
| 8 GN generates Xcode projects that build one configuration only. However, typical | 8 GN generates Xcode projects that build one configuration only. However, typical |
| 9 iOS development involves using the Xcode IDE to toggle the platform and | 9 iOS development involves using the Xcode IDE to toggle the platform and |
| 10 configuration. This script replaces the 'gn' configuration with 'Debug', | 10 configuration. This script replaces the 'gn' configuration with 'Debug', |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 # TODO(crbug.com/619072): gn does not write the min deployment target in the | 94 # TODO(crbug.com/619072): gn does not write the min deployment target in the |
| 95 # generated Xcode project, so add it while doing the conversion, only if it | 95 # generated Xcode project, so add it while doing the conversion, only if it |
| 96 # is not present. Remove this code and comment once the bug is fixed and gn | 96 # is not present. Remove this code and comment once the bug is fixed and gn |
| 97 # has rolled past it. | 97 # has rolled past it. |
| 98 if isa == 'XCBuildConfiguration': | 98 if isa == 'XCBuildConfiguration': |
| 99 build_settings = value['buildSettings'] | 99 build_settings = value['buildSettings'] |
| 100 if 'IPHONEOS_DEPLOYMENT_TARGET' not in build_settings: | 100 if 'IPHONEOS_DEPLOYMENT_TARGET' not in build_settings: |
| 101 build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' | 101 build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' |
| 102 | 102 |
| 103 # Remove path name key and change path to basename. | |
| 104 if isa == 'PBXFileReference': | |
| 105 if 'name' in value: | |
| 106 del value['name'] | |
| 107 value['path'] = os.path.basename(value['path']) | |
| 108 | |
| 109 # Teach build shell script to look for the configuration and platform. | 103 # Teach build shell script to look for the configuration and platform. |
| 110 if isa == 'PBXShellScriptBuildPhase': | 104 if isa == 'PBXShellScriptBuildPhase': |
| 111 value['shellScript'] = value['shellScript'].replace( | 105 value['shellScript'] = value['shellScript'].replace( |
| 112 'ninja -C .', | 106 'ninja -C .', |
| 113 'ninja -C "../${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}"') | 107 'ninja -C "../${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}"') |
| 114 | 108 |
| 115 # Configure BUNDLE_LOADER and TEST_HOST for xctest targets (if not yet | 109 # Configure BUNDLE_LOADER and TEST_HOST for xctest targets (if not yet |
| 116 # configured by gn). Old convention was to name the test dynamic module | 110 # configured by gn). Old convention was to name the test dynamic module |
| 117 # "foo" and the host "foo_host" while the new convention is to name the | 111 # "foo" and the host "foo_host" while the new convention is to name the |
| 118 # test "foo_module" and the host "foo". Decide which convention to use | 112 # test "foo_module" and the host "foo". Decide which convention to use |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 if not args.configurations: | 203 if not args.configurations: |
| 210 sys.stderr.write('At least one configuration required, see --add-config.\n') | 204 sys.stderr.write('At least one configuration required, see --add-config.\n') |
| 211 return 1 | 205 return 1 |
| 212 | 206 |
| 213 ConvertGnXcodeProject(args.input, args.output, args.configurations) | 207 ConvertGnXcodeProject(args.input, args.output, args.configurations) |
| 214 | 208 |
| 215 if __name__ == '__main__': | 209 if __name__ == '__main__': |
| 216 sys.exit(Main(sys.argv[1:])) | 210 sys.exit(Main(sys.argv[1:])) |
| 217 | 211 |
| 218 | 212 |
| OLD | NEW |