Commit f9041434 authored by Kyle Fuller's avatar Kyle Fuller

Merge pull request #2780 from CocoaPods/scope-dependencies-by-consumer

[Resolver] Scope dependencies in #edge_is_valid_for_target? by the spec's consume for that target's platform
parents 34e598ac 796f3635
......@@ -7,7 +7,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Core.git
revision: d436f8cc0aaa2e149aa770e20b74b7c0494b7952
revision: d194ce9a92a2f1f74cab6a11f60a1a0b339a7297
branch: master
specs:
cocoapods-core (0.35.0.rc1)
......
......@@ -359,8 +359,8 @@ module Pod
end
# Returns the target-appropriate nodes that are `successors` of `node`,
# rejecting those that are {Dependency#from_subspec_dependency?} and have
# and incompatible platform.
# rejecting those that are scoped by target platform and have incompatible
# targets.
#
# @return [Array<Molinillo::DependencyGraph::Vertex>]
# An array of target-appropriate nodes whose `payload`s are
......@@ -377,17 +377,13 @@ module Pod
# Whether the given `edge` should be followed to find dependencies for the
# given `target`.
#
# @note At the moment, this method only checks whether the edge's
# requirements are normal dependencies _or_ whether they are
# dependencies that come from {Specification#subspec_dependencies}
# and, if so, that their platforms are compatible with the target's.
#
# @return [Bool]
#
def edge_is_valid_for_target?(edge, target)
dependencies_for_target_platform =
edge.origin.payload.all_dependencies(target.platform).map(&:name)
edge.requirements.any? do |dependency|
!dependency.from_subspec_dependency? ||
edge.destination.payload.available_platforms.any? { |p| target.platform.supports?(p) }
dependencies_for_target_platform.include?(dependency.name)
end
end
end
......
Subproject commit b6e1c2429964b4e47b344958572930e15ffbbcea
Subproject commit 3000b6eca873d89082fd9fd54c064084b0d7c1b3
......@@ -382,7 +382,7 @@ module Pod
UI.warnings.should.match /multiple specifications/
end
describe 'concerning dependencies from `Specification#subspec_dependencies`' do
describe 'concerning dependencies that are scoped by consumer platform' do
def resolve
Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all).resolve
end
......@@ -424,6 +424,28 @@ module Pod
resolved[ios_target].map(&:to_s).should.include ios_subspec
resolved[osx_target].map(&:to_s).should.not.include ios_subspec
end
it 'includes dependencies in the target for the requested platform only' do
osx_dependency = 'ARAnalytics/CoreMac (2.8.0)'
ios_dependency = 'ARAnalytics/CoreIOS (2.8.0)'
@podfile = Podfile.new do
target 'iOS' do
platform :ios, '8'
pod 'ARAnalytics', '2.8.0'
end
target 'OSX' do
platform :osx, '10.10'
pod 'ARAnalytics', '2.8.0'
end
end
resolved = resolve
ios_target = resolved.keys.find { |td| td.label == 'Pods-iOS' }
osx_target = resolved.keys.find { |td| td.label == 'Pods-OSX' }
resolved[ios_target].map(&:to_s).should.include ios_dependency
resolved[osx_target].map(&:to_s).should.not.include ios_dependency
resolved[ios_target].map(&:to_s).should.not.include osx_dependency
resolved[osx_target].map(&:to_s).should.include osx_dependency
end
end
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