From c1fa9d1e1030628a1ab2f84d372658c5cda7f1f9 Mon Sep 17 00:00:00 2001 From: Mani Ramezan Date: Fri, 8 Nov 2019 13:41:05 -0500 Subject: [PATCH 1/2] Create separate group for subproject targets Fixes issue mentioned [here](https://github.com/CocoaPods/Xcodeproj/issues/678) --- .../project/object/helpers/file_references_factory.rb | 3 ++- spec/project/object/helpers/file_references_factory_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/xcodeproj/project/object/helpers/file_references_factory.rb b/lib/xcodeproj/project/object/helpers/file_references_factory.rb index 20c767836..5a25edac6 100644 --- a/lib/xcodeproj/project/object/helpers/file_references_factory.rb +++ b/lib/xcodeproj/project/object/helpers/file_references_factory.rb @@ -178,7 +178,8 @@ def new_subproject(group, path, source_tree) ref = new_file_reference(group, path, source_tree) ref.include_in_index = nil - product_group_ref = find_products_group_ref(group, true) + product_group_ref = group.project.new(Xcodeproj::Project::PBXGroup) + product_group_ref.name = 'Products' subproj = Project.open(path) subproj.products_group.files.each do |product_reference| diff --git a/spec/project/object/helpers/file_references_factory_spec.rb b/spec/project/object/helpers/file_references_factory_spec.rb index 9972c8e6c..91b502d38 100644 --- a/spec/project/object/helpers/file_references_factory_spec.rb +++ b/spec/project/object/helpers/file_references_factory_spec.rb @@ -246,11 +246,11 @@ module ProjectSpecs container_proxy.remote_global_id_string.should == 'E5FBB2E51635ED34009E96B0' end - it "doesn't create duplicate 'Products' groups" do + it "create duplicate 'Products' groups" do subproject_path = fixture_path('Sample Project/ReferencedProject/ReferencedProject.xcodeproj') @subproject = Xcodeproj::Project.open(subproject_path) @project.main_group.new_reference(@subproject.path) - @project.objects.select { |o| o.display_name == 'Products' }.count.should == 1 + @project.objects.select { |o| o.display_name == 'Products' }.count.should == 3 @subproject.objects.select { |o| o.display_name == 'Products' }.count.should == 1 end end From d7c8d6e212f3c670786dcac9f5239e7e8da3de75 Mon Sep 17 00:00:00 2001 From: Mani Ramezan Date: Fri, 8 Nov 2019 13:53:32 -0500 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b61f12b92..c711b6a73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ [wade0317](https://github.com/wade0317) [#723](https://github.com/CocoaPods/Xcodeproj/pull/723) +* Create separate group for subproject targets + [maniramezan](https://github.com/maniramezan) + [#678](https://github.com/CocoaPods/Xcodeproj/issues/678) + ## 1.13.0 (2019-10-16) ##### Enhancements