From fba677233a412523a2389e17e4acf4a8aeb179ad Mon Sep 17 00:00:00 2001 From: voidcat Date: Thu, 5 Mar 2026 15:06:46 +0800 Subject: [PATCH] Support PBXFileSystemSynchronizedRootGroup in merge application flow. Handle additions under PBXNativeTarget and group-like containers so Xcode 16 synchronized folder changes no longer fail as unsupported components. --- lib/kintsugi/apply_change_to_project.rb | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/kintsugi/apply_change_to_project.rb b/lib/kintsugi/apply_change_to_project.rb index 46905d6..8885d4f 100644 --- a/lib/kintsugi/apply_change_to_project.rb +++ b/lib/kintsugi/apply_change_to_project.rb @@ -652,6 +652,8 @@ def add_child_to_component(component, change, change_path) add_file_reference(component, change, change_path) when "PBXGroup" add_group(component, change, change_path) + when "PBXFileSystemSynchronizedRootGroup" + add_file_system_synchronized_root_group(component, change, change_path) when "PBXContainerItemProxy" add_container_item_proxy(component, change, change_path) when "PBXTargetDependency" @@ -1006,7 +1008,7 @@ def add_group(containing_component, change, change_path) new_group = containing_component[:project_ref].project.new(Xcodeproj::Project::PBXGroup) containing_component[:product_group] = new_group add_attributes_to_component(new_group, change, change_path) - when Xcodeproj::Project::PBXGroup + when Xcodeproj::Project::PBXGroup, Xcodeproj::Project::PBXFileSystemSynchronizedRootGroup # Adding groups to groups is handled by another part of the code. else raise MergeError, "Trying to add group to an unsupported component type " \ @@ -1015,6 +1017,29 @@ def add_group(containing_component, change, change_path) end end + def add_file_system_synchronized_root_group(containing_component, change, change_path) + case containing_component + when Xcodeproj::Project::PBXNativeTarget + group = containing_component.project.new(Xcodeproj::Project::PBXFileSystemSynchronizedRootGroup) + containing_component.file_system_synchronized_groups << group + add_attributes_to_component(group, change, change_path) + when Xcodeproj::Project::PBXGroup, Xcodeproj::Project::PBXFileSystemSynchronizedRootGroup + # Adding file system synchronized root groups to groups is handled by another part of + # the code. + else + if containing_component.respond_to?(:file_system_synchronized_groups) + group = containing_component.project.new(Xcodeproj::Project::PBXFileSystemSynchronizedRootGroup) + containing_component.file_system_synchronized_groups << group + add_attributes_to_component(group, change, change_path) + return + end + + raise MergeError, "Trying to add file system synchronized root group to an unsupported " \ + "component type #{containing_component.isa}. Change is: #{change}. " \ + "Change path: #{change_path}" + end + end + def add_attributes_to_component(component, change, change_path, ignore_keys: []) change.each do |change_name, change_value| next if (%w[isa displayName] + ignore_keys).include?(change_name)