kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 473 forks source link

Script error on KeyError: 'fileType' #105

Open echoz opened 11 years ago

echoz commented 11 years ago

Currently using MK8 on Xcode 4.5.1 (4G1004) to build a Real Framework. Everything complies until the execution of the script and I get the following error

UFW (M iphoneos): ERROR: Build failed
Traceback (most recent call last):
  File "/Users/jeremy/Library/Developer/Xcode/DerivedData/LBCCore-cmlbgkoisoycofhjzhaetnhfvhxa/Build/Intermediates/LBCCore.build/Debug-iphoneos/Lobang.build/Script-3FC7F9261626A5120077EBCA.sh", line 804, in <module>
    run_build()
  File "/Users/jeremy/Library/Developer/Xcode/DerivedData/LBCCore-cmlbgkoisoycofhjzhaetnhfvhxa/Build/Intermediates/LBCCore.build/Debug-iphoneos/Lobang.build/Script-3FC7F9261626A5120077EBCA.sh", line 737, in run_build
    project = Project(os.path.join(os.environ['PROJECT_FILE_PATH'], "project.pbxproj"))
  File "/Users/jeremy/Library/Developer/Xcode/DerivedData/LBCCore-cmlbgkoisoycofhjzhaetnhfvhxa/Build/Intermediates/LBCCore.build/Debug-iphoneos/Lobang.build/Script-3FC7F9261626A5120077EBCA.sh", line 200, in __init__
    self.compilable_sources = self.get_build_phase_files('PBXSourcesBuildPhase', lambda x: x['fileRef']['fileType'] in sourcecode_types)
  File "/Users/jeremy/Library/Developer/Xcode/DerivedData/LBCCore-cmlbgkoisoycofhjzhaetnhfvhxa/Build/Intermediates/LBCCore.build/Debug-iphoneos/Lobang.build/Script-3FC7F9261626A5120077EBCA.sh", line 300, in get_build_phase_files
    build_files = filter(filter_func, build_phase['files'])
  File "/Users/jeremy/Library/Developer/Xcode/DerivedData/LBCCore-cmlbgkoisoycofhjzhaetnhfvhxa/Build/Intermediates/LBCCore.build/Debug-iphoneos/Lobang.build/Script-3FC7F9261626A5120077EBCA.sh", line 200, in <lambda>
    self.compilable_sources = self.get_build_phase_files('PBXSourcesBuildPhase', lambda x: x['fileRef']['fileType'] in sourcecode_types)
KeyError: 'fileType'
Command /bin/sh failed with exit code 1

Thing is, when I check the build directory in DerivedData, I actually see the Framework structure all laid out, but its just for the platform that it was building for (in this case, armv7 and armv7s).

wildbomb commented 11 years ago

I have the same issue when the target needs to compile a .xcdatamodeld. Problem is, this is a directory with a .xcdatamodel file inside, so there is no fileType and it fails.

paynerc commented 11 years ago

I am also seeing this same issue when trying to build a framework that contains both a single xcdatamodel as well as a xcdatamodeld. Has there been any workarounds for this issue? Or is the workaround going back to MK7?

ghost commented 11 years ago

I fixed the bug by modifying the get_build_phase_files() function. Since this is simply used to check if there are any compilable sources added to the project, you can bypass altogether the VersionGroup folders like .xcdatamodeld.

def get_build_phase_files(self, build_phase_name, filter_func):
    build_phase = filter(lambda x: x['isa'] == build_phase_name, self.target['buildPhases'])[0]
    build_files = filter(lambda x: x['fileRef']['isa'] != 'XCVersionGroup', build_phase['files'])        
    build_files = filter(filter_func, build_files)
    return [x['fileRef'] for x in build_files]