Unverified Commit 31de1ad6 authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #7673 from CocoaPods/segiddins/precompute-pod-targets-by-config

Move computing pod targets by config to the analyzer
parents 781d5047 8ef1a584
......@@ -69,6 +69,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins)
* Improve performance of grouping pods by configuration.
[Samuel Giddins](https://github.com/segiddins)
## 1.5.0 (2018-04-04)
##### Enhancements
......
......@@ -448,7 +448,8 @@ module Pod
end
end
platform = target_definition.platform
pod_targets = filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target)
build_configurations = user_build_configurations.keys.concat(target_definition.all_whitelisted_configurations).uniq
pod_targets = filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target, build_configurations)
AggregateTarget.new(sandbox, target_definition.uses_frameworks?, user_build_configurations, archs, platform,
target_definition, client_root, user_project, user_target_uuids, pod_targets)
end
......@@ -465,13 +466,46 @@ module Pod
# @param [Hash{Podfile::TargetDefinition => Array<ResolvedSpecification>}] resolver_specs_by_target
# the resolved specifications grouped by target.
#
# @return [Array<PodTarget>] the filtered list of pod targets.
# @param [Array<String>] build_configurations
# The list of all build configurations the targets will be built for.
#
def filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target)
pod_targets.select do |pod_target|
next false unless pod_target.target_definitions.include?(target_definition)
resolver_specs_by_target[target_definition].any? { |resolver_spec| !resolver_spec.used_by_tests_only? && pod_target.specs.include?(resolver_spec.spec) }
# @return [Hash<String => Array<PodTarget>>]
# the filtered list of pod targets, grouped by build configuration.
#
def filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target, build_configurations)
pod_targets_by_build_config = Hash.new([].freeze)
build_configurations.each { |config| pod_targets_by_build_config[config] = [] }
pod_targets.each do |pod_target|
next unless pod_target.target_definitions.include?(target_definition)
next unless resolver_specs_by_target[target_definition].any? { |resolver_spec| !resolver_spec.used_by_tests_only? && pod_target.specs.include?(resolver_spec.spec) }
pod_name = pod_target.pod_name
dependencies = @podfile_dependency_cache.target_definition_dependencies(target_definition).select do |dependency|
Specification.root_name(dependency.name) == pod_name
end
build_configurations.each do |configuration_name|
whitelists = dependencies.map do |dependency|
target_definition.pod_whitelisted_for_configuration?(dependency.name, configuration_name)
end.uniq
case whitelists
when [], [true] then nil
when [false] then next
else
raise Informative, "The subspecs of `#{pod_name}` are linked to " \
"different build configurations for the `#{target_definition}` " \
'target. CocoaPods does not currently support subspecs across ' \
'different build configurations.'
end
pod_targets_by_build_config[configuration_name] << pod_target
end
end
pod_targets_by_build_config
end
# Setup the pod targets for an aggregate target. Deduplicates resulting
......
......@@ -61,10 +61,10 @@ module Pod
# @param [Pathname] client_root @see #client_root
# @param [Xcodeproj::Project] user_project @see #user_project
# @param [Array<String>] user_target_uuids @see #user_target_uuids
# @param [Array<PodTarget>] pod_targets @see #pod_targets
# @param [Array<PodTarget>] pod_targets_for_build_configuration @see #pod_targets_for_build_configuration
#
def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, target_definition,
client_root, user_project, user_target_uuids, pod_targets)
client_root, user_project, user_target_uuids, pod_targets_for_build_configuration)
super(sandbox, host_requires_frameworks, user_build_configurations, archs, platform)
raise "Can't initialize an AggregateTarget without a TargetDefinition!" if target_definition.nil?
raise "Can't initialize an AggregateTarget with an abstract TargetDefinition!" if target_definition.abstract?
......@@ -72,7 +72,8 @@ module Pod
@client_root = client_root
@user_project = user_project
@user_target_uuids = user_target_uuids
@pod_targets = pod_targets
@pod_targets_for_build_configuration = pod_targets_for_build_configuration
@pod_targets = pod_targets_for_build_configuration.values.flatten.uniq
@search_paths_aggregate_targets = []
@xcconfigs = {}
end
......@@ -157,10 +158,7 @@ module Pod
# configuration.
#
def pod_targets_for_build_configuration(build_configuration)
@pod_targets_for_build_configuration ||= {}
@pod_targets_for_build_configuration[build_configuration] ||= pod_targets.select do |pod_target|
pod_target.include_in_build_config?(target_definition, build_configuration)
end
@pod_targets_for_build_configuration[build_configuration] || []
end
# @return [Array<Specification>] The specifications used by this aggregate target.
......
......@@ -471,37 +471,6 @@ module Pod
[self, *recursive_dependent_targets, *recursive_test_dependent_targets].uniq
end
# Checks if the target should be included in the build configuration with
# the given name of a given target definition.
#
# @param [TargetDefinition] target_definition
# The target definition to check.
#
# @param [String] configuration_name
# The name of the build configuration.
#
def include_in_build_config?(target_definition, configuration_name)
key = [target_definition.label, configuration_name]
if @build_config_cache.key?(key)
return @build_config_cache[key]
end
whitelists = target_definition_dependencies(target_definition).map do |dependency|
target_definition.pod_whitelisted_for_configuration?(dependency.name, configuration_name)
end.uniq
if whitelists.empty?
@build_config_cache[key] = true
elsif whitelists.count == 1
@build_config_cache[key] = whitelists.first
else
raise Informative, "The subspecs of `#{pod_name}` are linked to " \
"different build configurations for the `#{target_definition}` " \
'target. CocoaPods does not currently support subspecs across ' \
'different build configurations.'
end
end
# Checks if warnings should be inhibited for this pod.
#
# @return [Bool]
......@@ -597,20 +566,6 @@ module Pod
private
# @param [TargetDefinition] target_definition
# The target definition to check.
#
# @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)
target_definition.dependencies.select do |dependency|
Specification.root_name(dependency.name) == pod_name
end
end
def create_build_settings
BuildSettings::PodTargetSettings.new(self, false)
end
......
......@@ -150,7 +150,7 @@ def fixture_aggregate_target(pod_targets = [], host_requires_frameworks = false,
archs = [], platform = Pod::Platform.new(:ios, '6.0'), target_definition = nil)
target_definition ||= pod_targets.flat_map(&:target_definitions).first || fixture_target_definition
Pod::AggregateTarget.new(config.sandbox, host_requires_frameworks, user_build_configurations, archs, platform,
target_definition, config.sandbox.root.dirname, nil, nil, pod_targets)
target_definition, config.sandbox.root.dirname, nil, nil, 'Release' => pod_targets)
end
#-----------------------------------------------------------------------------#
......
......@@ -701,32 +701,83 @@ module Pod
#-------------------------------------------------------------------------#
it 'does include pod target if any spec is not used by tests only and is part of target definition' do
spec1 = Resolver::ResolverSpecification.new(stub, false, nil)
spec2 = Resolver::ResolverSpecification.new(stub, true, nil)
target_definition = stub
pod_target = stub(:name => 'Pod1', :target_definitions => [target_definition], :specs => [spec1.spec, spec2.spec])
resolver_specs_by_target = { target_definition => [spec1, spec2] }
@analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target).should == [pod_target]
end
describe '#filter_pod_targets_for_target_definition' do
it 'does include pod target if any spec is not used by tests only and is part of target definition' do
spec1 = Resolver::ResolverSpecification.new(stub, false, nil)
spec2 = Resolver::ResolverSpecification.new(stub, true, nil)
target_definition = @podfile.target_definitions['SampleProject']
pod_target = stub(:name => 'Pod1', :target_definitions => [target_definition], :specs => [spec1.spec, spec2.spec], :pod_name => 'Pod1')
resolver_specs_by_target = { target_definition => [spec1, spec2] }
@analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target, %w(Release)).should == { 'Release' => [pod_target] }
end
it 'does not include pod target if its used by tests only' do
spec1 = Resolver::ResolverSpecification.new(stub, true, nil)
spec2 = Resolver::ResolverSpecification.new(stub, true, nil)
target_definition = stub('TargetDefinition')
pod_target = stub(:name => 'Pod1', :target_definitions => [target_definition], :specs => [spec1.spec, spec2.spec])
resolver_specs_by_target = { target_definition => [spec1, spec2] }
@analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target).should.be.empty
end
it 'does not include pod target if its used by tests only' do
spec1 = Resolver::ResolverSpecification.new(stub, true, nil)
spec2 = Resolver::ResolverSpecification.new(stub, true, nil)
target_definition = stub('TargetDefinition')
pod_target = stub(:name => 'Pod1', :target_definitions => [target_definition], :specs => [spec1.spec, spec2.spec])
resolver_specs_by_target = { target_definition => [spec1, spec2] }
@analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target, %w(Release)).should == { 'Release' => [] }
end
it 'does not include pod target if its not part of the target definition' do
spec = Resolver::ResolverSpecification.new(stub, false, nil)
target_definition = stub
pod_target = stub(:name => 'Pod1', :target_definitions => [], :specs => [spec.spec])
resolver_specs_by_target = { target_definition => [spec] }
@analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target, %w(Release)).should == { 'Release' => [] }
end
it 'returns whether it is whitelisted in a build configuration' do
target_definition = @podfile.target_definitions['SampleProject']
target_definition.whitelist_pod_for_configuration('JSONKit', 'Debug')
it 'does not include pod target if its not part of the target definition' do
spec = Resolver::ResolverSpecification.new(stub, false, nil)
target_definition = stub
pod_target = stub(:name => 'Pod1', :target_definitions => [], :specs => [spec.spec])
resolver_specs_by_target = { target_definition => [spec] }
@analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target).should.be.empty
aggregate_target = @analyzer.analyze.targets.find { |t| t.target_definition == target_definition }
aggregate_target.pod_targets_for_build_configuration('Debug').map(&:name).
should.include 'JSONKit'
aggregate_target.pod_targets_for_build_configuration('Release').map(&:name).
should.not.include 'JSONKit'
end
it 'allows a pod that is a dependency for other pods to be whitelisted' do
@podfile = Podfile.new do
platform :ios, '8.0'
project 'SampleProject/SampleProject'
target 'SampleProject' do
pod 'AFNetworking', :configuration => 'Debug'
pod 'AFNetworkActivityLogger'
end
end
@analyzer = Installer::Analyzer.new(config.sandbox, @podfile)
target_definition = @podfile.target_definitions['SampleProject']
aggregate_target = @analyzer.analyze.targets.find { |t| t.target_definition == target_definition }
aggregate_target.pod_targets_for_build_configuration('Debug').map(&:name).
should.include 'AFNetworking'
aggregate_target.pod_targets_for_build_configuration('Release').map(&:name).
should.not.include 'AFNetworking'
end
it 'raises if a Pod is whitelisted for different build configurations' do
@podfile = Podfile.new do
platform :ios, '8.0'
project 'SampleProject/SampleProject'
target 'SampleProject' do
pod 'AFNetworking'
pod 'AFNetworking/NSURLConnection', :configuration => 'Debug'
pod 'AFNetworkActivityLogger'
end
end
@analyzer = Installer::Analyzer.new(config.sandbox, @podfile)
should.raise(Informative) do
@analyzer.analyze
end.message.should.include 'The subspecs of `AFNetworking` are linked to different build configurations for the `Pods-SampleProject` target. CocoaPods does not currently support subspecs across different build configurations.'
end
end
#-------------------------------------------------------------------------#
describe 'extension targets' do
before do
SpecHelper.create_sample_app_copy_from_fixture('Sample Extensions Project')
......
......@@ -11,7 +11,7 @@ module Pod
user_target = user_project.native_targets.find { |np| np.name == 'SampleProject' }
target_definition = fixture_target_definition
pod_target = PodTarget.new(sandbox, false, {}, [], Platform.ios, [spec], [target_definition], nil)
umbrella = AggregateTarget.new(sandbox, false, {}, [], Platform.ios, target_definition, config.sandbox.root.dirname, user_project, [user_target.uuid], [pod_target])
umbrella = AggregateTarget.new(sandbox, false, {}, [], Platform.ios, target_definition, config.sandbox.root.dirname, user_project, [user_target.uuid], 'Release' => [pod_target])
umbrella.stubs(:platform).returns(Platform.new(:ios, '8.0'))
result = Installer::PostInstallHooksContext.generate(sandbox, [umbrella])
......
......@@ -9,7 +9,7 @@ module Pod
@target = @project.targets.first
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.abstract = false
@pod_bundle = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, target_definition, project_path.dirname, @project, [@target.uuid], [])
@pod_bundle = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, target_definition, project_path.dirname, @project, [@target.uuid], {})
configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
)
......
......@@ -15,7 +15,7 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.abstract = false
user_build_configurations = { 'Release' => :release, 'Debug' => :debug }
@pod_bundle = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, target_definition, project_path.dirname, @project, [@target.uuid], [])
@pod_bundle = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, target_definition, project_path.dirname, @project, [@target.uuid], {})
@pod_bundle.stubs(:resource_paths_by_config).returns('Release' => %w(${PODS_ROOT}/Lib/Resources/image.png))
@pod_bundle.stubs(:framework_paths_by_config).returns('Release' => [{ :input_path => '${PODS_BUILD_DIR}/Lib/Lib.framework' }])
configuration = Xcodeproj::Config.new(
......
......@@ -18,8 +18,8 @@ module Pod
config.sandbox.project = Project.new(config.sandbox.project_path)
config.sandbox.project.save
user_build_configurations = { 'Release' => :release, 'Debug' => :debug }
@target = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, @podfile.target_definitions['SampleProject'], sample_project_path.dirname, Xcodeproj::Project.open(@sample_project_path), ['A346496C14F9BE9A0080D870'], [])
@empty_library = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, @podfile.target_definitions[:empty], sample_project_path.dirname, @target.user_project, ['C0C495321B9E5C47004F9854'], [])
@target = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, @podfile.target_definitions['SampleProject'], sample_project_path.dirname, Xcodeproj::Project.open(@sample_project_path), ['A346496C14F9BE9A0080D870'], {})
@empty_library = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.ios, @podfile.target_definitions[:empty], sample_project_path.dirname, @target.user_project, ['C0C495321B9E5C47004F9854'], {})
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target, @empty_library])
end
......
......@@ -28,7 +28,8 @@ module Pod
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])
@target = AggregateTarget.new(config.sandbox, false, user_build_configurations, [], Platform.new(:ios, '6.0'), @target_definition, config.sandbox.root.dirname, nil, nil, [@pod_target])
pod_targets_by_config = Hash[user_build_configurations.each_key.map { |c| [c, [@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_targets_by_config)
@installer = AggregateTargetInstaller.new(config.sandbox, @project, @target)
@spec.prefix_header_contents = '#import "BlocksKit.h"'
end
......
......@@ -325,7 +325,7 @@ module Pod
target = AggregateTarget.new(config.sandbox, false,
{ 'App Store' => :release, 'Debug' => :debug, 'Release' => :release, 'Test' => :debug },
[], Platform.new(:ios, '6.0'), fixture_target_definition,
config.sandbox.root.dirname, proj, nil, [])
config.sandbox.root.dirname, proj, nil, {})
target.stubs(:user_targets).returns([user_target])
......
......@@ -421,7 +421,7 @@ module Pod
end
it 'deletes the target support file dirs of the removed aggregate targets' do
aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, fixture_target_definition('MyApp'), config.sandbox.root.dirname, nil, nil, [])
aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, fixture_target_definition('MyApp'), config.sandbox.root.dirname, nil, nil, {})
@installer.stubs(:aggregate_targets).returns([aggregate_target])
FileUtils.mkdir_p(config.sandbox.target_support_files_root)
FileUtils.mkdir_p(@installer.aggregate_targets.first.support_files_dir)
......@@ -434,7 +434,7 @@ module Pod
end
it 'does not delete the target support file dirs for non removed aggregate targets' do
aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, fixture_target_definition('MyApp'), config.sandbox.root.dirname, nil, nil, [])
aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, fixture_target_definition('MyApp'), config.sandbox.root.dirname, nil, nil, {})
@installer.stubs(:aggregate_targets).returns([aggregate_target])
FileUtils.mkdir_p(config.sandbox.target_support_files_root)
FileUtils.mkdir_p(@installer.aggregate_targets.first.support_files_dir)
......@@ -638,7 +638,7 @@ module Pod
describe 'Integrating client projects' do
it 'integrates the client projects' do
target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, fixture_target_definition, config.sandbox.root.dirname, nil, nil, [])
target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, fixture_target_definition, config.sandbox.root.dirname, nil, nil, {})
@installer.stubs(:aggregate_targets).returns([target])
Installer::UserProjectIntegrator.any_instance.expects(:integrate!)
@installer.send(:integrate_user_project)
......
......@@ -5,7 +5,7 @@ module Pod
describe 'In general' do
before do
@target_definition = fixture_target_definition
@lib = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, nil, nil, [])
@lib = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, nil, nil, {})
end
it 'returns the target_definition that generated it' do
......@@ -28,7 +28,7 @@ module Pod
describe 'Support files' do
before do
@target_definition = fixture_target_definition
@lib = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, nil, nil, [])
@lib = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, nil, nil, {})
end
it 'returns the absolute path of the xcconfig file' do
......
......@@ -7,7 +7,7 @@ module Pod
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.abstract = false
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, Xcodeproj::Project.open(project_path), ['A346496C14F9BE9A0080D870'], [])
@target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, Xcodeproj::Project.open(project_path), ['A346496C14F9BE9A0080D870'], {})
end
it 'returns the target_definition that generated it' do
......@@ -41,7 +41,7 @@ module Pod
before do
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.abstract = false
@target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, nil, nil, [])
@target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, nil, nil, {})
end
it 'returns the absolute path of the xcconfig file' do
......@@ -88,14 +88,14 @@ module Pod
@target_definition.abstract = false
@target_definition.set_platform(:ios, '10.0')
@pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@spec], [@target_definition])
@target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, nil, nil, [@pod_target])
@target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @target_definition, config.sandbox.root.dirname, nil, nil, 'Release' => [@pod_target], 'Debug' => [@pod_target])
end
describe 'with configuration dependent pod targets' do
before do
@pod_target_release = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@spec], [@target_definition])
@pod_target_release.expects(:include_in_build_config?).with(@target_definition, 'Debug').returns(false)
@pod_target_release.expects(:include_in_build_config?).with(@target_definition, 'Release').returns(true)
@target.stubs(:pod_targets_for_build_configuration).with('Debug').returns([@pod_target])
@target.stubs(:pod_targets_for_build_configuration).with('Release').returns([@pod_target, @pod_target_release])
@target.stubs(:pod_targets).returns([@pod_target, @pod_target_release])
@target.stubs(:user_build_configurations).returns('Debug' => :debug, 'Release' => :release)
end
......@@ -161,10 +161,10 @@ module Pod
it 'returns non vendored frameworks by config with different release and debug targets' do
@pod_target_release.stubs(:should_build?).returns(true)
@pod_target_release.stubs(:requires_frameworks?).returns(true)
@pod_target_release.expects(:include_in_build_config?).with(@target_definition, 'Debug').returns(false)
@pod_target_release.expects(:include_in_build_config?).with(@target_definition, 'Release').returns(true)
@pod_target.stubs(:should_build?).returns(true)
@pod_target.stubs(:requires_frameworks?).returns(true)
@target.stubs(:pod_targets_for_build_configuration).with('Debug').returns([@pod_target])
@target.stubs(:pod_targets_for_build_configuration).with('Release').returns([@pod_target, @pod_target_release])
@target.stubs(:pod_targets).returns([@pod_target, @pod_target_release])
framework_paths_by_config = @target.framework_paths_by_config
framework_paths_by_config['Debug'].should == [
......@@ -244,7 +244,7 @@ module Pod
describe 'With libraries' do
before do
@pod_target = fixture_pod_target('banana-lib/BananaLib.podspec')
@target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @pod_target.target_definitions.first, config.sandbox.root.dirname, nil, nil, [@pod_target])
@target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, @pod_target.target_definitions.first, config.sandbox.root.dirname, nil, nil, 'Release' => [@pod_target], 'Debug' => [@pod_target])
end
it 'returns that it does not use swift' do
......@@ -308,7 +308,7 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.abstract = false
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target = AggregateTarget.new(config.sandbox, true, {}, [], Platform.ios, target_definition, config.sandbox.root.dirname, Xcodeproj::Project.open(project_path), ['A346496C14F9BE9A0080D870'], [@pod_target])
@target = AggregateTarget.new(config.sandbox, true, {}, [], Platform.ios, target_definition, config.sandbox.root.dirname, Xcodeproj::Project.open(project_path), ['A346496C14F9BE9A0080D870'], 'Release' => [@pod_target], 'Debug' => [@pod_target])
end
it 'requires a host target for app extension targets' do
......@@ -368,7 +368,7 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.abstract = false
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target = AggregateTarget.new(config.sandbox, true, {}, [], Platform.ios, target_definition, config.sandbox.root.dirname, Xcodeproj::Project.open(project_path), ['A346496C14F9BE9A0080D870'], [@pod_target])
@target = AggregateTarget.new(config.sandbox, true, {}, [], Platform.ios, target_definition, config.sandbox.root.dirname, Xcodeproj::Project.open(project_path), ['A346496C14F9BE9A0080D870'], 'Release' => [@pod_target], 'Debug' => [@pod_target])
end
it 'is a library target if the user_target is a framework' do
......@@ -400,7 +400,7 @@ module Pod
describe 'With frameworks' do
before do
@pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec', true, {}, [], Platform.ios, [fixture_target_definition('iOS Example')])
@target = AggregateTarget.new(config.sandbox, true, {}, [], Platform.ios, @pod_target.target_definitions.first, config.sandbox.root.dirname, nil, nil, [@pod_target])
@target = AggregateTarget.new(config.sandbox, true, {}, [], Platform.ios, @pod_target.target_definitions.first, config.sandbox.root.dirname, nil, nil, 'Release' => [@pod_target])
end
it 'returns that it uses swift' do
......
......@@ -223,7 +223,7 @@ module Pod
)
pod_target.stubs(:build_settings => PodTargetSettings.new(pod_target, false))
aggregate_target = fixture_aggregate_target([pod_target])
@generator = AggregateTargetSettings.new(aggregate_target, 'Debug')
@generator = AggregateTargetSettings.new(aggregate_target, 'Release')
@generator.other_ldflags.should == %w(-ObjC -l"PodTarget" -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "StaticFramework" -framework "VendoredFramework" -framework "XCTest")
end
end
......@@ -452,7 +452,7 @@ module Pod
)
pod_target.stubs(:build_settings => PodTargetSettings.new(pod_target, false))
aggregate_target = fixture_aggregate_target([pod_target])
@generator = AggregateTargetSettings.new(aggregate_target, 'Debug')
@generator = AggregateTargetSettings.new(aggregate_target, 'Release')
@generator.other_ldflags.should == %w(-ObjC -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "PodTarget" -framework "VendoredFramework" -framework "XCTest")
end
......@@ -494,7 +494,7 @@ module Pod
)
pod_target.stubs(:build_settings => PodTargetSettings.new(pod_target, false))
aggregate_target = fixture_aggregate_target([pod_target])
@generator = AggregateTargetSettings.new(aggregate_target, 'Debug')
@generator = AggregateTargetSettings.new(aggregate_target, 'Release')
@generator.other_ldflags.should == %w(-ObjC -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "PodTarget" -framework "StaticFramework" -framework "VendoredFramework" -framework "XCTest")
end
end
......
......@@ -71,28 +71,6 @@ module Pod
@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?(@target_definition, 'Debug').should.be.true
@pod_target.include_in_build_config?(@target_definition, '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?(@target_definition, 'Debug').should.be.true
@pod_target.include_in_build_config?(@target_definition, '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')
message = should.raise Informative do
@pod_target.include_in_build_config?(@target_definition, 'release').should.be.true
end.message
message.should.match /subspecs across different build configurations/
end
it 'builds a pod target if there are actual source files' do
fa = Sandbox::FileAccessor.new(nil, @pod_target)
fa.stubs(:source_files).returns([Pathname.new('foo.m')])
......
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