Commit da54718d authored by Fabio Pelosin's avatar Fabio Pelosin

[PodTarget] Ensure that subspecs are on the same configurations

parent 78700472
......@@ -71,8 +71,33 @@ module Pod
# The name of the build configuration.
#
def include_in_build_config?(configuration_name)
@target_definition.pod_whitelisted_for_configuration?(pod_name, configuration_name)
whitelists = target_definition_dependencies.map do |dependency|
target_definition.pod_whitelisted_for_configuration?(dependency.name, configuration_name)
end.uniq
if whitelists.empty?
return true
elsif whitelists.count == 1
whitelists.first
else
raise Informative, "The subspecs of `#{pod_name}` are linked to " \
"different build configurations for the `#{target_definition}` " \
"target. CocoaPods does not support subspecs across different " \
"build configurations."
end
end
private
# @return [Array<Dependency>] The dependency of the target definition for
# this Pod. Return an empty array if the Pod is not a direct
# dependency of the target definition but the dependency of one or
# more Pods.
#
def target_definition_dependencies
target_definition.dependencies.select do |dependency|
Specification.root_name(dependency.name) == pod_name
end
end
end
end
......@@ -37,6 +37,27 @@ module Pod
it "returns the name of the Pods on which this target depends" do
@pod_target.dependencies.should == ["monkey"]
end
it "returns whether it is whitelisted in a build configuration" do
@target_definition.store_pod('BananaLib')
@target_definition.whitelist_pod_for_configuration('BananaLib', 'debug')
@pod_target.include_in_build_config?('Debug').should.be.true
@pod_target.include_in_build_config?('Release').should.be.false
end
it "is whitelisted on all build configurations of it is a dependency of other Pods" do
@pod_target.include_in_build_config?('Debug').should.be.true
@pod_target.include_in_build_config?('Release').should.be.true
end
it "raises if a Pod is whitelisted for different build configurations" do
@target_definition.store_pod('BananaLib')
@target_definition.store_pod('BananaLib/Subspec')
@target_definition.whitelist_pod_for_configuration('BananaLib', 'debug')
should.raise Informative do
@pod_target.include_in_build_config?('release').should.be.true
end.message.should.match /subspecs across different build configurations/
end
end
describe "Support files" 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