Commit d915b394 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4809 from efirestone/firestone/mapping-models

Handle CoreData mapping model resources
parents 61c1ae80 65625da1
...@@ -10,6 +10,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -10,6 +10,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Handle CoreData mapping models with recursive resource globs.
[Eric Firestone](https://github.com/efirestone)
[#4809](https://github.com/CocoaPods/CocoaPods/pull/4809)
* Generate valid xcconfig when target name includes spaces. * Generate valid xcconfig when target name includes spaces.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#4783](https://github.com/CocoaPods/CocoaPods/issues/4783) [#4783](https://github.com/CocoaPods/CocoaPods/issues/4783)
......
...@@ -204,6 +204,9 @@ module Pod ...@@ -204,6 +204,9 @@ module Pod
# We add the directory for a Core Data model, but not the items in it. # We add the directory for a Core Data model, but not the items in it.
next if path_str =~ /.*\.xcdatamodeld\/.+/i next if path_str =~ /.*\.xcdatamodeld\/.+/i
# We add the directory for a Core Data migration mapping, but not the items in it.
next if path_str =~ /.*\.xcmappingmodel\/.+/i
# We add the directory for an asset catalog, but not the items in it. # We add the directory for an asset catalog, but not the items in it.
next if path_str =~ /.*\.xcassets\/.+/i next if path_str =~ /.*\.xcassets\/.+/i
......
...@@ -143,11 +143,32 @@ module Pod ...@@ -143,11 +143,32 @@ module Pod
it "doesn't add file references for files within Asset Catalogs" do it "doesn't add file references for files within Asset Catalogs" do
@installer.install! @installer.install!
catalog_ref = @installer.pods_project['Pods/BananaLib/Resources/Images.xcassets'] resources_group_ref = @installer.pods_project['Pods/BananaLib/Resources']
catalog_ref.should.be.not.nil catalog_path = 'Resources/Images.xcassets'
# The asset catalog should be a "PBXFileReference" and therefore doesn't have children. # The asset catalog should be a "PBXFileReference" and therefore doesn't have children.
catalog_ref.is_a?(Xcodeproj::Project::Object::PBXFileReference).should.be.true resources_group_ref.files.any? { |ref| ref.path == catalog_path }.should.be.true
# The asset catalog should not also be a "PBXGroup".
resources_group_ref.groups.any? { |ref| ref.path == catalog_path }.should.be.false
# None of the children of the catalog directory should be present directly.
resources_group_ref.files.any? { |ref| ref.path.start_with?(catalog_path + '/') }.should.be.false
end
it "doesn't add file references for files within CoreData migration mappings" do
@installer.install!
resources_group_ref = @installer.pods_project['Pods/BananaLib/Resources']
mapping_path = 'Resources/Migration.xcmappingmodel'
# The mapping model should be a "PBXFileReference" and therefore doesn't have children.
resources_group_ref.files.any? { |ref| ref.path == mapping_path }.should.be.true
# The mapping model should not also be a "PBXGroup".
resources_group_ref.groups.any? { |ref| ref.path == mapping_path }.should.be.false
# None of the children of the mapping model directory should be present directly.
resources_group_ref.files.any? { |ref| ref.path.start_with?(mapping_path + '/') }.should.be.false
end end
end end
......
...@@ -465,6 +465,18 @@ module Pod ...@@ -465,6 +465,18 @@ module Pod
end end
version_build_file.should.be.nil version_build_file.should.be.nil
end end
it 'adds Core Data migration mapping models directly to resources' do
# The model directory item should be present.
dir_build_file = @bundle_target.resources_build_phase.files.find { |bf| bf.file_ref.path == 'Resources/Migration.xcmappingmodel' }
dir_build_file.should.be.not.nil
# An item within the model directory should not be present.
xml_file = @bundle_target.resources_build_phase.files.find do |bf|
bf.file_ref.path =~ %r{Resources/Migration\.xcmappingmodel/.*}i
end
xml_file.should.be.nil
end
end end
end end
end end
......
...@@ -110,6 +110,7 @@ module Pod ...@@ -110,6 +110,7 @@ module Pod
@accessor.resources.sort.should == [ @accessor.resources.sort.should == [
@root + 'Resources/Base.lproj', @root + 'Resources/Base.lproj',
@root + 'Resources/Images.xcassets', @root + 'Resources/Images.xcassets',
@root + 'Resources/Migration.xcmappingmodel',
@root + 'Resources/Sample.xcdatamodeld', @root + 'Resources/Sample.xcdatamodeld',
@root + 'Resources/de.lproj', @root + 'Resources/de.lproj',
@root + 'Resources/en.lproj', @root + 'Resources/en.lproj',
...@@ -161,6 +162,7 @@ module Pod ...@@ -161,6 +162,7 @@ module Pod
@root + 'Resources/de.lproj', @root + 'Resources/de.lproj',
@root + 'Resources/en.lproj', @root + 'Resources/en.lproj',
@root + 'Resources/Images.xcassets', @root + 'Resources/Images.xcassets',
@root + 'Resources/Migration.xcmappingmodel',
@root + 'Resources/Sample.xcdatamodeld', @root + 'Resources/Sample.xcdatamodeld',
@root + 'Resources/sub_dir', @root + 'Resources/sub_dir',
] ]
...@@ -175,6 +177,7 @@ module Pod ...@@ -175,6 +177,7 @@ module Pod
@root + 'Resources/de.lproj', @root + 'Resources/de.lproj',
@root + 'Resources/en.lproj', @root + 'Resources/en.lproj',
@root + 'Resources/Images.xcassets', @root + 'Resources/Images.xcassets',
@root + 'Resources/Migration.xcmappingmodel',
@root + 'Resources/Sample.xcdatamodeld', @root + 'Resources/Sample.xcdatamodeld',
@root + 'Resources/sub_dir', @root + 'Resources/sub_dir',
] ]
...@@ -189,6 +192,7 @@ module Pod ...@@ -189,6 +192,7 @@ module Pod
@root + 'Resources/de.lproj', @root + 'Resources/de.lproj',
@root + 'Resources/en.lproj', @root + 'Resources/en.lproj',
@root + 'Resources/Images.xcassets', @root + 'Resources/Images.xcassets',
@root + 'Resources/Migration.xcmappingmodel',
@root + 'Resources/Sample.xcdatamodeld', @root + 'Resources/Sample.xcdatamodeld',
@root + 'Resources/sub_dir', @root + 'Resources/sub_dir',
] ]
......
...@@ -26,6 +26,7 @@ module Pod ...@@ -26,6 +26,7 @@ module Pod
Resources/Base.lproj/Main.storyboard Resources/Base.lproj/Main.storyboard
Resources/Images.xcassets/Logo.imageset/Contents.json Resources/Images.xcassets/Logo.imageset/Contents.json
Resources/Images.xcassets/Logo.imageset/logo.png Resources/Images.xcassets/Logo.imageset/logo.png
Resources/Migration.xcmappingmodel/xcmapping.xml
Resources/Sample.xcdatamodeld/.xccurrentversion Resources/Sample.xcdatamodeld/.xccurrentversion
Resources/Sample.xcdatamodeld/Sample\ 2.xcdatamodel/contents Resources/Sample.xcdatamodeld/Sample\ 2.xcdatamodel/contents
Resources/Sample.xcdatamodeld/Sample.xcdatamodel/contents Resources/Sample.xcdatamodeld/Sample.xcdatamodel/contents
...@@ -62,6 +63,7 @@ module Pod ...@@ -62,6 +63,7 @@ module Pod
Resources/Base.lproj Resources/Base.lproj
Resources/Images.xcassets Resources/Images.xcassets
Resources/Images.xcassets/Logo.imageset Resources/Images.xcassets/Logo.imageset
Resources/Migration.xcmappingmodel
Resources/Sample.xcdatamodeld Resources/Sample.xcdatamodeld
Resources/Sample.xcdatamodeld/Sample\ 2.xcdatamodel Resources/Sample.xcdatamodeld/Sample\ 2.xcdatamodel
Resources/Sample.xcdatamodeld/Sample.xcdatamodel Resources/Sample.xcdatamodeld/Sample.xcdatamodel
...@@ -154,6 +156,7 @@ module Pod ...@@ -154,6 +156,7 @@ module Pod
paths.sort.should == %w( paths.sort.should == %w(
Resources/Base.lproj Resources/Base.lproj
Resources/Images.xcassets Resources/Images.xcassets
Resources/Migration.xcmappingmodel
Resources/Sample.xcdatamodeld Resources/Sample.xcdatamodeld
Resources/de.lproj Resources/de.lproj
Resources/en.lproj Resources/en.lproj
......
...@@ -44,6 +44,7 @@ module Pod ...@@ -44,6 +44,7 @@ module Pod
README README
Resources/Base.lproj Resources/Base.lproj
Resources/Images.xcassets Resources/Images.xcassets
Resources/Migration.xcmappingmodel
Resources/Sample.xcdatamodeld Resources/Sample.xcdatamodeld
Resources/de.lproj Resources/de.lproj
Resources/en.lproj Resources/en.lproj
...@@ -78,6 +79,7 @@ module Pod ...@@ -78,6 +79,7 @@ module Pod
README README
Resources/Base.lproj Resources/Base.lproj
Resources/Images.xcassets Resources/Images.xcassets
Resources/Migration.xcmappingmodel
Resources/Sample.xcdatamodeld Resources/Sample.xcdatamodeld
Resources/de.lproj Resources/de.lproj
Resources/en.lproj Resources/en.lproj
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment