Commit bc127ecf authored by Samuel Giddins's avatar Samuel Giddins

[PostInstallHooksContext] Make array of user targets available

parent f41d364a
......@@ -17,6 +17,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Jed Lewison](https://github.com/jedlewison)
[#4722](https://github.com/CocoaPods/CocoaPods/issues/4722)
* Add `user_targets` method to the `UmbrellaTargetDescription` in the
post-install hooks context.
[Samuel Giddins](https://github.com/segiddins)
##### Bug Fixes
* Always fetch a `:podspec` dependency's podspec when it is missing in the
......
......@@ -38,7 +38,7 @@ module Pod
aggregate_targets.each do |umbrella|
desc = UmbrellaTargetDescription.new
desc.user_project = umbrella.user_project
desc.user_target_uuids = umbrella.user_target_uuids
desc.user_targets = umbrella.user_targets
desc.specs = umbrella.specs
desc.platform_name = umbrella.platform.name
desc.platform_deployment_target = umbrella.platform.deployment_target.to_s
......@@ -69,6 +69,11 @@ module Pod
user_project.path if user_project
end
# @return [Array<PBXNativeTarget>]
# The list of user targets integrated by this umbrella target.
#
attr_accessor :user_targets
# @return [Array<String>] The list of the UUIDs of the
# user targets integrated by this umbrella
# target. They can be used to find the
......@@ -76,7 +81,9 @@ module Pod
# to find the targets opening the project with
# Xcodeproj.
#
attr_accessor :user_target_uuids
def user_target_uuids
user_targets.map(&:uuid)
end
# @return [Array<Specification>] The list of the
# specifications of the target.
......
......@@ -8,11 +8,12 @@ module Pod
spec = fixture_spec('banana-lib/BananaLib.podspec')
user_project = Xcodeproj::Project.open(SpecHelper.create_sample_app_copy_from_fixture('SampleProject'))
user_target = user_project.native_targets.find { |np| np.name == 'SampleProject' }
target_definition = Podfile::TargetDefinition.new('Pods', nil)
pod_target = PodTarget.new([spec], [target_definition], config.sandbox)
umbrella = AggregateTarget.new(target_definition, config.sandbox)
umbrella.user_project = user_project
umbrella.user_target_uuids = ['UUID']
umbrella.user_target_uuids = [user_target.uuid]
umbrella.stubs(:platform).returns(Platform.new(:ios, '8.0'))
umbrella.pod_targets = [pod_target]
......@@ -23,7 +24,8 @@ module Pod
result.sandbox.should == sandbox
result.umbrella_targets.count.should == 1
umbrella_target = result.umbrella_targets.first
umbrella_target.user_target_uuids.should == ['UUID']
umbrella_target.user_targets.should == [user_target]
umbrella_target.user_target_uuids.should == [user_target.uuid]
umbrella_target.user_project.should == user_project
umbrella_target.specs.should == [spec]
umbrella_target.platform_name.should == :ios
......
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