Commit 3268bf72 authored by Kyle Fuller's avatar Kyle Fuller

Merge pull request #2934 from CocoaPods/fix-resource-bundles-for-not-build-targets

Fix resource bundles for not build targets
parents 9258cd3a 27ff9bc4
......@@ -43,6 +43,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
* Fix resource bundles for not build targets.
[Boris Bügling](https://github.com/neonichu)
[#2934](https://github.com/CocoaPods/CocoaPods/issues/2934)
* Fix updating a pod that has subspec dependencies.
[Samuel Giddins](https://github.com/segiddins)
[#2879](https://github.com/CocoaPods/CocoaPods/issues/2879)
......
......@@ -447,7 +447,14 @@ module Pod
def set_target_dependencies
aggregate_targets.each do |aggregate_target|
aggregate_target.pod_targets.each do |pod_target|
next unless pod_target.should_build?
unless pod_target.should_build?
pod_target.resource_bundle_targets.each do |resource_bundle_target|
aggregate_target.native_target.add_dependency(resource_bundle_target)
end
next
end
aggregate_target.native_target.add_dependency(pod_target.native_target)
pod_target.dependencies.each do |dep|
......
......@@ -9,7 +9,10 @@ module Pod
# @return [void]
#
def install!
return unless target.should_build?
unless target.should_build?
add_resources_bundle_targets
return
end
UI.message "- Installing target `#{target.name}` #{target.platform}" do
add_target
......@@ -66,10 +69,9 @@ module Pod
target.file_accessors.each do |file_accessor|
file_accessor.resource_bundles.each do |bundle_name, paths|
# Add a dependency on an existing Resource Bundle target if possible
if bundle_target = project.targets.find { |target| target.name == bundle_name }
native_target.add_dependency(bundle_target)
next
end
bundle_target = project.targets.find { |target| target.name == bundle_name }
unless bundle_target
file_references = paths.map { |sf| project.reference_for_path(sf) }
bundle_target = project.new_resources_bundle(bundle_name, file_accessor.spec_consumer.platform_name)
bundle_target.add_resources(file_references)
......@@ -77,11 +79,16 @@ module Pod
target.user_build_configurations.each do |bc_name, type|
bundle_target.add_build_configuration(bc_name, type)
end
end
target.resource_bundle_targets << bundle_target
if target.should_build?
native_target.add_dependency(bundle_target)
end
end
end
end
# Generates the contents of the xcconfig file and saves it to disk.
#
......
......@@ -21,6 +21,7 @@ module Pod
@sandbox = sandbox
@build_headers = Sandbox::HeadersStore.new(sandbox, 'Private')
@file_accessors = []
@resource_bundle_targets = []
end
# @return [String] the label for the target.
......@@ -34,6 +35,10 @@ module Pod
#
attr_accessor :file_accessors
# @return [Array<PBXTarget>] the resource bundle targets belonging
# to this target.
attr_reader :resource_bundle_targets
# @return [Bool] Whether or not this target should be build.
#
# A target should not be build if it has no source files.
......
Subproject commit 626a25f5eb1ffa87af16521704b1a9a81e56be85
Subproject commit 3d83baf65d54e6abae10d480bdeb4f00a11e3682
......@@ -189,6 +189,11 @@ describe_cli 'pod' do
'install --no-repo-update'
end
describe 'Integrates a Pod without source files but with resources' do
behaves_like cli_spec 'install_resources_no_source_files',
'install --no-repo-update'
end
# @todo add tests for all the hooks API
#
describe 'Runs the Podfile callbacks' do
......
......@@ -409,6 +409,23 @@ module Pod
describe '#set_target_dependencies' do
it 'sets resource bundles for not build pods as target dependencies of the user target' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile)
pod_target = PodTarget.new([spec], target_definition, config.sandbox)
pod_target.stubs(:resource_bundle_targets).returns(['dummy'])
pod_target.stubs(:should_build? => false)
target = AggregateTarget.new(target_definition, config.sandbox)
mock_target = mock
mock_target.expects(:add_dependency).with('dummy')
target.stubs(:native_target).returns(mock_target)
target.stubs(:pod_targets).returns([pod_target])
@installer.stubs(:aggregate_targets).returns([target])
@installer.send(:set_target_dependencies)
end
xit 'sets the pod targets as dependencies of the aggregate target' do
end
......
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