| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2009 Google Inc. All rights reserved. | 3 # Copyright (c) 2009 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Xcode project file generator. | 7 """Xcode project file generator. |
| 8 | 8 |
| 9 This module is both an Xcode project file generator and a documentation of the | 9 This module is both an Xcode project file generator and a documentation of the |
| 10 Xcode project file format. Knowledge of the project file format was gained | 10 Xcode project file format. Knowledge of the project file format was gained |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 'dylib': 'compiled.mach-o.dylib', | 1444 'dylib': 'compiled.mach-o.dylib', |
| 1445 'framework': 'wrapper.framework', | 1445 'framework': 'wrapper.framework', |
| 1446 'h': 'sourcecode.c.h', | 1446 'h': 'sourcecode.c.h', |
| 1447 'hxx': 'sourcecode.cpp.h', | 1447 'hxx': 'sourcecode.cpp.h', |
| 1448 'icns': 'image.icns', | 1448 'icns': 'image.icns', |
| 1449 'java': 'sourcecode.java', | 1449 'java': 'sourcecode.java', |
| 1450 'js': 'sourcecode.javascript', | 1450 'js': 'sourcecode.javascript', |
| 1451 'm': 'sourcecode.c.objc', | 1451 'm': 'sourcecode.c.objc', |
| 1452 'mm': 'sourcecode.cpp.objcpp', | 1452 'mm': 'sourcecode.cpp.objcpp', |
| 1453 'nib': 'wrapper.nib', | 1453 'nib': 'wrapper.nib', |
| 1454 'o': 'compiled.mach-o.objfile', |
| 1454 'pdf': 'image.pdf', | 1455 'pdf': 'image.pdf', |
| 1455 'pl': 'text.script.perl', | 1456 'pl': 'text.script.perl', |
| 1456 'plist': 'text.plist.xml', | 1457 'plist': 'text.plist.xml', |
| 1457 'pm': 'text.script.perl', | 1458 'pm': 'text.script.perl', |
| 1458 'png': 'image.png', | 1459 'png': 'image.png', |
| 1459 'py': 'text.script.python', | 1460 'py': 'text.script.python', |
| 1460 'r': 'sourcecode.rez', | 1461 'r': 'sourcecode.rez', |
| 1461 'rez': 'sourcecode.rez', | 1462 'rez': 'sourcecode.rez', |
| 1462 's': 'sourcecode.asm', | 1463 's': 'sourcecode.asm', |
| 1463 'strings': 'text.plist.strings', | 1464 'strings': 'text.plist.strings', |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 return self.PBXProjectAncestor().RootGroupForPath(path) | 1831 return self.PBXProjectAncestor().RootGroupForPath(path) |
| 1831 | 1832 |
| 1832 | 1833 |
| 1833 class PBXFrameworksBuildPhase(XCBuildPhase): | 1834 class PBXFrameworksBuildPhase(XCBuildPhase): |
| 1834 # No additions to the schema relative to XCBuildPhase. | 1835 # No additions to the schema relative to XCBuildPhase. |
| 1835 | 1836 |
| 1836 def Name(self): | 1837 def Name(self): |
| 1837 return 'Frameworks' | 1838 return 'Frameworks' |
| 1838 | 1839 |
| 1839 def FileGroup(self, path): | 1840 def FileGroup(self, path): |
| 1840 return (self.PBXProjectAncestor().FrameworksGroup(), False) | 1841 (root, ext) = posixpath.splitext(path) |
| 1842 if ext != '': |
| 1843 ext = ext[1:].lower() |
| 1844 if ext == 'o': |
| 1845 # .o files are added to Xcode Frameworks phases, but conceptually aren't |
| 1846 # frameworks, they're more like sources or intermediates. Redirect them |
| 1847 # to show up in one of those other groups. |
| 1848 return self.PBXProjectAncestor().RootGroupForPath(path) |
| 1849 else: |
| 1850 return (self.PBXProjectAncestor().FrameworksGroup(), False) |
| 1841 | 1851 |
| 1842 | 1852 |
| 1843 class PBXShellScriptBuildPhase(XCBuildPhase): | 1853 class PBXShellScriptBuildPhase(XCBuildPhase): |
| 1844 _schema = XCBuildPhase._schema.copy() | 1854 _schema = XCBuildPhase._schema.copy() |
| 1845 _schema.update({ | 1855 _schema.update({ |
| 1846 'inputPaths': [1, str, 0, 1, []], | 1856 'inputPaths': [1, str, 0, 1, []], |
| 1847 'name': [0, str, 0, 0], | 1857 'name': [0, str, 0, 0], |
| 1848 'outputPaths': [1, str, 0, 1, []], | 1858 'outputPaths': [1, str, 0, 1, []], |
| 1849 'shellPath': [0, str, 0, 1, '/bin/sh'], | 1859 'shellPath': [0, str, 0, 1, '/bin/sh'], |
| 1850 'shellScript': [0, str, 0, 1], | 1860 'shellScript': [0, str, 0, 1], |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2760 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') | 2770 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') |
| 2761 for object in sorted(objects_by_class[class_name], | 2771 for object in sorted(objects_by_class[class_name], |
| 2762 cmp=lambda x, y: cmp(x.id, y.id)): | 2772 cmp=lambda x, y: cmp(x.id, y.id)): |
| 2763 object.Print(file) | 2773 object.Print(file) |
| 2764 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') | 2774 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') |
| 2765 | 2775 |
| 2766 if self._should_print_single_line: | 2776 if self._should_print_single_line: |
| 2767 self._XCPrint(file, 0, '}; ') | 2777 self._XCPrint(file, 0, '}; ') |
| 2768 else: | 2778 else: |
| 2769 self._XCPrint(file, 1, '};\n') | 2779 self._XCPrint(file, 1, '};\n') |
| OLD | NEW |