Commit fdf990bb authored by Marius Rackwitz's avatar Marius Rackwitz

Merge pull request #4954 from CocoaPods/mr-fix-resource-bundles

Fix resource bundle paths for improved deduplication
parents 9e215a01 38fef694
...@@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* None. * Fixes paths passed for resources bundles in the copy resources script.
[Marius Rackwitz](https://github.com/mrackwitz)
[#4954](https://github.com/CocoaPods/CocoaPods/pull/4954)
## 1.0.0.beta.4 (2016-02-24) ## 1.0.0.beta.4 (2016-02-24)
......
...@@ -107,15 +107,18 @@ module Pod ...@@ -107,15 +107,18 @@ module Pod
library_targets = target.pod_targets.reject do |pod_target| library_targets = target.pod_targets.reject do |pod_target|
pod_target.should_build? && pod_target.requires_frameworks? pod_target.should_build? && pod_target.requires_frameworks?
end end
resources_by_config = {} target.user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
target.user_build_configurations.keys.each do |config| resources_by_config[config] = library_targets.flat_map do |library_target|
file_accessors = library_targets.select { |t| t.include_in_build_config?(target_definition, config) }.flat_map(&:file_accessors) next [] unless library_target.include_in_build_config?(target_definition, config)
resource_paths = file_accessors.flat_map { |accessor| accessor.resources.flat_map { |res| res.relative_path_from(project.path.dirname) } } resource_paths = library_target.file_accessors.flat_map do |accessor|
resource_bundles = file_accessors.flat_map { |accessor| accessor.resource_bundles.keys.map { |name| "${BUILT_PRODUCTS_DIR}/#{name.shellescape}.bundle" } } accessor.resources.flat_map { |res| res.relative_path_from(project.path.dirname) }
resources_by_config[config] = (resource_paths + resource_bundles).uniq end
resources_by_config[config] << bridge_support_file if bridge_support_file resource_bundles = library_target.file_accessors.flat_map do |accessor|
accessor.resource_bundles.keys.map { |name| "#{library_target.configuration_build_dir}/#{name.shellescape}.bundle" }
end
(resource_paths + resource_bundles + [bridge_support_file].compact).uniq
end
end end
resources_by_config
end end
# Creates a script that copies the resources to the bundle of the client # Creates a script that copies the resources to the bundle of the client
......
Subproject commit 47109cc7cb10a3b17fa7c57437b3895448a79789 Subproject commit af3e74dcca333d15396a1ca60e7552277e0a9926
...@@ -150,10 +150,24 @@ module Pod ...@@ -150,10 +150,24 @@ module Pod
script.read.should.not.include?('logo-sidebar.png') script.read.should.not.include?('logo-sidebar.png')
end end
xit 'adds the resources bundles to the copy resources script' do it 'adds the resources bundles to the copy resources script' do
@pod_target.file_accessors.first.stubs(:resource_bundles).returns(
'Trees' => [Pathname('palm.jpg')],
'Leafs' => [Pathname('leaf.jpg')],
)
resources_by_config = @installer.send(:resources_by_config)
resources_by_config.each_value do |resources|
resources.should.include '$CONFIGURATION_BUILD_DIR/BananaLib/Trees.bundle'
resources.should.include '$CONFIGURATION_BUILD_DIR/BananaLib/Leafs.bundle'
end
end end
xit 'adds the bridge support file to the copy resources script, if one was created' do it 'adds the bridge support file to the copy resources script, if one was created' do
@installer.stubs(:bridge_support_file).returns(@installer.target.bridge_support_path)
resources_by_config = @installer.send(:resources_by_config)
resources_by_config.each_value do |resources|
resources.should.include @installer.target.bridge_support_path
end
end end
it 'does add pods to the embed frameworks script' do it 'does add pods to the embed frameworks script' 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