| 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 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 'name': [0, str, 0, 1], | 1549 'name': [0, str, 0, 1], |
| 1550 }) | 1550 }) |
| 1551 | 1551 |
| 1552 def HasBuildSetting(self, key): | 1552 def HasBuildSetting(self, key): |
| 1553 return key in self._properties['buildSettings'] | 1553 return key in self._properties['buildSettings'] |
| 1554 | 1554 |
| 1555 def GetBuildSetting(self, key): | 1555 def GetBuildSetting(self, key): |
| 1556 return self._properties['buildSettings'][key] | 1556 return self._properties['buildSettings'][key] |
| 1557 | 1557 |
| 1558 def SetBuildSetting(self, key, value): | 1558 def SetBuildSetting(self, key, value): |
| 1559 # TODO(mark): If a list, copy? | 1559 if hasattr(value, '__iter__'): |
| 1560 self._properties['buildSettings'][key] = value | 1560 self._properties['buildSettings'].setdefault(key, []).extend(value) |
| 1561 else: |
| 1562 self._properties['buildSettings'][key] = value |
| 1561 | 1563 |
| 1562 def AppendBuildSetting(self, key, value): | 1564 def AppendBuildSetting(self, key, value): |
| 1563 if not key in self._properties['buildSettings']: | 1565 self._properties['buildSettings'].setdefault(key, []).append(value) |
| 1564 self._properties['buildSettings'][key] = [] | |
| 1565 self._properties['buildSettings'][key].append(value) | |
| 1566 | 1566 |
| 1567 def DelBuildSetting(self, key): | 1567 def DelBuildSetting(self, key): |
| 1568 if key in self._properties['buildSettings']: | 1568 if key in self._properties['buildSettings']: |
| 1569 del self._properties['buildSettings'][key] | 1569 del self._properties['buildSettings'][key] |
| 1570 | 1570 |
| 1571 def SetBaseConfiguration(self, value): | 1571 def SetBaseConfiguration(self, value): |
| 1572 self._properties['baseConfigurationReference'] = value | 1572 self._properties['baseConfigurationReference'] = value |
| 1573 | 1573 |
| 1574 class XCConfigurationList(XCObject): | 1574 class XCConfigurationList(XCObject): |
| 1575 # _configs is the default list of configurations. | 1575 # _configs is the default list of configurations. |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2860 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') | 2860 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') |
| 2861 for object in sorted(objects_by_class[class_name], | 2861 for object in sorted(objects_by_class[class_name], |
| 2862 cmp=lambda x, y: cmp(x.id, y.id)): | 2862 cmp=lambda x, y: cmp(x.id, y.id)): |
| 2863 object.Print(file) | 2863 object.Print(file) |
| 2864 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') | 2864 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') |
| 2865 | 2865 |
| 2866 if self._should_print_single_line: | 2866 if self._should_print_single_line: |
| 2867 self._XCPrint(file, 0, '}; ') | 2867 self._XCPrint(file, 0, '}; ') |
| 2868 else: | 2868 else: |
| 2869 self._XCPrint(file, 1, '};\n') | 2869 self._XCPrint(file, 1, '};\n') |
| OLD | NEW |