OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import filecmp | 5 import filecmp |
6 import gyp.common | 6 import gyp.common |
7 import gyp.xcodeproj_file | 7 import gyp.xcodeproj_file |
8 import gyp.xcode_ninja | 8 import gyp.xcode_ninja |
9 import errno | 9 import errno |
10 import os | 10 import os |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 ninja_wrapper = params.get('flavor') == 'ninja' | 583 ninja_wrapper = params.get('flavor') == 'ninja' |
584 if ninja_wrapper: | 584 if ninja_wrapper: |
585 (target_list, target_dicts, data) = \ | 585 (target_list, target_dicts, data) = \ |
586 gyp.xcode_ninja.CreateWrapper(target_list, target_dicts, data, params) | 586 gyp.xcode_ninja.CreateWrapper(target_list, target_dicts, data, params) |
587 | 587 |
588 options = params['options'] | 588 options = params['options'] |
589 generator_flags = params.get('generator_flags', {}) | 589 generator_flags = params.get('generator_flags', {}) |
590 parallel_builds = generator_flags.get('xcode_parallel_builds', True) | 590 parallel_builds = generator_flags.get('xcode_parallel_builds', True) |
591 serialize_all_tests = \ | 591 serialize_all_tests = \ |
592 generator_flags.get('xcode_serialize_all_test_runs', True) | 592 generator_flags.get('xcode_serialize_all_test_runs', True) |
| 593 upgrade_check_project_version = \ |
| 594 generator_flags.get('xcode_upgrade_check_project_version', None) |
| 595 |
| 596 # Format upgrade_check_project_version with leading zeros as needed. |
| 597 if upgrade_check_project_version: |
| 598 upgrade_check_project_version = str(upgrade_check_project_version) |
| 599 while len(upgrade_check_project_version) < 4: |
| 600 upgrade_check_project_version = '0' + upgrade_check_project_version |
| 601 |
593 skip_excluded_files = \ | 602 skip_excluded_files = \ |
594 not generator_flags.get('xcode_list_excluded_files', True) | 603 not generator_flags.get('xcode_list_excluded_files', True) |
595 xcode_projects = {} | 604 xcode_projects = {} |
596 for build_file, build_file_dict in data.iteritems(): | 605 for build_file, build_file_dict in data.iteritems(): |
597 (build_file_root, build_file_ext) = os.path.splitext(build_file) | 606 (build_file_root, build_file_ext) = os.path.splitext(build_file) |
598 if build_file_ext != '.gyp': | 607 if build_file_ext != '.gyp': |
599 continue | 608 continue |
600 xcodeproj_path = build_file_root + options.suffix + '.xcodeproj' | 609 xcodeproj_path = build_file_root + options.suffix + '.xcodeproj' |
601 if options.generator_output: | 610 if options.generator_output: |
602 xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) | 611 xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) |
603 xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict) | 612 xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict) |
604 xcode_projects[build_file] = xcp | 613 xcode_projects[build_file] = xcp |
605 pbxp = xcp.project | 614 pbxp = xcp.project |
606 | 615 |
| 616 # Set project-level attributes from multiple options |
| 617 project_attributes = {}; |
607 if parallel_builds: | 618 if parallel_builds: |
608 pbxp.SetProperty('attributes', | 619 project_attributes['BuildIndependentTargetsInParallel'] = 'YES' |
609 {'BuildIndependentTargetsInParallel': 'YES'}) | 620 if upgrade_check_project_version: |
| 621 project_attributes['LastUpgradeCheck'] = upgrade_check_project_version |
| 622 project_attributes['LastTestingUpgradeCheck'] = \ |
| 623 upgrade_check_project_version |
| 624 project_attributes['LastSwiftUpdateCheck'] = \ |
| 625 upgrade_check_project_version |
| 626 pbxp.SetProperty('attributes', project_attributes) |
610 | 627 |
611 # Add gyp/gypi files to project | 628 # Add gyp/gypi files to project |
612 if not generator_flags.get('standalone'): | 629 if not generator_flags.get('standalone'): |
613 main_group = pbxp.GetProperty('mainGroup') | 630 main_group = pbxp.GetProperty('mainGroup') |
614 build_group = gyp.xcodeproj_file.PBXGroup({'name': 'Build'}) | 631 build_group = gyp.xcodeproj_file.PBXGroup({'name': 'Build'}) |
615 main_group.AppendChild(build_group) | 632 main_group.AppendChild(build_group) |
616 for included_file in build_file_dict['included_files']: | 633 for included_file in build_file_dict['included_files']: |
617 build_group.AddOrGetFileByPath(included_file, False) | 634 build_group.AddOrGetFileByPath(included_file, False) |
618 | 635 |
619 xcode_targets = {} | 636 xcode_targets = {} |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 | 1269 |
1253 for build_file in build_files: | 1270 for build_file in build_files: |
1254 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) | 1271 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) |
1255 | 1272 |
1256 for build_file in build_files: | 1273 for build_file in build_files: |
1257 xcode_projects[build_file].Finalize2(xcode_targets, | 1274 xcode_projects[build_file].Finalize2(xcode_targets, |
1258 xcode_target_to_target_dict) | 1275 xcode_target_to_target_dict) |
1259 | 1276 |
1260 for build_file in build_files: | 1277 for build_file in build_files: |
1261 xcode_projects[build_file].Write() | 1278 xcode_projects[build_file].Write() |
OLD | NEW |