diff --git a/pbxproj/pbxextensions/ProjectFiles.py b/pbxproj/pbxextensions/ProjectFiles.py old mode 100644 new mode 100755 index f55cd0cf..21eb4adc --- a/pbxproj/pbxextensions/ProjectFiles.py +++ b/pbxproj/pbxextensions/ProjectFiles.py @@ -325,6 +325,11 @@ def _create_build_files(self, file_ref, attributes, build_phases): results = [] # create the build file and add it to the phase for target_build_phase in build_phases: + # check to see if we already have a PBXBuildFile for this file_ref in this phase, if so + # don't create another one + if any(str(self.objects[str(build_file)].fileRef) == file_ref.get_id() for build_file in target_build_phase.files): + continue + build_file = PBXBuildFile.create(file_ref, attributes) self.objects[build_file.get_id()] = build_file target_build_phase.add_build_file(build_file) diff --git a/pbxproj/pbxsections/PBXGroup.py b/pbxproj/pbxsections/PBXGroup.py old mode 100644 new mode 100755 index b3f526e4..1de06dfa --- a/pbxproj/pbxsections/PBXGroup.py +++ b/pbxproj/pbxsections/PBXGroup.py @@ -1,5 +1,6 @@ from pbxproj.PBXGenericObject import * from pbxproj.pbxsections import * +from pbxproj.pbxsections.PBXVariantGroup import * class PBXGroup(PBXGenericObject): @@ -44,7 +45,7 @@ def has_child(self, child): def add_child(self, child): # if it's not the right type of children for the group - if not isinstance(child, PBXGroup) and not isinstance(child, PBXFileReference): + if not isinstance(child, PBXGroup) and not isinstance(child, PBXFileReference) and not isinstance(child, PBXVariantGroup): return False self.children.append(child.get_id())