Unverified Commit 1ea280a7 authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #7612 from dnkoutso/target_installer_project

Pass project into target installer instead of deriving it
parents 4a4a8fe4 d2209fa1
...@@ -171,12 +171,12 @@ module Pod ...@@ -171,12 +171,12 @@ module Pod
end.compact.group_by(&:dirname) end.compact.group_by(&:dirname)
pod_targets.sort_by(&:name).each do |pod_target| pod_targets.sort_by(&:name).each do |pod_target|
target_installer = PodTargetInstaller.new(sandbox, pod_target, umbrella_headers_by_dir) target_installer = PodTargetInstaller.new(sandbox, project, pod_target, umbrella_headers_by_dir)
target_installer.install! target_installer.install!
end end
aggregate_targets.sort_by(&:name).each do |target| aggregate_targets.sort_by(&:name).each do |target|
target_installer = AggregateTargetInstaller.new(sandbox, target) target_installer = AggregateTargetInstaller.new(sandbox, project, target)
target_installer.install! target_installer.install!
end end
......
...@@ -14,11 +14,12 @@ module Pod ...@@ -14,11 +14,12 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Sandbox] sandbox @see TargetInstaller#sandbox # @param [Sandbox] sandbox @see TargetInstaller#sandbox
# @param [Pod::Project] project @see TargetInstaller#project
# @param [Target] target @see TargetInstaller#target # @param [Target] target @see TargetInstaller#target
# @param [Hash{Pathname => Pathname}] umbrella_headers_by_dir @see #umbrella_headers_by_dir # @param [Hash{Pathname => Pathname}] umbrella_headers_by_dir @see #umbrella_headers_by_dir
# #
def initialize(sandbox, target, umbrella_headers_by_dir = nil) def initialize(sandbox, project, target, umbrella_headers_by_dir = nil)
super(sandbox, target) super(sandbox, project, target)
@umbrella_headers_by_dir = umbrella_headers_by_dir @umbrella_headers_by_dir = umbrella_headers_by_dir
end end
......
...@@ -12,6 +12,11 @@ module Pod ...@@ -12,6 +12,11 @@ module Pod
# #
attr_reader :sandbox attr_reader :sandbox
# @return [Pod::Project]
# The `Pods/Pods.xcodeproj` to install the target into.
#
attr_reader :project
# @return [Target] target # @return [Target] target
# The library whose target needs to be generated. # The library whose target needs to be generated.
# #
...@@ -20,10 +25,12 @@ module Pod ...@@ -20,10 +25,12 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Sandbox] sandbox @see #sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Pod::Project] project @see #project
# @param [Target] target @see #target # @param [Target] target @see #target
# #
def initialize(sandbox, target) def initialize(sandbox, project, target)
@sandbox = sandbox @sandbox = sandbox
@project = project
@target = target @target = target
end end
...@@ -236,12 +243,6 @@ module Pod ...@@ -236,12 +243,6 @@ module Pod
# @!group Private helpers. # @!group Private helpers.
# @return [Project] the Pods project of the sandbox.
#
def project
sandbox.project
end
# @return [PBXGroup] the group where the file references to the support # @return [PBXGroup] the group where the file references to the support
# files should be stored. # files should be stored.
# #
......
...@@ -29,7 +29,7 @@ module Pod ...@@ -29,7 +29,7 @@ module Pod
user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug } user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
@pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), [@spec], [@target_definition], [file_accessor]) @pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), [@spec], [@target_definition], [file_accessor])
@target = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), @target_definition, config.sandbox.root.dirname, nil, nil, [@pod_target]) @target = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), @target_definition, config.sandbox.root.dirname, nil, nil, [@pod_target])
@installer = AggregateTargetInstaller.new(config.sandbox, @target) @installer = AggregateTargetInstaller.new(config.sandbox, @project, @target)
@spec.prefix_header_contents = '#import "BlocksKit.h"' @spec.prefix_header_contents = '#import "BlocksKit.h"'
end end
......
...@@ -31,7 +31,7 @@ module Pod ...@@ -31,7 +31,7 @@ module Pod
user_build_configurations = { 'Debug' => :debug, 'Release' => :release } user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '4.3'), [@spec], [@target_definition], [file_accessor]) @pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '4.3'), [@spec], [@target_definition], [file_accessor])
@installer = PodTargetInstaller.new(config.sandbox, @pod_target) @installer = PodTargetInstaller.new(config.sandbox, @project, @pod_target)
@spec.prefix_header_contents = '#import "BlocksKit.h"' @spec.prefix_header_contents = '#import "BlocksKit.h"'
end end
...@@ -176,9 +176,9 @@ module Pod ...@@ -176,9 +176,9 @@ module Pod
all_specs = [@coconut_spec, *@coconut_spec.recursive_subspecs] all_specs = [@coconut_spec, *@coconut_spec.recursive_subspecs]
file_accessors = [file_accessor, test_file_accessor] file_accessors = [file_accessor, test_file_accessor]
@coconut_pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), all_specs, [@target_definition], file_accessors) @coconut_pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), all_specs, [@target_definition], file_accessors)
@installer = PodTargetInstaller.new(config.sandbox, @coconut_pod_target) @installer = PodTargetInstaller.new(config.sandbox, @project, @coconut_pod_target)
@coconut_pod_target2 = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:osx, '10.8'), all_specs, [@target_definition2], file_accessors) @coconut_pod_target2 = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:osx, '10.8'), all_specs, [@target_definition2], file_accessors)
@installer2 = PodTargetInstaller.new(config.sandbox, @coconut_pod_target2) @installer2 = PodTargetInstaller.new(config.sandbox, @project, @coconut_pod_target2)
end end
it 'adds the native test target to the project for iOS targets with code signing' do it 'adds the native test target to the project for iOS targets with code signing' do
...@@ -371,7 +371,7 @@ module Pod ...@@ -371,7 +371,7 @@ module Pod
user_build_configurations = { 'Debug' => :debug, 'Release' => :release } user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@minions_pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, [@minions_spec, *@minions_spec.recursive_subspecs], [@target_definition], [file_accessor]) @minions_pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, [@minions_spec, *@minions_spec.recursive_subspecs], [@target_definition], [file_accessor])
@installer = PodTargetInstaller.new(config.sandbox, @minions_pod_target) @installer = PodTargetInstaller.new(config.sandbox, @project, @minions_pod_target)
@first_json_file = file_accessor.source_files.find { |sf| sf.extname == '.json' } @first_json_file = file_accessor.source_files.find { |sf| sf.extname == '.json' }
end end
...@@ -482,7 +482,7 @@ module Pod ...@@ -482,7 +482,7 @@ module Pod
user_build_configurations = { 'Debug' => :debug, 'Release' => :release } user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, [@spec], [@target_definition], [file_accessor]) @pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, [@spec], [@target_definition], [file_accessor])
@installer = PodTargetInstaller.new(config.sandbox, @pod_target) @installer = PodTargetInstaller.new(config.sandbox, @project, @pod_target)
end end
after do after do
...@@ -520,7 +520,7 @@ module Pod ...@@ -520,7 +520,7 @@ module Pod
describe 'with a scoped pod target' do describe 'with a scoped pod target' do
before do before do
@pod_target = @pod_target.scoped.first @pod_target = @pod_target.scoped.first
@installer = PodTargetInstaller.new(config.sandbox, @pod_target) @installer = PodTargetInstaller.new(config.sandbox, @project, @pod_target)
end end
it 'adds file references for the support files of the target' do it 'adds file references for the support files of the target' do
...@@ -923,7 +923,7 @@ module Pod ...@@ -923,7 +923,7 @@ module Pod
@pod_target = fixture_pod_target(@spec, false, 'Debug' => :debug, 'Release' => :release) @pod_target = fixture_pod_target(@spec, false, 'Debug' => :debug, 'Release' => :release)
@pod_target.stubs(:requires_frameworks? => true) @pod_target.stubs(:requires_frameworks? => true)
target_installer = PodTargetInstaller.new(config.sandbox, @pod_target) target_installer = PodTargetInstaller.new(config.sandbox, @project, @pod_target)
# Use a file references installer to add the files so that the correct ones are added. # Use a file references installer to add the files so that the correct ones are added.
file_ref_installer = Installer::Xcode::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [@pod_target], @project) file_ref_installer = Installer::Xcode::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [@pod_target], @project)
...@@ -981,7 +981,7 @@ module Pod ...@@ -981,7 +981,7 @@ module Pod
@project.add_pod_group('BananaLib', fixture('banana-lib')) @project.add_pod_group('BananaLib', fixture('banana-lib'))
@pod_target = fixture_pod_target(@spec, false, 'Debug' => :debug, 'Release' => :release) @pod_target = fixture_pod_target(@spec, false, 'Debug' => :debug, 'Release' => :release)
target_installer = PodTargetInstaller.new(config.sandbox, @pod_target) target_installer = PodTargetInstaller.new(config.sandbox, @project, @pod_target)
# Use a file references installer to add the files so that the correct ones are added. # Use a file references installer to add the files so that the correct ones are added.
file_ref_installer = Installer::Xcode::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [@pod_target], @project) file_ref_installer = Installer::Xcode::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [@pod_target], @project)
......
...@@ -11,7 +11,7 @@ module Pod ...@@ -11,7 +11,7 @@ module Pod
user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug } user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
archs = ['$(ARCHS_STANDARD_64_BIT)'] archs = ['$(ARCHS_STANDARD_64_BIT)']
@target = Target.new(config.sandbox, false, user_build_configurations, archs, Platform.ios) @target = Target.new(config.sandbox, false, user_build_configurations, archs, Platform.ios)
@installer = TargetInstaller.new(config.sandbox, @target) @installer = TargetInstaller.new(config.sandbox, @project, @target)
end end
it 'adds the architectures to the custom build configurations of the user target' do it 'adds the architectures to the custom build configurations of the user target' 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