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 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