iOS-Universal-Framework icon indicating copy to clipboard operation
iOS-Universal-Framework copied to clipboard

KeyError 'fileType'

Open mcstoufer opened this issue 12 years ago • 4 comments

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

mcstoufer avatar Oct 18 '13 22:10 mcstoufer

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.

kstenerud avatar Oct 20 '13 18:10 kstenerud

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 [email protected] 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.

mcstoufer avatar Oct 21 '13 16:10 mcstoufer

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

hamdan avatar Feb 01 '14 23:02 hamdan

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]

hamdan avatar Feb 02 '14 19:02 hamdan