Unverified Commit a55c5bee authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #7595 from dnkoutso/target_installer_specs

Fix target installer spec and target methods
parents 4d95ed04 28e92f36
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config` # `rubocop --auto-gen-config`
# on 2018-03-23 11:00:14 -0700 using RuboCop version 0.37.2. # on 2018-04-06 11:21:51 -0700 using RuboCop version 0.37.2.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
...@@ -27,20 +27,20 @@ Lint/NonLocalExitFromIterator: ...@@ -27,20 +27,20 @@ Lint/NonLocalExitFromIterator:
Exclude: Exclude:
- 'spec/unit/installer_spec.rb' - 'spec/unit/installer_spec.rb'
# Offense count: 41 # Offense count: 39
Lint/UselessAccessModifier: Lint/UselessAccessModifier:
Enabled: false Enabled: false
# Offense count: 3682 # Offense count: 3712
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes. # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# URISchemes: http, https # URISchemes: http, https
Metrics/LineLength: Metrics/LineLength:
Max: 279 Max: 279
# Offense count: 5 # Offense count: 8
# Configuration parameters: CountKeywordArgs. # Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists: Metrics/ParameterLists:
Max: 9 Max: 10
# Offense count: 5 # Offense count: 5
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -123,7 +123,7 @@ Style/IfInsideElse: ...@@ -123,7 +123,7 @@ Style/IfInsideElse:
Exclude: Exclude:
- 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb' - 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb'
# Offense count: 26 # Offense count: 28
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth. # Configuration parameters: SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets # SupportedStyles: special_inside_parentheses, consistent, align_brackets
......
...@@ -448,8 +448,9 @@ module Pod ...@@ -448,8 +448,9 @@ module Pod
archs = ['$(ARCHS_STANDARD_64_BIT)'] archs = ['$(ARCHS_STANDARD_64_BIT)']
end end
end end
platform = target_definition.platform
pod_targets = filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target) pod_targets = filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target)
AggregateTarget.new(sandbox, target_definition.uses_frameworks?, user_build_configurations, archs, AggregateTarget.new(sandbox, target_definition.uses_frameworks?, user_build_configurations, archs, platform,
target_definition, client_root, user_project, user_target_uuids, pod_targets) target_definition, client_root, user_project, user_target_uuids, pod_targets)
end end
...@@ -614,8 +615,8 @@ module Pod ...@@ -614,8 +615,8 @@ module Pod
host_requires_frameworks = target_definitions.any?(&:uses_frameworks?) host_requires_frameworks = target_definitions.any?(&:uses_frameworks?)
platform = determine_platform(specs, target_definitions, host_requires_frameworks) platform = determine_platform(specs, target_definitions, host_requires_frameworks)
file_accessors = create_file_accessors(specs, platform) file_accessors = create_file_accessors(specs, platform)
PodTarget.new(sandbox, host_requires_frameworks, user_build_configurations, archs, specs, target_definitions, PodTarget.new(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, specs,
platform, file_accessors, scope_suffix) target_definitions, file_accessors, scope_suffix)
end end
# Creates the file accessors for a given pod. # Creates the file accessors for a given pod.
......
...@@ -7,6 +7,7 @@ module Pod ...@@ -7,6 +7,7 @@ module Pod
# #
class Target class Target
DEFAULT_VERSION = '1.0.0'.freeze DEFAULT_VERSION = '1.0.0'.freeze
DEFAULT_NAME = 'Default'.freeze
# @return [Sandbox] The sandbox where the Pods should be installed. # @return [Sandbox] The sandbox where the Pods should be installed.
# #
...@@ -28,18 +29,24 @@ module Pod ...@@ -28,18 +29,24 @@ module Pod
# #
attr_reader :archs attr_reader :archs
# @return [Platform] the platform of this target.
#
attr_reader :platform
# Initialize a new target # Initialize a new target
# #
# @param [Sandbox] sandbox @see #sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Boolean] host_requires_frameworks @see #host_requires_frameworks # @param [Boolean] host_requires_frameworks @see #host_requires_frameworks
# @param [Hash{String=>Symbol}] user_build_configurations @see #user_build_configurations # @param [Hash{String=>Symbol}] user_build_configurations @see #user_build_configurations
# @param [Array<String>] archs @see #archs # @param [Array<String>] archs @see #archs
# @param [Platform] platform @see #platform
# #
def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs) def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform)
@sandbox = sandbox @sandbox = sandbox
@host_requires_frameworks = host_requires_frameworks @host_requires_frameworks = host_requires_frameworks
@user_build_configurations = user_build_configurations @user_build_configurations = user_build_configurations
@archs = archs @archs = archs
@platform = platform
end end
# @return [String] the name of the library. # @return [String] the name of the library.
...@@ -48,6 +55,38 @@ module Pod ...@@ -48,6 +55,38 @@ module Pod
label label
end end
# @return [String] the label for the target.
#
def label
DEFAULT_NAME
end
# @return [String] The version associated with this target
#
def version
DEFAULT_VERSION
end
# @return [Boolean] Whether the target uses Swift code
#
def uses_swift?
false
end
# @return [Boolean] Whether the target should build a static framework.
#
def static_framework?
false
end
# @return [String] the name to use for the source code module constructed
# for this target, and which will be used to import the module in
# implementation source files.
#
def product_module_name
c99ext_identifier(label)
end
# @return [String] the name of the product. # @return [String] the name of the product.
# #
def product_name def product_name
...@@ -110,14 +149,6 @@ module Pod ...@@ -110,14 +149,6 @@ module Pod
host_requires_frameworks? || false host_requires_frameworks? || false
end end
# @return [Boolean] Whether the target should build a static framework.
#
def static_framework?
return if is_a?(Pod::AggregateTarget)
return if specs.empty?
specs.all? { |spec| spec.root.static_framework }
end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
# @return [PBXNativeTarget] the target generated in the Pods project for # @return [PBXNativeTarget] the target generated in the Pods project for
...@@ -185,12 +216,6 @@ module Pod ...@@ -185,12 +216,6 @@ module Pod
support_files_dir + "#{label}-dummy.m" support_files_dir + "#{label}-dummy.m"
end end
# @return [String] The version associated with this target
#
def version
DEFAULT_VERSION
end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
private private
......
...@@ -56,15 +56,17 @@ module Pod ...@@ -56,15 +56,17 @@ module Pod
# @param [Boolean] host_requires_frameworks @see Target#host_requires_frameworks # @param [Boolean] host_requires_frameworks @see Target#host_requires_frameworks
# @param [Hash{String=>Symbol}] user_build_configurations @see Target#user_build_configurations # @param [Hash{String=>Symbol}] user_build_configurations @see Target#user_build_configurations
# @param [Array<String>] archs @see Target#archs # @param [Array<String>] archs @see Target#archs
# @param [Platform] platform @see #Target#platform
# @param [TargetDefinition] target_definition @see #target_definition # @param [TargetDefinition] target_definition @see #target_definition
# @param [Pathname] client_root @see #client_root # @param [Pathname] client_root @see #client_root
# @param [Xcodeproj::Project] user_project @see #user_project # @param [Xcodeproj::Project] user_project @see #user_project
# @param [Array<String>] user_target_uuids @see #user_target_uuids # @param [Array<String>] user_target_uuids @see #user_target_uuids
# @param [Array<PodTarget>] pod_targets @see #pod_targets # @param [Array<PodTarget>] pod_targets @see #pod_targets
# #
def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, target_definition, client_root, user_project, user_target_uuids, pod_targets) def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, target_definition, client_root, user_project, user_target_uuids, pod_targets)
super(sandbox, host_requires_frameworks, user_build_configurations, archs) super(sandbox, host_requires_frameworks, user_build_configurations, archs, platform)
raise "Can't initialize an AggregateTarget with an abstract TargetDefinition" if target_definition.abstract? 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?
@target_definition = target_definition @target_definition = target_definition
@client_root = client_root @client_root = client_root
@user_project = user_project @user_project = user_project
...@@ -108,20 +110,6 @@ module Pod ...@@ -108,20 +110,6 @@ module Pod
target_definition.label.to_s target_definition.label.to_s
end end
# @return [String] the name to use for the source code module constructed
# for this target, and which will be used to import the module in
# implementation source files.
#
def product_module_name
c99ext_identifier(label)
end
# @return [Platform] the platform for this target.
#
def platform
@platform ||= target_definition.platform
end
# @return [Podfile] The podfile which declares the dependency # @return [Podfile] The podfile which declares the dependency
# #
def podfile def podfile
......
...@@ -27,10 +27,6 @@ module Pod ...@@ -27,10 +27,6 @@ module Pod
# #
attr_reader :file_accessors attr_reader :file_accessors
# @return [Platform] the platform of this target.
#
attr_reader :platform
# @return [String] the suffix used for this target when deduplicated. May be `nil`. # @return [String] the suffix used for this target when deduplicated. May be `nil`.
# #
# @note This affects the value returned by #configuration_build_dir # @note This affects the value returned by #configuration_build_dir
...@@ -78,15 +74,14 @@ module Pod ...@@ -78,15 +74,14 @@ module Pod
# @param [Array<Sandbox::FileAccessor>] file_accessors @see #file_accessors # @param [Array<Sandbox::FileAccessor>] file_accessors @see #file_accessors
# @param [String] scope_suffix @see #scope_suffix # @param [String] scope_suffix @see #scope_suffix
# #
def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, specs, target_definitions, platform, file_accessors = [], scope_suffix = nil) def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, specs, target_definitions, file_accessors = [], scope_suffix = nil)
super(sandbox, host_requires_frameworks, user_build_configurations, archs) super(sandbox, host_requires_frameworks, user_build_configurations, archs, platform)
raise "Can't initialize a PodTarget without specs!" if specs.nil? || specs.empty? raise "Can't initialize a PodTarget without specs!" if specs.nil? || specs.empty?
raise "Can't initialize a PodTarget without TargetDefinition!" if target_definitions.nil? || target_definitions.empty? raise "Can't initialize a PodTarget without TargetDefinition!" if target_definitions.nil? || target_definitions.empty?
raise "Can't initialize a PodTarget with only abstract TargetDefinitions" if target_definitions.all?(&:abstract?) raise "Can't initialize a PodTarget with only abstract TargetDefinitions!" if target_definitions.all?(&:abstract?)
raise "Can't initialize a PodTarget with an empty string scope suffix!" if scope_suffix == '' raise "Can't initialize a PodTarget with an empty string scope suffix!" if scope_suffix == ''
@specs = specs.dup.freeze @specs = specs.dup.freeze
@target_definitions = target_definitions @target_definitions = target_definitions
@platform = platform
@file_accessors = file_accessors @file_accessors = file_accessors
@scope_suffix = scope_suffix @scope_suffix = scope_suffix
@test_specs, @non_test_specs = @specs.partition(&:test_specification?) @test_specs, @non_test_specs = @specs.partition(&:test_specification?)
...@@ -112,7 +107,7 @@ module Pod ...@@ -112,7 +107,7 @@ module Pod
if cache[cache_key] if cache[cache_key]
cache[cache_key] cache[cache_key]
else else
target = PodTarget.new(sandbox, host_requires_frameworks, user_build_configurations, archs, specs, [target_definition], platform, file_accessors, target_definition.label) target = PodTarget.new(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, specs, [target_definition], file_accessors, target_definition.label)
target.native_target = native_target target.native_target = native_target
target.dependent_targets = dependent_targets.flat_map { |pt| pt.scoped(cache) }.select { |pt| pt.target_definitions == [target_definition] } target.dependent_targets = dependent_targets.flat_map { |pt| pt.scoped(cache) }.select { |pt| pt.target_definitions == [target_definition] }
target.test_dependent_targets = test_dependent_targets.flat_map { |pt| pt.scoped(cache) }.select { |pt| pt.target_definitions == [target_definition] } target.test_dependent_targets = test_dependent_targets.flat_map { |pt| pt.scoped(cache) }.select { |pt| pt.target_definitions == [target_definition] }
...@@ -191,6 +186,12 @@ module Pod ...@@ -191,6 +186,12 @@ module Pod
end end
end end
# @return [Boolean] Whether the target should build a static framework.
#
def static_framework?
root_spec.static_framework
end
# @return [Boolean] Whether the target defines a "module" # @return [Boolean] Whether the target defines a "module"
# (and thus will need a module map and umbrella header). # (and thus will need a module map and umbrella header).
# #
......
...@@ -122,21 +122,27 @@ def fixture_target_definition(name = 'Pods', platform = Pod::Platform.ios) ...@@ -122,21 +122,27 @@ def fixture_target_definition(name = 'Pods', platform = Pod::Platform.ios)
Pod::Podfile::TargetDefinition.new(name, parent, 'abstract' => false, 'name' => name, 'platform' => platform_hash) Pod::Podfile::TargetDefinition.new(name, parent, 'abstract' => false, 'name' => name, 'platform' => platform_hash)
end end
def fixture_pod_target(spec_or_name, host_requires_frameworks = false, user_build_configurations = {}, target_definitions = [], platform = Pod::Platform.ios) def fixture_pod_target(spec_or_name, host_requires_frameworks = false, user_build_configurations = {}, archs = [],
platform = Pod::Platform.new(:ios, '6.0'), target_definitions = [], scope_suffix = nil)
spec = spec_or_name.is_a?(Pod::Specification) ? spec_or_name : fixture_spec(spec_or_name) spec = spec_or_name.is_a?(Pod::Specification) ? spec_or_name : fixture_spec(spec_or_name)
fixture_pod_target_with_specs([spec], host_requires_frameworks, user_build_configurations, target_definitions, platform) fixture_pod_target_with_specs([spec], host_requires_frameworks, user_build_configurations, archs, platform,
target_definitions, scope_suffix)
end end
def fixture_pod_target_with_specs(specs, host_requires_frameworks = false, user_build_configurations = {}, target_definitions = [], platform = Pod::Platform.ios) def fixture_pod_target_with_specs(specs, host_requires_frameworks = false, user_build_configurations = {}, archs = [],
platform = Pod::Platform.new(:ios, '6.0'), target_definitions = [],
scope_suffix = nil)
target_definitions << fixture_target_definition if target_definitions.empty? target_definitions << fixture_target_definition if target_definitions.empty?
target_definitions.each { |td| specs.each { |spec| td.store_pod(spec.name) } } target_definitions.each { |td| specs.each { |spec| td.store_pod(spec.name) } }
file_accessors = specs.map { |spec| fixture_file_accessor(spec, platform) } file_accessors = specs.map { |spec| fixture_file_accessor(spec, platform) }
Pod::PodTarget.new(config.sandbox, host_requires_frameworks, user_build_configurations, [], specs, target_definitions, platform, file_accessors) Pod::PodTarget.new(config.sandbox, host_requires_frameworks, user_build_configurations, archs, platform, specs,
target_definitions, file_accessors, scope_suffix)
end end
def fixture_aggregate_target(pod_targets = [], target_definition = nil) def fixture_aggregate_target(pod_targets = [], platform = Pod::Platform.new(:ios, '6.0'), target_definition = nil)
target_definition ||= pod_targets.flat_map(&:target_definitions).first || fixture_target_definition target_definition ||= pod_targets.flat_map(&:target_definitions).first || fixture_target_definition
Pod::AggregateTarget.new(config.sandbox, false, {}, [], target_definition, config.sandbox.root.dirname, nil, nil, pod_targets) Pod::AggregateTarget.new(config.sandbox, false, {}, [], platform,
target_definition, config.sandbox.root.dirname, nil, nil, pod_targets)
end end
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
......
...@@ -4,7 +4,7 @@ module Pod ...@@ -4,7 +4,7 @@ module Pod
describe Generator::ModuleMap do describe Generator::ModuleMap do
before do before do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
@pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [fixture_target_definition], nil) @pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec], [fixture_target_definition])
@gen = Generator::ModuleMap.new(@pod_target) @gen = Generator::ModuleMap.new(@pod_target)
end end
......
...@@ -9,7 +9,7 @@ module Pod ...@@ -9,7 +9,7 @@ module Pod
end end
def pod_target(spec, target_definition) def pod_target(spec, target_definition)
fixture_pod_target(spec, false, {}, [target_definition]) fixture_pod_target(spec, false, {}, [], Platform.new(:ios, '6.0'), [target_definition])
end end
before do before do
...@@ -18,7 +18,7 @@ module Pod ...@@ -18,7 +18,7 @@ module Pod
@specs.first.user_target_xcconfig = { 'OTHER_LDFLAGS' => '-no_compact_unwind' } unless @specs.empty? @specs.first.user_target_xcconfig = { 'OTHER_LDFLAGS' => '-no_compact_unwind' } unless @specs.empty?
@specs.first.pod_target_xcconfig = { 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11' } unless @specs.empty? @specs.first.pod_target_xcconfig = { 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11' } unless @specs.empty?
@pod_targets = @specs.map { |spec| pod_target(spec, @target_definition) } @pod_targets = @specs.map { |spec| pod_target(spec, @target_definition) }
@target = fixture_aggregate_target(@pod_targets, @target_definition) @target = fixture_aggregate_target(@pod_targets, Platform.new(:ios, '6.0'), @target_definition)
unless @specs.empty? unless @specs.empty?
@target.target_definition.whitelist_pod_for_configuration(@specs.first.name, 'Release') @target.target_definition.whitelist_pod_for_configuration(@specs.first.name, 'Release')
end end
...@@ -160,7 +160,7 @@ module Pod ...@@ -160,7 +160,7 @@ module Pod
describe 'with a scoped pod target' do describe 'with a scoped pod target' do
def pod_target(spec, target_definition) def pod_target(spec, target_definition)
fixture_pod_target(spec, false, {}, [target_definition]).scoped.first fixture_pod_target(spec, false, {}, [], Platform.new(:ios, '6.0'), [target_definition]).scoped.first
end end
it 'links the pod targets with the aggregate target' do it 'links the pod targets with the aggregate target' do
...@@ -255,9 +255,7 @@ module Pod ...@@ -255,9 +255,7 @@ module Pod
def pod_target(spec, target_definition) def pod_target(spec, target_definition)
target_definition = fixture_target_definition(spec.name) target_definition = fixture_target_definition(spec.name)
target_definition.stubs(:parent).returns(@target_definition.podfile) target_definition.stubs(:parent).returns(@target_definition.podfile)
fixture_pod_target(spec, [target_definition, @target_definition].uniq).tap do |pod_target| fixture_pod_target(spec, false, {}, [], Platform.new(:ios, '6.0'), [@target_definition], 'iOS')
pod_target.stubs(:scope_suffix).returns('iOS')
end
end end
it 'adds the framework build path to the xcconfig, with quotes, as framework search paths' do it 'adds the framework build path to the xcconfig, with quotes, as framework search paths' do
......
...@@ -563,7 +563,7 @@ module Pod ...@@ -563,7 +563,7 @@ module Pod
describe 'for proper other ld flags' do describe 'for proper other ld flags' do
def stub_aggregate_target(pod_targets, target_definition = nil, search_paths_aggregate_targets: []) def stub_aggregate_target(pod_targets, target_definition = nil, search_paths_aggregate_targets: [])
target_definition.stubs(:abstract? => false) unless target_definition.respond_to?(:abstract?) target_definition.stubs(:abstract? => false) unless target_definition.respond_to?(:abstract?)
fixture_aggregate_target(pod_targets, target_definition).tap do |aggregate_target| fixture_aggregate_target(pod_targets, Platform.ios, target_definition).tap do |aggregate_target|
aggregate_target.search_paths_aggregate_targets.concat(search_paths_aggregate_targets).freeze aggregate_target.search_paths_aggregate_targets.concat(search_paths_aggregate_targets).freeze
end end
end end
......
...@@ -10,8 +10,8 @@ module Pod ...@@ -10,8 +10,8 @@ module Pod
user_project = Xcodeproj::Project.open(SpecHelper.create_sample_app_copy_from_fixture('SampleProject')) user_project = Xcodeproj::Project.open(SpecHelper.create_sample_app_copy_from_fixture('SampleProject'))
user_target = user_project.native_targets.find { |np| np.name == 'SampleProject' } user_target = user_project.native_targets.find { |np| np.name == 'SampleProject' }
target_definition = fixture_target_definition target_definition = fixture_target_definition
pod_target = PodTarget.new(sandbox, false, {}, [], [spec], [target_definition], nil) pod_target = PodTarget.new(sandbox, false, {}, [], Platform.ios, [spec], [target_definition], nil)
umbrella = AggregateTarget.new(sandbox, false, {}, [], 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], [pod_target])
umbrella.stubs(:platform).returns(Platform.new(:ios, '8.0')) umbrella.stubs(:platform).returns(Platform.new(:ios, '8.0'))
result = Installer::PostInstallHooksContext.generate(sandbox, [umbrella]) result = Installer::PostInstallHooksContext.generate(sandbox, [umbrella])
......
...@@ -9,7 +9,7 @@ module Pod ...@@ -9,7 +9,7 @@ module Pod
@target = @project.targets.first @target = @project.targets.first
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.abstract = false target_definition.abstract = false
@pod_bundle = AggregateTarget.new(config.sandbox, false, {}, [], 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( configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
) )
......
...@@ -14,7 +14,8 @@ module Pod ...@@ -14,7 +14,8 @@ module Pod
@target = @project.targets.first @target = @project.targets.first
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.abstract = false target_definition.abstract = false
@pod_bundle = AggregateTarget.new(config.sandbox, false, { 'Release' => :release, 'Debug' => :debug }, [], target_definition, project_path.dirname, @project, [@target.uuid], []) 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.stubs(:resource_paths_by_config).returns('Release' => %w(${PODS_ROOT}/Lib/Resources/image.png)) @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' }]) @pod_bundle.stubs(:framework_paths_by_config).returns('Release' => [{ :input_path => '${PODS_BUILD_DIR}/Lib/Lib.framework' }])
configuration = Xcodeproj::Config.new( configuration = Xcodeproj::Config.new(
......
...@@ -17,8 +17,9 @@ module Pod ...@@ -17,8 +17,9 @@ module Pod
end end
config.sandbox.project = Project.new(config.sandbox.project_path) config.sandbox.project = Project.new(config.sandbox.project_path)
config.sandbox.project.save config.sandbox.project.save
@target = AggregateTarget.new(config.sandbox, false, { 'Release' => :release, 'Debug' => :debug }, [], @podfile.target_definitions['SampleProject'], sample_project_path.dirname, Xcodeproj::Project.open(@sample_project_path), ['A346496C14F9BE9A0080D870'], []) user_build_configurations = { 'Release' => :release, 'Debug' => :debug }
@empty_library = AggregateTarget.new(config.sandbox, false, { 'Release' => :release, 'Debug' => :debug }, [], @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]) @integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target, @empty_library])
end end
......
...@@ -27,13 +27,9 @@ module Pod ...@@ -27,13 +27,9 @@ module Pod
end end
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, [], [@spec], [@target_definition], Platform.ios, [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, [], @target_definition, config.sandbox.root.dirname, nil, nil, [@pod_target])
@installer = AggregateTargetInstaller.new(config.sandbox, @target) @installer = AggregateTargetInstaller.new(config.sandbox, @target)
@spec.prefix_header_contents = '#import "BlocksKit.h"' @spec.prefix_header_contents = '#import "BlocksKit.h"'
end end
......
...@@ -196,15 +196,15 @@ module Pod ...@@ -196,15 +196,15 @@ module Pod
describe 'Private Helpers' do describe 'Private Helpers' do
describe '#file_accessors' do describe '#file_accessors' do
it 'returns the file accessors' do it 'returns the file accessors' do
pod_target_1 = PodTarget.new(config.sandbox, false, {}, [], [stub('Spec', :test_specification? => false)], [fixture_target_definition], Platform.ios, [fixture_file_accessor('banana-lib/BananaLib.podspec')]) pod_target_1 = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [stub('Spec', :test_specification? => false)], [fixture_target_definition], [fixture_file_accessor('banana-lib/BananaLib.podspec')])
pod_target_2 = PodTarget.new(config.sandbox, false, {}, [], [stub('Spec', :test_specification? => false)], [fixture_target_definition], Platform.ios, [fixture_file_accessor('banana-lib/BananaLib.podspec')]) pod_target_2 = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [stub('Spec', :test_specification? => false)], [fixture_target_definition], [fixture_file_accessor('banana-lib/BananaLib.podspec')])
installer = FileReferencesInstaller.new(config.sandbox, [pod_target_1, pod_target_2], @project) installer = FileReferencesInstaller.new(config.sandbox, [pod_target_1, pod_target_2], @project)
roots = installer.send(:file_accessors).map { |fa| fa.path_list.root } roots = installer.send(:file_accessors).map { |fa| fa.path_list.root }
roots.should == [fixture('banana-lib'), fixture('banana-lib')] roots.should == [fixture('banana-lib'), fixture('banana-lib')]
end end
it 'handles pods without file accessors' do it 'handles pods without file accessors' do
pod_target_1 = PodTarget.new(config.sandbox, false, {}, [], [stub('Spec', :test_specification? => false)], [fixture_target_definition], Platform.ios, []) pod_target_1 = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [stub('Spec', :test_specification? => false)], [fixture_target_definition], [])
installer = FileReferencesInstaller.new(config.sandbox, [pod_target_1], @project) installer = FileReferencesInstaller.new(config.sandbox, [pod_target_1], @project)
installer.send(:file_accessors).should == [] installer.send(:file_accessors).should == []
end end
......
...@@ -30,7 +30,7 @@ module Pod ...@@ -30,7 +30,7 @@ module Pod
end end
user_build_configurations = { 'Debug' => :debug, 'Release' => :release } user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], [@spec], [@target_definition], Platform.new(:ios, '4.3'), [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, @pod_target)
@spec.prefix_header_contents = '#import "BlocksKit.h"' @spec.prefix_header_contents = '#import "BlocksKit.h"'
...@@ -175,9 +175,9 @@ module Pod ...@@ -175,9 +175,9 @@ module Pod
user_build_configurations = { 'Debug' => :debug, 'Release' => :release } user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
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, [], all_specs, [@target_definition], Platform.new(:ios, '6.0'), 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, @coconut_pod_target)
@coconut_pod_target2 = PodTarget.new(config.sandbox, false, user_build_configurations, [], all_specs, [@target_definition2], Platform.new(:osx, '10.8'), 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, @coconut_pod_target2)
end end
...@@ -369,7 +369,8 @@ module Pod ...@@ -369,7 +369,8 @@ module Pod
@project.add_file_reference(file, group) if file.fnmatch?('*.m') || file.fnmatch?('*.h') @project.add_file_reference(file, group) if file.fnmatch?('*.m') || file.fnmatch?('*.h')
end end
@minions_pod_target = PodTarget.new(config.sandbox, false, { 'Debug' => :debug, 'Release' => :release }, [], [@minions_spec, *@minions_spec.recursive_subspecs], [@target_definition], Platform.ios, [file_accessor]) 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])
@installer = PodTargetInstaller.new(config.sandbox, @minions_pod_target) @installer = PodTargetInstaller.new(config.sandbox, @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' }
...@@ -479,7 +480,8 @@ module Pod ...@@ -479,7 +480,8 @@ module Pod
@project.add_file_reference(resource, group) @project.add_file_reference(resource, group)
end end
@pod_target = PodTarget.new(config.sandbox, false, { 'Debug' => :debug, 'Release' => :release }, [], [@spec], [@target_definition], Platform.ios, [file_accessor]) user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@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, @pod_target)
end end
......
...@@ -11,7 +11,7 @@ module Pod ...@@ -11,7 +11,7 @@ module Pod
@project.save @project.save
@target_definition = fixture_target_definition @target_definition = fixture_target_definition
@coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec') @coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec')
@coconut_pod_target = PodTarget.new(config.sandbox, false, {}, [], [@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition], Platform.ios) @coconut_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition])
@native_target = stub('NativeTarget', :shell_script_build_phases => [], :build_phases => [], :project => @project) @native_target = stub('NativeTarget', :shell_script_build_phases => [], :build_phases => [], :project => @project)
@test_native_target = stub('TestNativeTarget', :symbol_type => :unit_test_bundle, :build_phases => [], :shell_script_build_phases => [], :project => @project) @test_native_target = stub('TestNativeTarget', :symbol_type => :unit_test_bundle, :build_phases => [], :shell_script_build_phases => [], :project => @project)
@coconut_pod_target.stubs(:native_target).returns(@native_target) @coconut_pod_target.stubs(:native_target).returns(@native_target)
......
...@@ -6,29 +6,12 @@ module Pod ...@@ -6,29 +6,12 @@ module Pod
class PodsProjectGenerator class PodsProjectGenerator
describe TargetInstaller do describe TargetInstaller do
before do before do
@podfile = Podfile.new do
platform :ios
project 'SampleProject/SampleProject'
target 'SampleProject'
end
@target_definition = @podfile.target_definitions['SampleProject']
@project = Project.new(config.sandbox.project_path) @project = Project.new(config.sandbox.project_path)
config.sandbox.project = @project config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib'))
@spec = fixture_spec('banana-lib/BananaLib.podspec')
file_accessor = Sandbox::FileAccessor.new(path_list, @spec.consumer(:ios))
@project.add_pod_group('BananaLib', fixture('banana-lib'))
group = @project.group_for_spec('BananaLib')
file_accessor.source_files.each do |file|
@project.add_file_reference(file, group)
end
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)']
@pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, archs, [@spec], [@target_definition], Platform.ios, [file_accessor]) @target = Target.new(config.sandbox, false, user_build_configurations, archs, Platform.ios)
@installer = TargetInstaller.new(config.sandbox, @target)
@installer = TargetInstaller.new(config.sandbox, @pod_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
...@@ -48,8 +31,8 @@ module Pod ...@@ -48,8 +31,8 @@ module Pod
end end
it 'adds Swift-specific build settings to the build settings' do it 'adds Swift-specific build settings to the build settings' do
@pod_target.stubs(:requires_frameworks?).returns(true) @target.stubs(:requires_frameworks?).returns(true)
@pod_target.stubs(:uses_swift?).returns(true) @target.stubs(:uses_swift?).returns(true)
@installer.send(:add_target) @installer.send(:add_target)
@installer.send(:native_target).resolved_build_setting('SWIFT_OPTIMIZATION_LEVEL').should == { @installer.send(:native_target).resolved_build_setting('SWIFT_OPTIMIZATION_LEVEL').should == {
'Release' => '-Owholemodule', 'Release' => '-Owholemodule',
...@@ -60,8 +43,8 @@ module Pod ...@@ -60,8 +43,8 @@ module Pod
end end
it 'verify static framework is building a static library' do it 'verify static framework is building a static library' do
@pod_target.stubs(:requires_frameworks?).returns(true) @target.stubs(:requires_frameworks?).returns(true)
@pod_target.stubs(:static_framework?).returns(true) @target.stubs(:static_framework?).returns(true)
@installer.send(:add_target) @installer.send(:add_target)
@installer.send(:native_target).resolved_build_setting('MACH_O_TYPE').should == { @installer.send(:native_target).resolved_build_setting('MACH_O_TYPE').should == {
'Release' => 'staticlib', 'Release' => 'staticlib',
......
...@@ -100,10 +100,12 @@ module Pod ...@@ -100,10 +100,12 @@ module Pod
end end
it 'sets the deployment target for the whole project' do it 'sets the deployment target for the whole project' do
target_definition_osx = fixture_target_definition('OSX Target', Platform.new(:osx, '10.8')) osx_platform = Platform.new(:osx, '10.8')
target_definition_ios = fixture_target_definition('iOS Target', Platform.new(:ios, '6.0')) ios_platform = Platform.new(:ios, '6.0')
aggregate_target_osx = AggregateTarget.new(config.sandbox, false, {}, [], target_definition_osx, config.sandbox.root.dirname, nil, nil, []) target_definition_osx = fixture_target_definition('OSX Target', osx_platform)
aggregate_target_ios = AggregateTarget.new(config.sandbox, false, {}, [], target_definition_ios, config.sandbox.root.dirname, nil, nil, []) target_definition_ios = fixture_target_definition('iOS Target', ios_platform)
aggregate_target_osx = AggregateTarget.new(config.sandbox, false, {}, [], osx_platform, target_definition_osx, config.sandbox.root.dirname, nil, nil, [])
aggregate_target_ios = AggregateTarget.new(config.sandbox, false, {}, [], ios_platform, target_definition_ios, config.sandbox.root.dirname, nil, nil, [])
@generator.stubs(:aggregate_targets).returns([aggregate_target_osx, aggregate_target_ios]) @generator.stubs(:aggregate_targets).returns([aggregate_target_osx, aggregate_target_ios])
@generator.stubs(:pod_targets).returns([]) @generator.stubs(:pod_targets).returns([])
@generator.send(:prepare) @generator.send(:prepare)
...@@ -134,7 +136,7 @@ module Pod ...@@ -134,7 +136,7 @@ module Pod
target_definition.set_platform(:ios, '8.0') target_definition.set_platform(:ios, '8.0')
target_definition.abstract = false target_definition.abstract = false
target_definition.store_pod('BananaLib') target_definition.store_pod('BananaLib')
pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [target_definition], Platform.ios) pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec], [target_definition])
@generator.stubs(:aggregate_targets).returns([]) @generator.stubs(:aggregate_targets).returns([])
@generator.stubs(:pod_targets).returns([pod_target]) @generator.stubs(:pod_targets).returns([pod_target])
PodsProjectGenerator::PodTargetInstaller.any_instance.expects(:install!) PodsProjectGenerator::PodTargetInstaller.any_instance.expects(:install!)
...@@ -146,7 +148,7 @@ module Pod ...@@ -146,7 +148,7 @@ module Pod
target_definition = Podfile::TargetDefinition.new(:default, nil) target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.set_platform(:ios, '8.0') target_definition.set_platform(:ios, '8.0')
target_definition.abstract = false target_definition.abstract = false
pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [target_definition], Platform.ios) pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec], [target_definition])
@generator.stubs(:aggregate_targets).returns([]) @generator.stubs(:aggregate_targets).returns([])
@generator.stubs(:pod_targets).returns([pod_target]) @generator.stubs(:pod_targets).returns([pod_target])
PodsProjectGenerator::PodTargetInstaller.any_instance.expects(:install!).once PodsProjectGenerator::PodTargetInstaller.any_instance.expects(:install!).once
...@@ -181,8 +183,8 @@ module Pod ...@@ -181,8 +183,8 @@ module Pod
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile.root_target_definitions.first) target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile.root_target_definitions.first)
@pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [target_definition], Platform.ios) @pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec], [target_definition])
@target = AggregateTarget.new(config.sandbox, false, {}, [], 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, [@pod_target])
@mock_target = mock('PodNativeTarget') @mock_target = mock('PodNativeTarget')
mock_project = mock('PodsProject', :frameworks_group => mock('FrameworksGroup')) mock_project = mock('PodsProject', :frameworks_group => mock('FrameworksGroup'))
...@@ -266,8 +268,8 @@ module Pod ...@@ -266,8 +268,8 @@ module Pod
spec = fixture_spec('coconut-lib/CoconutLib.podspec') spec = fixture_spec('coconut-lib/CoconutLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile.root_target_definitions.first) target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile.root_target_definitions.first)
@pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec, *spec.recursive_subspecs], [target_definition], Platform.ios) @pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec, *spec.recursive_subspecs], [target_definition])
@target = AggregateTarget.new(config.sandbox, false, {}, [], 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, [@pod_target])
@mock_target = mock('PodNativeTarget') @mock_target = mock('PodNativeTarget')
...@@ -432,7 +434,7 @@ module Pod ...@@ -432,7 +434,7 @@ module Pod
proj = Xcodeproj::Project.new(tmp_directory + 'Yolo.xcodeproj', false, 1) proj = Xcodeproj::Project.new(tmp_directory + 'Yolo.xcodeproj', false, 1)
proj.save proj.save
aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], fixture_target_definition, config.sandbox.root.dirname, proj, nil, []) aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], Platform.ios, fixture_target_definition, config.sandbox.root.dirname, proj, nil, [])
@generator.stubs(:aggregate_targets).returns([aggregate_target]) @generator.stubs(:aggregate_targets).returns([aggregate_target])
@generator.send(:prepare) @generator.send(:prepare)
...@@ -469,7 +471,7 @@ module Pod ...@@ -469,7 +471,7 @@ module Pod
it 'shares test schemes' do it 'shares test schemes' do
spec = fixture_spec('coconut-lib/CoconutLib.podspec') spec = fixture_spec('coconut-lib/CoconutLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile.root_target_definitions.first) target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile.root_target_definitions.first)
pod_target = Pod::PodTarget.new(config.sandbox, false, {}, [], [spec, *spec.recursive_subspecs], [target_definition], Platform.ios) pod_target = Pod::PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec, *spec.recursive_subspecs], [target_definition])
pod_target.stubs(:should_build?).returns(true) pod_target.stubs(:should_build?).returns(true)
@generator.installation_options. @generator.installation_options.
......
...@@ -375,7 +375,7 @@ module Pod ...@@ -375,7 +375,7 @@ module Pod
@analysis_result.sandbox_state = Installer::Analyzer::SpecsState.new @analysis_result.sandbox_state = Installer::Analyzer::SpecsState.new
@spec = stub(:name => 'Spec', :test_specification? => false) @spec = stub(:name => 'Spec', :test_specification? => false)
@spec.stubs(:root => @spec) @spec.stubs(:root => @spec)
@pod_targets = [PodTarget.new(config.sandbox, false, {}, [], [@spec], [fixture_target_definition], nil)] @pod_targets = [PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@spec], [fixture_target_definition], nil)]
@installer.stubs(:analysis_result).returns(@analysis_result) @installer.stubs(:analysis_result).returns(@analysis_result)
@installer.stubs(:pod_targets).returns(@pod_targets) @installer.stubs(:pod_targets).returns(@pod_targets)
@installer.stubs(:aggregate_targets).returns([]) @installer.stubs(:aggregate_targets).returns([])
...@@ -421,7 +421,7 @@ module Pod ...@@ -421,7 +421,7 @@ module Pod
end end
it 'deletes the target support file dirs of the removed aggregate targets' do it 'deletes the target support file dirs of the removed aggregate targets' do
aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], 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]) @installer.stubs(:aggregate_targets).returns([aggregate_target])
FileUtils.mkdir_p(config.sandbox.target_support_files_root) FileUtils.mkdir_p(config.sandbox.target_support_files_root)
FileUtils.mkdir_p(@installer.aggregate_targets.first.support_files_dir) FileUtils.mkdir_p(@installer.aggregate_targets.first.support_files_dir)
...@@ -434,7 +434,7 @@ module Pod ...@@ -434,7 +434,7 @@ module Pod
end end
it 'does not delete the target support file dirs for non removed aggregate targets' do it 'does not delete the target support file dirs for non removed aggregate targets' do
aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], 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]) @installer.stubs(:aggregate_targets).returns([aggregate_target])
FileUtils.mkdir_p(config.sandbox.target_support_files_root) FileUtils.mkdir_p(config.sandbox.target_support_files_root)
FileUtils.mkdir_p(@installer.aggregate_targets.first.support_files_dir) FileUtils.mkdir_p(@installer.aggregate_targets.first.support_files_dir)
...@@ -469,7 +469,7 @@ module Pod ...@@ -469,7 +469,7 @@ module Pod
it 'correctly configures the Pod source installer' do it 'correctly configures the Pod source installer' do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [fixture_target_definition], nil) pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec], [fixture_target_definition], nil)
pod_target.stubs(:platform).returns(:ios) pod_target.stubs(:platform).returns(:ios)
@installer.stubs(:pod_targets).returns([pod_target]) @installer.stubs(:pod_targets).returns([pod_target])
@installer.instance_variable_set(:@installed_specs, []) @installer.instance_variable_set(:@installed_specs, [])
...@@ -479,7 +479,7 @@ module Pod ...@@ -479,7 +479,7 @@ module Pod
it 'maintains the list of the installed specs' do it 'maintains the list of the installed specs' do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [fixture_target_definition], nil) pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec], [fixture_target_definition], nil)
pod_target.stubs(:platform).returns(:ios) pod_target.stubs(:platform).returns(:ios)
@installer.stubs(:pod_targets).returns([pod_target, pod_target]) @installer.stubs(:pod_targets).returns([pod_target, pod_target])
@installer.instance_variable_set(:@installed_specs, []) @installer.instance_variable_set(:@installed_specs, [])
...@@ -552,7 +552,7 @@ module Pod ...@@ -552,7 +552,7 @@ module Pod
it 'raises when it attempts to install pod source with no target supporting it' do it 'raises when it attempts to install pod source with no target supporting it' do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [fixture_target_definition], nil) pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec], [fixture_target_definition], nil)
pod_target.stubs(:platform).returns(:ios) pod_target.stubs(:platform).returns(:ios)
@installer.stubs(:pod_targets).returns([pod_target]) @installer.stubs(:pod_targets).returns([pod_target])
should.raise Informative do should.raise Informative do
...@@ -563,7 +563,7 @@ module Pod ...@@ -563,7 +563,7 @@ module Pod
it 'prints a warning for installed pods that included script phases' do it 'prints a warning for installed pods that included script phases' do
spec = fixture_spec('coconut-lib/CoconutLib.podspec') spec = fixture_spec('coconut-lib/CoconutLib.podspec')
spec.test_specs.first.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' } spec.test_specs.first.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' }
pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec, *spec.test_specs], [fixture_target_definition], nil) pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec, *spec.test_specs], [fixture_target_definition], nil)
pod_target.stubs(:platform).returns(:ios) pod_target.stubs(:platform).returns(:ios)
sandbox_state = Installer::Analyzer::SpecsState.new sandbox_state = Installer::Analyzer::SpecsState.new
sandbox_state.added << 'CoconutLib' sandbox_state.added << 'CoconutLib'
...@@ -578,7 +578,7 @@ module Pod ...@@ -578,7 +578,7 @@ module Pod
it 'does not print a warning for already installed pods that include script phases' do it 'does not print a warning for already installed pods that include script phases' do
spec = fixture_spec('coconut-lib/CoconutLib.podspec') spec = fixture_spec('coconut-lib/CoconutLib.podspec')
spec.test_specs.first.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' } spec.test_specs.first.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' }
pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec, *spec.test_specs], [fixture_target_definition], nil) pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec, *spec.test_specs], [fixture_target_definition], nil)
pod_target.stubs(:platform).returns(:ios) pod_target.stubs(:platform).returns(:ios)
sandbox_state = Installer::Analyzer::SpecsState.new sandbox_state = Installer::Analyzer::SpecsState.new
sandbox_state.unchanged << 'CoconutLib' sandbox_state.unchanged << 'CoconutLib'
...@@ -638,7 +638,7 @@ module Pod ...@@ -638,7 +638,7 @@ module Pod
describe 'Integrating client projects' do describe 'Integrating client projects' do
it 'integrates the client projects' do it 'integrates the client projects' do
target = AggregateTarget.new(config.sandbox, false, {}, [], 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.stubs(:aggregate_targets).returns([target])
Installer::UserProjectIntegrator.any_instance.expects(:integrate!) Installer::UserProjectIntegrator.any_instance.expects(:integrate!)
@installer.send(:integrate_user_project) @installer.send(:integrate_user_project)
......
...@@ -5,7 +5,7 @@ module Pod ...@@ -5,7 +5,7 @@ module Pod
describe 'In general' do describe 'In general' do
before do before do
@target_definition = fixture_target_definition @target_definition = fixture_target_definition
@lib = AggregateTarget.new(config.sandbox, false, {}, [], @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 end
it 'returns the target_definition that generated it' do it 'returns the target_definition that generated it' do
...@@ -28,7 +28,7 @@ module Pod ...@@ -28,7 +28,7 @@ module Pod
describe 'Support files' do describe 'Support files' do
before do before do
@target_definition = fixture_target_definition @target_definition = fixture_target_definition
@lib = AggregateTarget.new(config.sandbox, false, {}, [], @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 end
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
......
...@@ -7,7 +7,7 @@ module Pod ...@@ -7,7 +7,7 @@ module Pod
@target_definition = Podfile::TargetDefinition.new('Pods', nil) @target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.abstract = false @target_definition.abstract = false
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj') project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target = AggregateTarget.new(config.sandbox, false, {}, [], @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 end
it 'returns the target_definition that generated it' do it 'returns the target_definition that generated it' do
...@@ -41,7 +41,7 @@ module Pod ...@@ -41,7 +41,7 @@ module Pod
before do before do
@target_definition = Podfile::TargetDefinition.new('Pods', nil) @target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.abstract = false @target_definition.abstract = false
@target = AggregateTarget.new(config.sandbox, false, {}, [], @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 end
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
...@@ -87,13 +87,13 @@ module Pod ...@@ -87,13 +87,13 @@ module Pod
@target_definition = Podfile::TargetDefinition.new('Pods', nil) @target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.abstract = false @target_definition.abstract = false
@target_definition.set_platform(:ios, '10.0') @target_definition.set_platform(:ios, '10.0')
@pod_target = PodTarget.new(config.sandbox, false, {}, [], [@spec], [@target_definition], Platform.ios) @pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@spec], [@target_definition])
@target = AggregateTarget.new(config.sandbox, false, {}, [], @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, [@pod_target])
end end
describe 'with configuration dependent pod targets' do describe 'with configuration dependent pod targets' do
before do before do
@pod_target_release = PodTarget.new(config.sandbox, false, {}, [], [@spec], [@target_definition], Platform.ios) @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, 'Debug').returns(false)
@pod_target_release.expects(:include_in_build_config?).with(@target_definition, 'Release').returns(true) @pod_target_release.expects(:include_in_build_config?).with(@target_definition, 'Release').returns(true)
@target.stubs(:pod_targets).returns([@pod_target, @pod_target_release]) @target.stubs(:pod_targets).returns([@pod_target, @pod_target_release])
...@@ -116,7 +116,7 @@ module Pod ...@@ -116,7 +116,7 @@ module Pod
describe 'frameworks by config and input output paths' do describe 'frameworks by config and input output paths' do
before do before do
@coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec') @coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec')
@pod_target_release = PodTarget.new(config.sandbox, false, {}, [], [@coconut_spec], [@target_definition], Platform.ios) @pod_target_release = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@coconut_spec], [@target_definition])
@target.stubs(:pod_targets).returns([@pod_target]) @target.stubs(:pod_targets).returns([@pod_target])
@target.stubs(:user_build_configurations).returns('Debug' => :debug, 'Release' => :release) @target.stubs(:user_build_configurations).returns('Debug' => :debug, 'Release' => :release)
end end
...@@ -244,7 +244,7 @@ module Pod ...@@ -244,7 +244,7 @@ module Pod
describe 'With libraries' do describe 'With libraries' do
before do before do
@pod_target = fixture_pod_target('banana-lib/BananaLib.podspec') @pod_target = fixture_pod_target('banana-lib/BananaLib.podspec')
@target = AggregateTarget.new(config.sandbox, false, {}, [], @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, [@pod_target])
end end
it 'returns that it does not use swift' do it 'returns that it does not use swift' do
...@@ -308,7 +308,7 @@ module Pod ...@@ -308,7 +308,7 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.abstract = false target_definition.abstract = false
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj') project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target = AggregateTarget.new(config.sandbox, true, {}, [], 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'], [@pod_target])
end end
it 'requires a host target for app extension targets' do it 'requires a host target for app extension targets' do
...@@ -368,7 +368,7 @@ module Pod ...@@ -368,7 +368,7 @@ module Pod
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.abstract = false target_definition.abstract = false
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj') project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target = AggregateTarget.new(config.sandbox, true, {}, [], 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'], [@pod_target])
end end
it 'is a library target if the user_target is a framework' do it 'is a library target if the user_target is a framework' do
...@@ -399,8 +399,8 @@ module Pod ...@@ -399,8 +399,8 @@ module Pod
describe 'With frameworks' do describe 'With frameworks' do
before do before do
@pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec', true, {}, [fixture_target_definition('iOS Example')]) @pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec', true, {}, [], Platform.ios, [fixture_target_definition('iOS Example')])
@target = AggregateTarget.new(config.sandbox, true, {}, [], @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, [@pod_target])
end end
it 'returns that it uses swift' do it 'returns that it uses swift' do
......
...@@ -6,7 +6,7 @@ module Pod ...@@ -6,7 +6,7 @@ module Pod
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
@target_definition = Podfile::TargetDefinition.new('Pods', nil) @target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target_definition.abstract = false @target_definition.abstract = false
@pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [@target_definition], Platform.ios) @pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [spec], [@target_definition])
end end
describe 'Meta' do describe 'Meta' do
...@@ -251,7 +251,7 @@ module Pod ...@@ -251,7 +251,7 @@ module Pod
@pod_target.sandbox.public_headers.add_search_path('BananaLib', Platform.ios) @pod_target.sandbox.public_headers.add_search_path('BananaLib', Platform.ios)
@pod_target.sandbox.public_headers.add_search_path('monkey', Platform.ios) @pod_target.sandbox.public_headers.add_search_path('monkey', Platform.ios)
monkey_spec = fixture_spec('monkey/monkey.podspec') monkey_spec = fixture_spec('monkey/monkey.podspec')
monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], [monkey_spec], [@target_definition], nil) monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [monkey_spec], [@target_definition])
monkey_pod_target.stubs(:platform).returns(Platform.ios) monkey_pod_target.stubs(:platform).returns(Platform.ios)
@pod_target.stubs(:dependent_targets).returns([monkey_pod_target]) @pod_target.stubs(:dependent_targets).returns([monkey_pod_target])
header_search_paths = @pod_target.header_search_paths header_search_paths = @pod_target.header_search_paths
...@@ -269,7 +269,7 @@ module Pod ...@@ -269,7 +269,7 @@ module Pod
@pod_target.sandbox.public_headers.add_search_path('BananaLib', Platform.ios) @pod_target.sandbox.public_headers.add_search_path('BananaLib', Platform.ios)
@pod_target.sandbox.public_headers.add_search_path('monkey', Platform.osx) @pod_target.sandbox.public_headers.add_search_path('monkey', Platform.osx)
monkey_spec = fixture_spec('monkey/monkey.podspec') monkey_spec = fixture_spec('monkey/monkey.podspec')
monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], [monkey_spec], [@target_definition], nil) monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [monkey_spec], [@target_definition])
monkey_pod_target.stubs(:platform).returns(Platform.ios) monkey_pod_target.stubs(:platform).returns(Platform.ios)
@pod_target.stubs(:dependent_targets).returns([monkey_pod_target]) @pod_target.stubs(:dependent_targets).returns([monkey_pod_target])
header_search_paths = @pod_target.header_search_paths header_search_paths = @pod_target.header_search_paths
...@@ -316,7 +316,7 @@ module Pod ...@@ -316,7 +316,7 @@ module Pod
@pod_target.sandbox.public_headers.add_search_path('BananaLib', Platform.ios) @pod_target.sandbox.public_headers.add_search_path('BananaLib', Platform.ios)
@pod_target.sandbox.public_headers.add_search_path('monkey', Platform.ios) @pod_target.sandbox.public_headers.add_search_path('monkey', Platform.ios)
monkey_spec = fixture_spec('monkey/monkey.podspec') monkey_spec = fixture_spec('monkey/monkey.podspec')
monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], [monkey_spec], [@target_definition], nil) monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [monkey_spec], [@target_definition])
monkey_pod_target.stubs(:platform).returns(Platform.ios) monkey_pod_target.stubs(:platform).returns(Platform.ios)
@pod_target.stubs(:dependent_targets).returns([monkey_pod_target]) @pod_target.stubs(:dependent_targets).returns([monkey_pod_target])
header_search_paths = @pod_target.header_search_paths header_search_paths = @pod_target.header_search_paths
...@@ -348,7 +348,7 @@ module Pod ...@@ -348,7 +348,7 @@ module Pod
@pod_target.sandbox.public_headers.add_search_path('BananaLib', Platform.ios) @pod_target.sandbox.public_headers.add_search_path('BananaLib', Platform.ios)
@pod_target.sandbox.public_headers.add_search_path('monkey', Platform.osx) @pod_target.sandbox.public_headers.add_search_path('monkey', Platform.osx)
monkey_spec = fixture_spec('monkey/monkey.podspec') monkey_spec = fixture_spec('monkey/monkey.podspec')
monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], [monkey_spec], [@target_definition], nil) monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [monkey_spec], [@target_definition])
monkey_pod_target.stubs(:platform).returns(Platform.ios) monkey_pod_target.stubs(:platform).returns(Platform.ios)
@pod_target.stubs(:dependent_targets).returns([monkey_pod_target]) @pod_target.stubs(:dependent_targets).returns([monkey_pod_target])
header_search_paths = @pod_target.header_search_paths header_search_paths = @pod_target.header_search_paths
...@@ -464,8 +464,8 @@ module Pod ...@@ -464,8 +464,8 @@ module Pod
describe 'With dependencies' do describe 'With dependencies' do
before do before do
@pod_dependency = fixture_pod_target('orange-framework/OrangeFramework.podspec', false, {}, @pod_target.target_definitions) @pod_dependency = fixture_pod_target('orange-framework/OrangeFramework.podspec', false, {}, [], Platform.ios, @pod_target.target_definitions)
@test_pod_dependency = fixture_pod_target('matryoshka/matryoshka.podspec', false, {}, @pod_target.target_definitions) @test_pod_dependency = fixture_pod_target('matryoshka/matryoshka.podspec', false, {}, [], Platform.ios, @pod_target.target_definitions)
@pod_target.dependent_targets = [@pod_dependency] @pod_target.dependent_targets = [@pod_dependency]
@pod_target.test_dependent_targets = [@test_pod_dependency] @pod_target.test_dependent_targets = [@test_pod_dependency]
end end
...@@ -515,7 +515,7 @@ module Pod ...@@ -515,7 +515,7 @@ module Pod
@coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec') @coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec')
@test_spec_target_definition = Podfile::TargetDefinition.new('Pods', nil) @test_spec_target_definition = Podfile::TargetDefinition.new('Pods', nil)
@test_spec_target_definition.abstract = false @test_spec_target_definition.abstract = false
@test_pod_target = PodTarget.new(config.sandbox, false, {}, [], [@coconut_spec, *@coconut_spec.recursive_subspecs], [@test_spec_target_definition], nil) @test_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@coconut_spec, *@coconut_spec.recursive_subspecs], [@test_spec_target_definition])
@test_pod_target.stubs(:platform).returns(Platform.new(:ios, '6.0')) @test_pod_target.stubs(:platform).returns(Platform.new(:ios, '6.0'))
end end
......
...@@ -4,7 +4,7 @@ module Pod ...@@ -4,7 +4,7 @@ module Pod
describe Target do describe Target do
describe '#c99ext_identifier' do describe '#c99ext_identifier' do
before do before do
@target = Target.new(config.sandbox, false, {}, []) @target = Target.new(config.sandbox, false, {}, [], Platform.ios)
end end
it 'should mask, but keep leading numbers' do it 'should mask, but keep leading numbers' 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