Commit 9be151ef authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #5451 from mercadolibre/5362-circular_targets

[PodTarget] Make #recursive_dependent_targets handle cyclic dependencies
parents 4856acbe 803fab5b
...@@ -39,6 +39,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -39,6 +39,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Boris Bügling](https://github.com/neonichu) [Boris Bügling](https://github.com/neonichu)
[#5445](https://github.com/CocoaPods/CocoaPods/issues/5445) [#5445](https://github.com/CocoaPods/CocoaPods/issues/5445)
* Resolve cyclic dependencies when creating pod targets.
[Juan Civile](https://github.com/champo)
[#5362](https://github.com/CocoaPods/CocoaPods/issues/5362)
## 1.0.1 (2016-06-02) ## 1.0.1 (2016-06-02)
......
...@@ -189,8 +189,14 @@ module Pod ...@@ -189,8 +189,14 @@ module Pod
# dependency upon. # dependency upon.
# #
def recursive_dependent_targets def recursive_dependent_targets
targets = dependent_targets + dependent_targets.flat_map(&:recursive_dependent_targets) targets = dependent_targets.clone
targets.uniq!
targets.each do |target|
target.dependent_targets.each do |t|
targets.push(t) unless t == self || targets.include?(t)
end
end
targets targets
end end
......
Subproject commit 4c7f2413a2cf1a8175c544555d000bfb6511e943 Subproject commit 409958a75378ff70582af2fbabb1441c551ed1c7
...@@ -306,6 +306,11 @@ describe_cli 'pod' do ...@@ -306,6 +306,11 @@ describe_cli 'pod' do
behaves_like cli_spec 'install_search_paths_inheritance', behaves_like cli_spec 'install_search_paths_inheritance',
'install --no-repo-update' 'install --no-repo-update'
end end
describe 'Integrates a Pod with circular subspec dependencies' do
behaves_like cli_spec 'install_circular_subspec_dependency',
'install --no-repo-update'
end
end end
#--------------------------------------# #--------------------------------------#
......
...@@ -281,6 +281,29 @@ module Pod ...@@ -281,6 +281,29 @@ module Pod
@pod_target.requires_frameworks?.should == true @pod_target.requires_frameworks?.should == true
end end
end end
describe 'With dependencies' do
before do
@pod_dependency = fixture_pod_target('orange-framework/OrangeFramework.podspec')
@pod_target.dependent_targets = [@pod_dependency]
end
it 'resolves simple dependencies' do
@pod_target.recursive_dependent_targets.should == [@pod_dependency]
end
describe 'With cyclic dependencies' do
before do
@pod_dependency = fixture_pod_target('orange-framework/OrangeFramework.podspec')
@pod_dependency.dependent_targets = [@pod_target]
@pod_target.dependent_targets = [@pod_dependency]
end
it 'resolves the cycle' do
@pod_target.recursive_dependent_targets.should == [@pod_dependency]
end
end
end
end end
end 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