Commit cb6c770c authored by Kyle Fuller's avatar Kyle Fuller

Merge pull request #3473 from CocoaPods/seg-cache-platforms

[Cache] Keep files needed by subspecs that have a higher minimum deploym...
parents 48f6579a 310610b6
...@@ -4,6 +4,16 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -4,6 +4,16 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
To install release candidates run `[sudo] gem install cocoapods --pre` To install release candidates run `[sudo] gem install cocoapods --pre`
## Master
##### Bug Fixes
* Handle caching specs that have subspecs with higher minimum deployment targets
without deleting needed source files.
[Samuel Giddins](https://github.com/segiddins)
[#3471](https://github.com/CocoaPods/CocoaPods/issues/3471)
## 0.37.0.rc.1 ## 0.37.0.rc.1
[Core](https://github.com/CocoaPods/Core/compare/0.37.0.beta.1...0.37.0.rc.1) [Core](https://github.com/CocoaPods/Core/compare/0.37.0.beta.1...0.37.0.rc.1)
......
...@@ -182,16 +182,24 @@ module Pod ...@@ -182,16 +182,24 @@ module Pod
# @return [Void] # @return [Void]
# #
def copy_and_clean(source, destination, spec) def copy_and_clean(source, destination, spec)
specs_by_platform = {} specs_by_platform = group_subspecs_by_platform(spec)
spec.available_platforms.each do |platform|
specs_by_platform[platform] = [spec, *spec.recursive_subspecs].select { |ss| ss.supported_on_platform?(platform) }
end
destination.parent.mkpath destination.parent.mkpath
FileUtils.cp_r(source, destination) FileUtils.cp_r(source, destination)
Pod::Installer::PodSourcePreparer.new(spec, destination).prepare! Pod::Installer::PodSourcePreparer.new(spec, destination).prepare!
Sandbox::PodDirCleaner.new(destination, specs_by_platform).clean! Sandbox::PodDirCleaner.new(destination, specs_by_platform).clean!
end end
def group_subspecs_by_platform(spec)
specs_by_platform = {}
[spec, *spec.recursive_subspecs].each do |ss|
ss.available_platforms.each do |platform|
specs_by_platform[platform] ||= []
specs_by_platform[platform] << ss
end
end
specs_by_platform
end
# Writes the given `spec` to the given `path`. # Writes the given `spec` to the given `path`.
# #
# @param [Specification] spec # @param [Specification] spec
......
...@@ -24,6 +24,23 @@ module Pod ...@@ -24,6 +24,23 @@ module Pod
@cache.root.should.be.directory? @cache.root.should.be.directory?
end end
it 'groups subspecs by platform' do
@spec = Specification.new do |s|
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.7'
s.subspec 'subspec' do |ss|
ss.ios.deployment_target = '8.0'
end
end
@cache.send(:group_subspecs_by_platform, @spec).should == {
Platform.new(:ios, '8.0') => [@spec.subspecs.first],
Platform.new(:ios, '6.0') => [@spec],
Platform.new(:osx, '10.7') => [@spec],
}
end
describe 'when the download is not cached' do describe 'when the download is not cached' do
describe 'when downloading a released pod' do describe 'when downloading a released pod' do
it 'downloads the source' do it 'downloads the source' do
......
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