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 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2742 dir_path = project_ref._properties['path'] | 2742 dir_path = project_ref._properties['path'] |
2743 product_group._hashables.extend(dir_path) | 2743 product_group._hashables.extend(dir_path) |
2744 | 2744 |
2745 return [product_group, project_ref] | 2745 return [product_group, project_ref] |
2746 | 2746 |
2747 def _AllSymrootsUnique(self, target, inherit_unique_symroot): | 2747 def _AllSymrootsUnique(self, target, inherit_unique_symroot): |
2748 # Returns True if all configurations have a unique 'SYMROOT' attribute. | 2748 # Returns True if all configurations have a unique 'SYMROOT' attribute. |
2749 # The value of inherit_unique_symroot decides, if a configuration is assumed | 2749 # The value of inherit_unique_symroot decides, if a configuration is assumed |
2750 # to inherit a unique 'SYMROOT' attribute from its parent, if it doesn't | 2750 # to inherit a unique 'SYMROOT' attribute from its parent, if it doesn't |
2751 # define an explicit value for 'SYMROOT'. | 2751 # define an explicit value for 'SYMROOT'. |
| 2752 symroots = self._DefinedSymroots(target) |
2752 for s in self._DefinedSymroots(target): | 2753 for s in self._DefinedSymroots(target): |
2753 if (s is not None and not self._IsUniqueSymrootForTarget(s) or | 2754 if (s is not None and not self._IsUniqueSymrootForTarget(s) or |
2754 s is None and not inherit_unique_symroot): | 2755 s is None and not inherit_unique_symroot): |
2755 return False | 2756 return False |
2756 return True | 2757 return True if symroots else return inherit_unique_symroot |
2757 | 2758 |
2758 def _DefinedSymroots(self, target): | 2759 def _DefinedSymroots(self, target): |
2759 # Returns all values for the 'SYMROOT' attribute defined in all | 2760 # Returns all values for the 'SYMROOT' attribute defined in all |
2760 # configurations for this target. If any configuration doesn't define the | 2761 # configurations for this target. If any configuration doesn't define the |
2761 # 'SYMROOT' attribute, None is added to the returned set. If all | 2762 # 'SYMROOT' attribute, None is added to the returned set. If all |
2762 # configurations don't define the 'SYMROOT' attribute, an empty set is | 2763 # configurations don't define the 'SYMROOT' attribute, an empty set is |
2763 # returned. | 2764 # returned. |
2764 config_list = target.GetProperty('buildConfigurationList') | 2765 config_list = target.GetProperty('buildConfigurationList') |
2765 symroots = set() | 2766 symroots = set() |
2766 for config in config_list.GetProperty('buildConfigurations'): | 2767 for config in config_list.GetProperty('buildConfigurations'): |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2927 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') | 2928 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') |
2928 for object in sorted(objects_by_class[class_name], | 2929 for object in sorted(objects_by_class[class_name], |
2929 cmp=lambda x, y: cmp(x.id, y.id)): | 2930 cmp=lambda x, y: cmp(x.id, y.id)): |
2930 object.Print(file) | 2931 object.Print(file) |
2931 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') | 2932 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') |
2932 | 2933 |
2933 if self._should_print_single_line: | 2934 if self._should_print_single_line: |
2934 self._XCPrint(file, 0, '}; ') | 2935 self._XCPrint(file, 0, '}; ') |
2935 else: | 2936 else: |
2936 self._XCPrint(file, 1, '};\n') | 2937 self._XCPrint(file, 1, '};\n') |
OLD | NEW |