| 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 """Xcode project file generator. | 5 """Xcode project file generator. |
| 6 | 6 |
| 7 This module is both an Xcode project file generator and a documentation of the | 7 This module is both an Xcode project file generator and a documentation of the |
| 8 Xcode project file format. Knowledge of the project file format was gained | 8 Xcode project file format. Knowledge of the project file format was gained |
| 9 based on extensive experience with Xcode, and by making changes to projects in | 9 based on extensive experience with Xcode, and by making changes to projects in |
| 10 Xcode.app and observing the resultant changes in the associated project files. | 10 Xcode.app and observing the resultant changes in the associated project files. |
| (...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2801 continue | 2801 continue |
| 2802 remote_products.append(target._properties['productReference']) | 2802 remote_products.append(target._properties['productReference']) |
| 2803 | 2803 |
| 2804 # Sort the PBXReferenceProxy children according to the list of remote | 2804 # Sort the PBXReferenceProxy children according to the list of remote |
| 2805 # products. | 2805 # products. |
| 2806 product_group = ref_dict['ProductGroup'] | 2806 product_group = ref_dict['ProductGroup'] |
| 2807 product_group._properties['children'] = sorted( | 2807 product_group._properties['children'] = sorted( |
| 2808 product_group._properties['children'], | 2808 product_group._properties['children'], |
| 2809 cmp=lambda x, y, rp=remote_products: CompareProducts(x, y, rp)) | 2809 cmp=lambda x, y, rp=remote_products: CompareProducts(x, y, rp)) |
| 2810 | 2810 |
| 2811 def Hashables(self): |
| 2812 # super |
| 2813 hashables = XCObject.Hashables(self) |
| 2814 |
| 2815 # Projects (.xcodeproj) files with identical names defining products with |
| 2816 # identical names cause a false positive hash ID collision. We add the |
| 2817 # project file's path to the hashables to avoid this. |
| 2818 hashables.extend([self._properties['projectRoot']]) |
| 2819 return hashables |
| 2820 |
| 2811 | 2821 |
| 2812 class XCProjectFile(XCObject): | 2822 class XCProjectFile(XCObject): |
| 2813 _schema = XCObject._schema.copy() | 2823 _schema = XCObject._schema.copy() |
| 2814 _schema.update({ | 2824 _schema.update({ |
| 2815 'archiveVersion': [0, int, 0, 1, 1], | 2825 'archiveVersion': [0, int, 0, 1, 1], |
| 2816 'classes': [0, dict, 0, 1, {}], | 2826 'classes': [0, dict, 0, 1, {}], |
| 2817 'objectVersion': [0, int, 0, 1, 45], | 2827 'objectVersion': [0, int, 0, 1, 45], |
| 2818 'rootObject': [0, PBXProject, 1, 1], | 2828 'rootObject': [0, PBXProject, 1, 1], |
| 2819 }) | 2829 }) |
| 2820 | 2830 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2883 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') | 2893 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') |
| 2884 for object in sorted(objects_by_class[class_name], | 2894 for object in sorted(objects_by_class[class_name], |
| 2885 cmp=lambda x, y: cmp(x.id, y.id)): | 2895 cmp=lambda x, y: cmp(x.id, y.id)): |
| 2886 object.Print(file) | 2896 object.Print(file) |
| 2887 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') | 2897 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') |
| 2888 | 2898 |
| 2889 if self._should_print_single_line: | 2899 if self._should_print_single_line: |
| 2890 self._XCPrint(file, 0, '}; ') | 2900 self._XCPrint(file, 0, '}; ') |
| 2891 else: | 2901 else: |
| 2892 self._XCPrint(file, 1, '};\n') | 2902 self._XCPrint(file, 1, '};\n') |
| OLD | NEW |