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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 is_dir = True | 1467 is_dir = True |
1468 else: | 1468 else: |
1469 is_dir = False | 1469 is_dir = False |
1470 | 1470 |
1471 if 'path' in self._properties and \ | 1471 if 'path' in self._properties and \ |
1472 not 'lastKnownFileType' in self._properties and \ | 1472 not 'lastKnownFileType' in self._properties and \ |
1473 not 'explicitFileType' in self._properties: | 1473 not 'explicitFileType' in self._properties: |
1474 # TODO(mark): This is the replacement for a replacement for a quick hack. | 1474 # TODO(mark): This is the replacement for a replacement for a quick hack. |
1475 # It is no longer incredibly sucky, but this list needs to be extended. | 1475 # It is no longer incredibly sucky, but this list needs to be extended. |
1476 extension_map = { | 1476 extension_map = { |
1477 'a': 'archive.ar', | 1477 'a': 'archive.ar', |
1478 'app': 'wrapper.application', | 1478 'app': 'wrapper.application', |
1479 'bdic': 'file', | 1479 'bdic': 'file', |
1480 'bundle': 'wrapper.cfbundle', | 1480 'bundle': 'wrapper.cfbundle', |
1481 'c': 'sourcecode.c.c', | 1481 'c': 'sourcecode.c.c', |
1482 'cc': 'sourcecode.cpp.cpp', | 1482 'cc': 'sourcecode.cpp.cpp', |
1483 'cpp': 'sourcecode.cpp.cpp', | 1483 'cpp': 'sourcecode.cpp.cpp', |
1484 'css': 'text.css', | 1484 'css': 'text.css', |
1485 'cxx': 'sourcecode.cpp.cpp', | 1485 'cxx': 'sourcecode.cpp.cpp', |
1486 'dylib': 'compiled.mach-o.dylib', | 1486 'dylib': 'compiled.mach-o.dylib', |
1487 'framework': 'wrapper.framework', | 1487 'framework': 'wrapper.framework', |
1488 'h': 'sourcecode.c.h', | 1488 'h': 'sourcecode.c.h', |
1489 'hxx': 'sourcecode.cpp.h', | 1489 'hxx': 'sourcecode.cpp.h', |
1490 'icns': 'image.icns', | 1490 'icns': 'image.icns', |
1491 'java': 'sourcecode.java', | 1491 'java': 'sourcecode.java', |
1492 'js': 'sourcecode.javascript', | 1492 'js': 'sourcecode.javascript', |
1493 'm': 'sourcecode.c.objc', | 1493 'm': 'sourcecode.c.objc', |
1494 'mm': 'sourcecode.cpp.objcpp', | 1494 'mm': 'sourcecode.cpp.objcpp', |
1495 'nib': 'wrapper.nib', | 1495 'nib': 'wrapper.nib', |
1496 'o': 'compiled.mach-o.objfile', | 1496 'o': 'compiled.mach-o.objfile', |
1497 'pdf': 'image.pdf', | 1497 'pdf': 'image.pdf', |
1498 'pl': 'text.script.perl', | 1498 'pl': 'text.script.perl', |
1499 'plist': 'text.plist.xml', | 1499 'plist': 'text.plist.xml', |
1500 'pm': 'text.script.perl', | 1500 'pm': 'text.script.perl', |
1501 'png': 'image.png', | 1501 'png': 'image.png', |
1502 'py': 'text.script.python', | 1502 'py': 'text.script.python', |
1503 'r': 'sourcecode.rez', | 1503 'r': 'sourcecode.rez', |
1504 'rez': 'sourcecode.rez', | 1504 'rez': 'sourcecode.rez', |
1505 's': 'sourcecode.asm', | 1505 's': 'sourcecode.asm', |
1506 'strings': 'text.plist.strings', | 1506 'strings': 'text.plist.strings', |
1507 'ttf': 'file', | 1507 'ttf': 'file', |
1508 'xcconfig': 'text.xcconfig', | 1508 'xcconfig': 'text.xcconfig', |
1509 'xib': 'file.xib', | 1509 'xcdatamodel': 'wrapper.xcdatamodel', |
1510 'y': 'sourcecode.yacc', | 1510 'xib': 'file.xib', |
| 1511 'y': 'sourcecode.yacc', |
1511 } | 1512 } |
1512 | 1513 |
1513 if is_dir: | 1514 if is_dir: |
1514 file_type = 'folder' | 1515 file_type = 'folder' |
1515 else: | 1516 else: |
1516 basename = posixpath.basename(self._properties['path']) | 1517 basename = posixpath.basename(self._properties['path']) |
1517 (root, ext) = posixpath.splitext(basename) | 1518 (root, ext) = posixpath.splitext(basename) |
1518 # Check the map using a lowercase extension. | 1519 # Check the map using a lowercase extension. |
1519 # TODO(mark): Maybe it should try with the original case first and fall | 1520 # TODO(mark): Maybe it should try with the original case first and fall |
1520 # back to lowercase, in case there are any instances where case | 1521 # back to lowercase, in case there are any instances where case |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2859 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') | 2860 self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') |
2860 for object in sorted(objects_by_class[class_name], | 2861 for object in sorted(objects_by_class[class_name], |
2861 cmp=lambda x, y: cmp(x.id, y.id)): | 2862 cmp=lambda x, y: cmp(x.id, y.id)): |
2862 object.Print(file) | 2863 object.Print(file) |
2863 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') | 2864 self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') |
2864 | 2865 |
2865 if self._should_print_single_line: | 2866 if self._should_print_single_line: |
2866 self._XCPrint(file, 0, '}; ') | 2867 self._XCPrint(file, 0, '}; ') |
2867 else: | 2868 else: |
2868 self._XCPrint(file, 1, '};\n') | 2869 self._XCPrint(file, 1, '};\n') |
OLD | NEW |