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

KeyError 'fileType' #150

Open mcstoufer opened 10 years ago

mcstoufer commented 10 years ago

I'm getting the following error as soon as the Mk8 script runs: This is under XCode 5 and I am building an embedded framework.

PhaseScriptExecution Build\ Embedded\ Framework /Users/xxx/Library/Developer/Xcode/DerivedData/ECXWorkspace-bwmsvgsibaglvlfcuafjjugwkrgk/Build/Intermediates/ECXProject.build/Release-iphoneos/ECXProject.build/Script-C782073E14CF4F40003118D8.sh
    cd /Users/xxx/Projects/xxx/iOS/ECX2/ECXProject
    /bin/sh -c /Users/xxx/Library/Developer/Xcode/DerivedData/ECXWorkspace-bwmsvgsibaglvlfcuafjjugwkrgk/Build/Intermediates/ECXProject.build/Release-iphoneos/ECXProject.build/Script-C782073E14CF4F40003118D8.sh

UFW (M iphoneos): ERROR: Build failed
Traceback (most recent call last):
  File "/Users/xxx/Library/Developer/Xcode/DerivedData/ECXWorkspace-bwmsvgsibaglvlfcuafjjugwkrgk/Build/Intermediates/ECXProject.build/Release-iphoneos/ECXProject.build/Script-C782073E14CF4F40003118D8.sh", line 804, in <module>
    run_build()
  File "/Users/xxx/Library/Developer/Xcode/DerivedData/ECXWorkspace-bwmsvgsibaglvlfcuafjjugwkrgk/Build/Intermediates/ECXProject.build/Release-iphoneos/ECXProject.build/Script-C782073E14CF4F40003118D8.sh", line 737, in run_build
    project = Project(os.path.join(os.environ['PROJECT_FILE_PATH'], "project.pbxproj"))
  File "/Users/xxx/Library/Developer/Xcode/DerivedData/ECXWorkspace-bwmsvgsibaglvlfcuafjjugwkrgk/Build/Intermediates/ECXProject.build/Release-iphoneos/ECXProject.build/Script-C782073E14CF4F40003118D8.sh", line 200, in __init__
    self.compilable_sources = self.get_build_phase_files('PBXSourcesBuildPhase', lambda x: x['fileRef']['fileType'] in sourcecode_types)
  File "/Users/xxx/Library/Developer/Xcode/DerivedData/ECXWorkspace-bwmsvgsibaglvlfcuafjjugwkrgk/Build/Intermediates/ECXProject.build/Release-iphoneos/ECXProject.build/Script-C782073E14CF4F40003118D8.sh", line 300, in get_build_phase_files
    build_files = filter(filter_func, build_phase['files'])
  File "/Users/xxx/Library/Developer/Xcode/DerivedData/ECXWorkspace-bwmsvgsibaglvlfcuafjjugwkrgk/Build/Intermediates/ECXProject.build/Release-iphoneos/ECXProject.build/Script-C782073E14CF4F40003118D8.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
kstenerud commented 10 years ago

Hmm... it looks like one of the source files in your project doesn't have an associated file type for some reason. Can you send me a copy of the project file (It will be in your XYZ.xcodeproj directory, called project.pbxproj).

Line 199 is as follows:

    self.compilable_sources = self.get_build_phase_files('PBXSourcesBuildPhase', lambda x: x['fileRef']['fileType'] in sourcecode_types)

with sourcecode_types being:

    sourcecode_types = ['sourcecode.c.c',
                        'sourcecode.c.objc',
                        'sourcecode.cpp.cpp',
                        'sourcecode.cpp.objcpp',
                        'sourcecode.asm.asm',
                        'sourcecode.asm.llvm',
                        'sourcecode.nasm']

It's looking in the PBXSourcesBuildPhase phase of your project file, searching for file references that have one of the above source code types, but one of the fileRef entries doesn't have a fileType.

mcstoufer commented 10 years ago

As attached, I think you'll find that the .eps, .key, and .css files are tripping it up.

I'm also shipping out .png, .nib, and .cdm files as well in the framework. Are those OK too?

P.S., this project file has been around for years and is in need of some deep cleanup. It still works fine with your older scripts.

On Oct 20, 2013, at 11:30 AM, Karl Stenerud notifications@github.com wrote:

Hmm... it looks like one of the source files in your project doesn't have an associated file type for some reason. Can you send me a copy of the project file (It will be in your XYZ.xcodeproj directory, called project.pbxproj).

Line 199 is as follows:

self.compilable_sources = self.get_build_phase_files('PBXSourcesBuildPhase', lambda x: x['fileRef']['fileType'] in sourcecode_types)

with sourcecode_types being:

sourcecode_types = ['sourcecode.c.c',
                    'sourcecode.c.objc',
                    'sourcecode.cpp.cpp',
                    'sourcecode.cpp.objcpp',
                    'sourcecode.asm.asm',
                    'sourcecode.asm.llvm',
                    'sourcecode.nasm']

It's looking in the PBXSourcesBuildPhase phase of your project file, searching for file references that have one of the above source code types, but one of the fileRef entries doesn't have a fileType.

— Reply to this email directly or view it on GitHub.

hamdan commented 10 years ago

Script error on KeyError: filetype when using core data model like abc.xcdatamodeld

hamdan commented 10 years ago

change get_build_phase_files to this script

def get_build_phase_files(self, build_phase_name, filter_func): if len(filter(lambda x: x['isa'] == build_phase_name, self.target['buildPhases'])) > 0 : 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]