Skip to content

Commit e640709

Browse files
committed
kintsugi: handle buildable folders?
This was written by cursor
1 parent dd37463 commit e640709

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

lib/kintsugi/apply_change_to_project.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def flatten_change(change, path)
107107

108108
def apply_group_additions(project, additions, force_create_containing_group: false)
109109
additions.each do |change, path|
110-
next unless %w[PBXGroup PBXVariantGroup].include?(change["isa"])
110+
next unless %w[PBXGroup PBXVariantGroup PBXFileSystemSynchronizedRootGroup].include?(change["isa"])
111111

112112
group_type = Module.const_get("Xcodeproj::Project::#{change["isa"]}")
113113
containing_group = project.group_or_file_at_path(path)
@@ -652,6 +652,8 @@ def add_child_to_component(component, change, change_path)
652652
add_file_reference(component, change, change_path)
653653
when "PBXGroup"
654654
add_group(component, change, change_path)
655+
when "PBXFileSystemSynchronizedRootGroup"
656+
add_file_system_synchronized_root_group(component, change, change_path)
655657
when "PBXContainerItemProxy"
656658
add_container_item_proxy(component, change, change_path)
657659
when "PBXTargetDependency"
@@ -1015,6 +1017,22 @@ def add_group(containing_component, change, change_path)
10151017
end
10161018
end
10171019

1020+
def add_file_system_synchronized_root_group(containing_component, change, change_path)
1021+
case containing_component
1022+
when Xcodeproj::Project::ObjectDictionary
1023+
# It is assumed that an `ObjectDictionary` always represents a project reference.
1024+
new_group = containing_component[:project_ref].project.new(Xcodeproj::Project::PBXFileSystemSynchronizedRootGroup)
1025+
containing_component[:product_group] = new_group
1026+
add_attributes_to_component(new_group, change, change_path)
1027+
when Xcodeproj::Project::PBXGroup
1028+
# Adding file system synchronized root groups to groups is handled by another part of the code.
1029+
else
1030+
raise MergeError, "Trying to add file system synchronized root group to an unsupported component type " \
1031+
"#{containing_component.isa}. Change is: #{change}. Change path: " \
1032+
"#{change_path}"
1033+
end
1034+
end
1035+
10181036
def add_attributes_to_component(component, change, change_path, ignore_keys: [])
10191037
change.each do |change_name, change_value|
10201038
next if (%w[isa displayName] + ignore_keys).include?(change_name)

0 commit comments

Comments
 (0)