Unverified Commit 1f95c589 authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #7505 from dnkoutso/immutability_wins_3

More "immutability" across several classes
parents b7e195d9 f7009cf7
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config` # `rubocop --auto-gen-config`
# on 2016-06-09 08:12:30 -0500 using RuboCop version 0.37.2. # on 2018-03-23 11:00:14 -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
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
Lint/EndAlignment: Lint/EndAlignment:
Enabled: false Enabled: false
# Offense count: 11 # Offense count: 13
Lint/IneffectiveAccessModifier: Lint/IneffectiveAccessModifier:
Exclude: Exclude:
- 'lib/cocoapods/command.rb' - 'lib/cocoapods/command.rb'
...@@ -22,37 +22,25 @@ Lint/IneffectiveAccessModifier: ...@@ -22,37 +22,25 @@ Lint/IneffectiveAccessModifier:
- 'lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb' - 'lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb'
- 'lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb' - 'lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb'
# Offense count: 1 # Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect.
Lint/LiteralInInterpolation:
Exclude:
- 'Dangerfile'
# Offense count: 1
Lint/NonLocalExitFromIterator: Lint/NonLocalExitFromIterator:
Exclude: Exclude:
- 'spec/unit/installer_spec.rb' - 'spec/unit/installer_spec.rb'
# Offense count: 1 # Offense count: 41
Lint/UnreachableCode:
Exclude:
- 'Dangerfile'
# Offense count: 40
Lint/UselessAccessModifier: Lint/UselessAccessModifier:
Enabled: false Enabled: false
# Offense count: 2035 # Offense count: 3682
# 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: 1 # Offense count: 5
# Configuration parameters: CountKeywordArgs. # Configuration parameters: CountKeywordArgs.
ParameterLists: Metrics/ParameterLists:
Max: 6 Max: 9
# Offense count: 5 # Offense count: 5
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -64,13 +52,12 @@ Performance/Casecmp: ...@@ -64,13 +52,12 @@ Performance/Casecmp:
- 'lib/cocoapods/project.rb' - 'lib/cocoapods/project.rb'
- 'lib/cocoapods/sandbox/path_list.rb' - 'lib/cocoapods/sandbox/path_list.rb'
# Offense count: 3 # Offense count: 2
# Cop supports --auto-correct. # Cop supports --auto-correct.
Performance/RedundantBlockCall: Performance/RedundantBlockCall:
Exclude: Exclude:
- 'lib/cocoapods/downloader/cache.rb' - 'lib/cocoapods/downloader/cache.rb'
- 'lib/cocoapods/installer/analyzer/pod_variant_set.rb' - 'lib/cocoapods/installer/analyzer/pod_variant_set.rb'
- 'spec/unit/validator_spec.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -85,7 +72,7 @@ Performance/StringReplacement: ...@@ -85,7 +72,7 @@ Performance/StringReplacement:
Exclude: Exclude:
- 'spec/functional/command/spec_spec.rb' - 'spec/functional/command/spec_spec.rb'
# Offense count: 22 # Offense count: 25
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: prefer_alias, prefer_alias_method # SupportedStyles: prefer_alias, prefer_alias_method
...@@ -105,7 +92,6 @@ Style/Alias: ...@@ -105,7 +92,6 @@ Style/Alias:
- 'lib/cocoapods/validator.rb' - 'lib/cocoapods/validator.rb'
- 'spec/spec_helper.rb' - 'spec/spec_helper.rb'
- 'spec/spec_helper/user_interface.rb' - 'spec/spec_helper/user_interface.rb'
- 'spec/unit/validator_spec.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -115,12 +101,11 @@ Style/AlignParameters: ...@@ -115,12 +101,11 @@ Style/AlignParameters:
Exclude: Exclude:
- 'lib/cocoapods/project.rb' - 'lib/cocoapods/project.rb'
# Offense count: 6 # Offense count: 5
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: SingleLineConditionsOnly. # Configuration parameters: SingleLineConditionsOnly.
Style/ConditionalAssignment: Style/ConditionalAssignment:
Exclude: Exclude:
- 'lib/cocoapods/command/repo/push.rb'
- 'lib/cocoapods/external_sources/abstract_external_source.rb' - 'lib/cocoapods/external_sources/abstract_external_source.rb'
- 'lib/cocoapods/sandbox/file_accessor.rb' - 'lib/cocoapods/sandbox/file_accessor.rb'
- 'lib/cocoapods/sandbox/path_list.rb' - 'lib/cocoapods/sandbox/path_list.rb'
...@@ -138,28 +123,28 @@ Style/IfInsideElse: ...@@ -138,28 +123,28 @@ Style/IfInsideElse:
Exclude: Exclude:
- 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb' - 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb'
# Offense count: 24 # Offense count: 26
# 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
Style/IndentArray: Style/IndentArray:
EnforcedStyle: consistent EnforcedStyle: consistent
# Offense count: 24 # Offense count: 28
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth. # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented # SupportedStyles: aligned, indented
Style/MultilineMethodCallIndentation: Style/MultilineMethodCallIndentation:
Enabled: false Enabled: false
# Offense count: 3 # Offense count: 7
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth. # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented # SupportedStyles: aligned, indented
Style/MultilineOperationIndentation: Style/MultilineOperationIndentation:
Enabled: false Enabled: false
# Offense count: 12 # Offense count: 11
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/MutableConstant: Style/MutableConstant:
Exclude: Exclude:
...@@ -168,7 +153,6 @@ Style/MutableConstant: ...@@ -168,7 +153,6 @@ Style/MutableConstant:
- 'lib/cocoapods/generator/copy_resources_script.rb' - 'lib/cocoapods/generator/copy_resources_script.rb'
- 'lib/cocoapods/installer.rb' - 'lib/cocoapods/installer.rb'
- 'lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb' - 'lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb'
- 'lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb'
- 'lib/cocoapods/project.rb' - 'lib/cocoapods/project.rb'
- 'spec/unit/installer/user_project_integrator/target_integrator/xcconfig_integrator_spec.rb' - 'spec/unit/installer/user_project_integrator/target_integrator/xcconfig_integrator_spec.rb'
...@@ -189,7 +173,7 @@ Style/RedundantSelf: ...@@ -189,7 +173,7 @@ Style/RedundantSelf:
Exclude: Exclude:
- 'lib/cocoapods/command.rb' - 'lib/cocoapods/command.rb'
# Offense count: 13 # Offense count: 11
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed # SupportedStyles: slashes, percent_r, mixed
...@@ -201,13 +185,6 @@ Style/RegexpLiteral: ...@@ -201,13 +185,6 @@ Style/RegexpLiteral:
- 'spec/integration.rb' - 'spec/integration.rb'
- 'spec/unit/external_sources/path_source_spec.rb' - 'spec/unit/external_sources/path_source_spec.rb'
- 'spec/unit/external_sources/podspec_source_spec.rb' - 'spec/unit/external_sources/podspec_source_spec.rb'
- 'spec/unit/resolver_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAroundKeyword:
Exclude:
- 'lib/cocoapods/project.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
......
...@@ -191,11 +191,11 @@ module Pod ...@@ -191,11 +191,11 @@ module Pod
class Indenter < ::Array class Indenter < ::Array
# @return [Fixnum] The indentation level of the UI. # @return [Fixnum] The indentation level of the UI.
# #
attr_accessor :indent attr_reader :indent
# @return [IO] the {IO} to which the output should be printed. # @return [IO] the {IO} to which the output should be printed.
# #
attr_accessor :io attr_reader :io
# Init a new Indenter # Init a new Indenter
# #
......
...@@ -24,9 +24,9 @@ module Pod ...@@ -24,9 +24,9 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [String] name @see name # @param [String] name @see #name
# @param [Hash] params @see params # @param [Hash] params @see #params
# @param [String] podfile_path @see podfile_path # @param [String] podfile_path @see #podfile_path
# #
def initialize(name, params, podfile_path) def initialize(name, params, podfile_path)
@name = name @name = name
......
...@@ -15,10 +15,10 @@ module Pod ...@@ -15,10 +15,10 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Array<FileAccessor>] file_accessors # @param [Array<FileAccessor>] file_accessors
# @see file_accessors # @see #file_accessors
# #
# @param [Platform] platform # @param [Platform] platform
# @see platform # @see Header#platform
# #
def initialize(file_accessors, platform) def initialize(file_accessors, platform)
@file_accessors = file_accessors @file_accessors = file_accessors
......
...@@ -13,21 +13,20 @@ module Pod ...@@ -13,21 +13,20 @@ module Pod
# #
attr_reader :configuration_name attr_reader :configuration_name
# Initialize a new instance # @return [Xcodeproj::Config] The generated xcconfig.
# #
# @param [Target] target @see target attr_reader :xcconfig
# Initialize a new instance
# #
# @param [String] configuration_name @see configuration_name # @param [Target] target @see #target
# @param [String] configuration_name @see #configuration_name
# #
def initialize(target, configuration_name) def initialize(target, configuration_name)
@target = target @target = target
@configuration_name = configuration_name @configuration_name = configuration_name
end end
# @return [Xcodeproj::Config] The generated xcconfig.
#
attr_reader :xcconfig
# Generates and saves the xcconfig to the given path. # Generates and saves the xcconfig to the given path.
# #
# @param [Pathname] path # @param [Pathname] path
......
...@@ -12,9 +12,13 @@ module Pod ...@@ -12,9 +12,13 @@ module Pod
# #
attr_reader :target attr_reader :target
# @return [Xcodeproj::Config] The generated xcconfig.
#
attr_reader :xcconfig
# Initialize a new instance # Initialize a new instance
# #
# @param [Target] target @see target # @param [Target] target @see #target
# #
# @param [Boolean] test_xcconfig # @param [Boolean] test_xcconfig
# whether this is an xcconfig for a test native target. # whether this is an xcconfig for a test native target.
...@@ -24,10 +28,6 @@ module Pod ...@@ -24,10 +28,6 @@ module Pod
@test_xcconfig = test_xcconfig @test_xcconfig = test_xcconfig
end end
# @return [Xcodeproj::Config] The generated xcconfig.
#
attr_reader :xcconfig
# Generates and saves the xcconfig to the given path. # Generates and saves the xcconfig to the given path.
# #
# @param [Pathname] path # @param [Pathname] path
......
...@@ -61,9 +61,9 @@ module Pod ...@@ -61,9 +61,9 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Podfile] podfile @see podfile # @param [Podfile] podfile @see #podfile
# @param [Lockfile] lockfile @see lockfile # @param [Lockfile] lockfile @see #lockfile
# #
def initialize(sandbox, podfile, lockfile = nil) def initialize(sandbox, podfile, lockfile = nil)
@sandbox = sandbox @sandbox = sandbox
......
...@@ -39,10 +39,10 @@ module Pod ...@@ -39,10 +39,10 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Podfile] podfile @see podfile # @param [Podfile] podfile @see #podfile
# @param [Lockfile] lockfile @see lockfile # @param [Lockfile] lockfile @see #lockfile
# @param [Array<Source>] plugin_sources @see plugin_sources # @param [Array<Source>] plugin_sources @see #plugin_sources
# #
def initialize(sandbox, podfile, lockfile = nil, plugin_sources = nil) def initialize(sandbox, podfile, lockfile = nil, plugin_sources = nil)
@sandbox = sandbox @sandbox = sandbox
...@@ -430,29 +430,27 @@ module Pod ...@@ -430,29 +430,27 @@ module Pod
# @return [AggregateTarget] # @return [AggregateTarget]
# #
def generate_target(target_definition, pod_targets, resolver_specs_by_target) def generate_target(target_definition, pod_targets, resolver_specs_by_target)
target = AggregateTarget.new(target_definition, sandbox)
target.host_requires_frameworks |= target_definition.uses_frameworks?
if installation_options.integrate_targets? if installation_options.integrate_targets?
target_inspection = result.target_inspections[target_definition] target_inspection = result.target_inspections[target_definition]
raise "missing inspection: #{target_definition.name}" unless target_inspection raise "missing inspection: #{target_definition.name}" unless target_inspection
target.user_project = target_inspection.project user_project = target_inspection.project
target.client_root = target.user_project_path.dirname.realpath client_root = user_project.path.dirname.realpath
target.user_target_uuids = target_inspection.project_target_uuids user_target_uuids = target_inspection.project_target_uuids
target.user_build_configurations = target_inspection.build_configurations user_build_configurations = target_inspection.build_configurations
target.archs = target_inspection.archs archs = target_inspection.archs
else else
target.client_root = config.installation_root.realpath user_project = nil
target.user_target_uuids = [] client_root = config.installation_root.realpath
target.user_build_configurations = target_definition.build_configurations || { 'Release' => :release, 'Debug' => :debug } user_target_uuids = []
user_build_configurations = target_definition.build_configurations || { 'Release' => :release, 'Debug' => :debug }
archs = []
if target_definition.platform && target_definition.platform.name == :osx if target_definition.platform && target_definition.platform.name == :osx
target.archs = '$(ARCHS_STANDARD_64_BIT)' archs = ['$(ARCHS_STANDARD_64_BIT)']
end end
end end
pod_targets = filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target)
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,
target_definition, client_root, user_project, user_target_uuids, pod_targets)
target
end end
# Returns a filtered list of pod targets that should or should not be part of the target definition. Pod targets # Returns a filtered list of pod targets that should or should not be part of the target definition. Pod targets
...@@ -602,21 +600,19 @@ module Pod ...@@ -602,21 +600,19 @@ module Pod
# @return [PodTarget] # @return [PodTarget]
# #
def generate_pod_target(target_definitions, pod_specs, scope_suffix: nil) def generate_pod_target(target_definitions, pod_specs, scope_suffix: nil)
pod_target = PodTarget.new(pod_specs, target_definitions, sandbox, scope_suffix)
pod_target.host_requires_frameworks = target_definitions.any?(&:uses_frameworks?)
if installation_options.integrate_targets? if installation_options.integrate_targets?
target_inspections = result.target_inspections.select { |t, _| target_definitions.include?(t) }.values target_inspections = result.target_inspections.select { |t, _| target_definitions.include?(t) }.values
pod_target.user_build_configurations = target_inspections.map(&:build_configurations).reduce({}, &:merge) user_build_configurations = target_inspections.map(&:build_configurations).reduce({}, &:merge)
pod_target.archs = target_inspections.flat_map(&:archs).compact.uniq.sort archs = target_inspections.flat_map(&:archs).compact.uniq.sort
else else
pod_target.user_build_configurations = {} user_build_configurations = {}
archs = []
if target_definitions.first.platform.name == :osx if target_definitions.first.platform.name == :osx
pod_target.archs = '$(ARCHS_STANDARD_64_BIT)' archs = ['$(ARCHS_STANDARD_64_BIT)']
end end
end end
PodTarget.new(sandbox, target_definitions.any?(&:uses_frameworks?), user_build_configurations, archs, pod_specs,
pod_target target_definitions, scope_suffix)
end end
# Generates dependencies that require the specific version of the Pods # Generates dependencies that require the specific version of the Pods
......
...@@ -53,10 +53,10 @@ module Pod ...@@ -53,10 +53,10 @@ module Pod
# Init a new SandboxAnalyzer # Init a new SandboxAnalyzer
# #
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Array<Specifications>] specs @see specs # @param [Array<Specifications>] specs @see #specs
# @param [Bool] update_mode @see update_mode # @param [Bool] update_mode @see #update_mode
# @param [Lockfile] lockfile @see lockfile # @param [Lockfile] lockfile @see #lockfile
# #
def initialize(sandbox, specs, update_mode, lockfile = nil) def initialize(sandbox, specs, update_mode, lockfile = nil)
@sandbox = sandbox @sandbox = sandbox
......
...@@ -24,9 +24,9 @@ module Pod ...@@ -24,9 +24,9 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Hash{Symbol=>Array}] specs_by_platform @see specs_by_platform # @param [Hash{Symbol=>Array}] specs_by_platform @see #specs_by_platform
# @param [Boolean] can_cache @see can_cache # @param [Boolean] can_cache @see #can_cache
# #
def initialize(sandbox, specs_by_platform, can_cache: true) def initialize(sandbox, specs_by_platform, can_cache: true)
@sandbox = sandbox @sandbox = sandbox
......
...@@ -4,22 +4,36 @@ module Pod ...@@ -4,22 +4,36 @@ module Pod
# the context of the installer. # the context of the installer.
# #
class PostInstallHooksContext class PostInstallHooksContext
# @return [String] The path to the sandbox root (`Pods` directory). # @return [Sandbox] The Sandbox for the project.
# #
attr_accessor :sandbox_root attr_reader :sandbox
# @return [Project] The Pods Xcode project. # @return [String] The path to the sandbox root (`Pods` directory).
# #
attr_accessor :pods_project attr_reader :sandbox_root
# @return [Sandbox] The Sandbox for the project. # @return [Xcodeproj::Project] The Pods Xcode project.
# #
attr_accessor :sandbox attr_reader :pods_project
# @return [Array<UmbrellaTargetDescription>] The list of # @return [Array<UmbrellaTargetDescription>] The list of
# the CocoaPods umbrella targets generated by the installer. # the CocoaPods umbrella targets generated by the installer.
# #
attr_accessor :umbrella_targets attr_reader :umbrella_targets
# Initialize a new instance
#
# @param [Sandbox] sandbox see #sandbox
# @param [String] sandbox_root see #sandbox_root
# @param [Xcodeproj::Project] pods_project see #pods_project
# @param [Array<UmbrellaTargetDescription>] umbrella_targets see #umbrella_targets
#
def initialize(sandbox, sandbox_root, pods_project, umbrella_targets)
@sandbox = sandbox
@sandbox_root = sandbox_root
@pods_project = pods_project
@umbrella_targets = umbrella_targets
end
# @return [PostInstallHooksContext] Convenience class generator method # @return [PostInstallHooksContext] Convenience class generator method
# #
...@@ -34,24 +48,17 @@ module Pod ...@@ -34,24 +48,17 @@ module Pod
# static context. # static context.
# #
def self.generate(sandbox, aggregate_targets) def self.generate(sandbox, aggregate_targets)
umbrella_targets_descriptions = [] umbrella_targets_descriptions = aggregate_targets.map do |umbrella|
aggregate_targets.each do |umbrella| user_project = umbrella.user_project
desc = UmbrellaTargetDescription.new user_targets = umbrella.user_targets
desc.user_project = umbrella.user_project specs = umbrella.specs
desc.user_targets = umbrella.user_targets platform_name = umbrella.platform.name
desc.specs = umbrella.specs platform_deployment_target = umbrella.platform.deployment_target.to_s
desc.platform_name = umbrella.platform.name cocoapods_target_label = umbrella.label
desc.platform_deployment_target = umbrella.platform.deployment_target.to_s UmbrellaTargetDescription.new(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
desc.cocoapods_target_label = umbrella.label
umbrella_targets_descriptions << desc
end end
result = new new(sandbox, sandbox.root.to_s, sandbox.project, umbrella_targets_descriptions)
result.sandbox_root = sandbox.root.to_s
result.pods_project = sandbox.project
result.sandbox = sandbox
result.umbrella_targets = umbrella_targets_descriptions
result
end end
# Pure data class which describes and umbrella target. # Pure data class which describes and umbrella target.
...@@ -60,7 +67,47 @@ module Pod ...@@ -60,7 +67,47 @@ module Pod
# @return [Xcodeproj::Project] The user project into which this target # @return [Xcodeproj::Project] The user project into which this target
# is integrated. # is integrated.
# #
attr_accessor :user_project attr_reader :user_project
# @return [Array<PBXNativeTarget>]
# The list of user targets integrated by this umbrella target.
#
attr_reader :user_targets
# @return [Array<Specification>] The list of the
# specifications of the target.
#
attr_reader :specs
# @return [Symbol] The platform (either `:ios`, `:watchos`, `:tvos`, or `:osx`).
#
attr_reader :platform_name
# @return [String] The deployment target.
#
attr_reader :platform_deployment_target
# @return [String] The label for the target.
#
attr_reader :cocoapods_target_label
# Initialize a new instance
#
# @param [Xcodeproj::Project] user_project see #user_project
# @param [Array<PBXNativeTarget>] user_targets see #user_targets
# @param [Array<Specification>] specs see #specs
# @param [Symbol] platform_name see #platform_name
# @param [String] platform_deployment_target see #platform_deployment_target
# @param [String] cocoapods_target_label see #cocoapods_target_label
#
def initialize(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
@user_project = user_project
@user_targets = user_targets
@specs = specs
@platform_name = platform_name
@platform_deployment_target = platform_deployment_target
@cocoapods_target_label = cocoapods_target_label
end
# @return [String] The path of the user project # @return [String] The path of the user project
# integrated by this target. # integrated by this target.
...@@ -69,11 +116,6 @@ module Pod ...@@ -69,11 +116,6 @@ module Pod
user_project.path if user_project user_project.path if user_project
end end
# @return [Array<PBXNativeTarget>]
# The list of user targets integrated by this umbrella target.
#
attr_accessor :user_targets
# @return [Array<String>] The list of the UUIDs of the # @return [Array<String>] The list of the UUIDs of the
# user targets integrated by this umbrella # user targets integrated by this umbrella
# target. They can be used to find the # target. They can be used to find the
...@@ -84,23 +126,6 @@ module Pod ...@@ -84,23 +126,6 @@ module Pod
def user_target_uuids def user_target_uuids
user_targets.map(&:uuid) user_targets.map(&:uuid)
end end
# @return [Array<Specification>] The list of the
# specifications of the target.
#
attr_accessor :specs
# @return [Symbol] The platform (either `:ios`, `:watchos`, `:tvos`, or `:osx`).
#
attr_accessor :platform_name
# @return [String] The deployment target.
#
attr_accessor :platform_deployment_target
# @return [String] The label for the target.
#
attr_accessor :cocoapods_target_label
end end
end end
end end
......
...@@ -4,21 +4,35 @@ module Pod ...@@ -4,21 +4,35 @@ module Pod
# the context of the installer before analysis has been completed. # the context of the installer before analysis has been completed.
# #
class PreInstallHooksContext class PreInstallHooksContext
# @return [String] The path to the sandbox root (`Pods` directory).
#
attr_accessor :sandbox_root
# @return [Podfile] The Podfile for the project. # @return [Podfile] The Podfile for the project.
# #
attr_accessor :podfile attr_reader :podfile
# @return [Sandbox] The Sandbox for the project. # @return [Sandbox] The Sandbox for the project.
# #
attr_accessor :sandbox attr_reader :sandbox
# @return [String] The path to the sandbox root (`Pods` directory).
#
attr_reader :sandbox_root
# @return [Lockfile] The Lockfile for the project. # @return [Lockfile] The Lockfile for the project.
# #
attr_accessor :lockfile attr_reader :lockfile
# Initialize a new instance
#
# @param [Sandbox] sandbox see #sandbox
# @param [String] sandbox_root see #sandbox_root
# @param [Podfile] podfile see #podfile
# @param [Lockfile] lockfile see #lockfile
#
def initialize(podfile, sandbox, sandbox_root, lockfile)
@podfile = podfile
@sandbox = sandbox
@sandbox_root = sandbox_root
@lockfile = lockfile
end
# @param [Sandbox] sandbox see {#sandbox} # @param [Sandbox] sandbox see {#sandbox}
# #
...@@ -30,12 +44,7 @@ module Pod ...@@ -30,12 +44,7 @@ module Pod
# static context. # static context.
# #
def self.generate(sandbox, podfile, lockfile) def self.generate(sandbox, podfile, lockfile)
result = new new(podfile, sandbox, sandbox.root.to_s, lockfile)
result.podfile = podfile
result.sandbox = sandbox
result.sandbox_root = sandbox.root.to_s
result.lockfile = lockfile
result
end end
end end
end end
......
...@@ -43,12 +43,12 @@ module Pod ...@@ -43,12 +43,12 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Array<AggregateTarget>] aggregate_targets @see aggregate_targets # @param [Array<AggregateTarget>] aggregate_targets @see #aggregate_targets
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Array<PodTarget>] pod_targets @see pod_targets # @param [Array<PodTarget>] pod_targets @see #pod_targets
# @param [Analyzer] analysis_result @see analysis_result # @param [Analyzer] analysis_result @see #analysis_result
# @param [InstallationOptions] installation_options @see installation_options # @param [InstallationOptions] installation_options @see #installation_options
# @param [Config] config @see config # @param [Config] config @see #config
# #
def initialize(aggregate_targets, sandbox, pod_targets, analysis_result, installation_options, config) def initialize(aggregate_targets, sandbox, pod_targets, analysis_result, installation_options, config)
@aggregate_targets = aggregate_targets @aggregate_targets = aggregate_targets
......
...@@ -20,9 +20,9 @@ module Pod ...@@ -20,9 +20,9 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Array<PodTarget>] pod_targets @see pod_targets # @param [Array<PodTarget>] pod_targets @see #pod_targets
# @param [Project] pods_project @see pod_project # @param [Project] pods_project @see #pods_project
# #
def initialize(sandbox, pod_targets, pods_project) def initialize(sandbox, pod_targets, pods_project)
@sandbox = sandbox @sandbox = sandbox
......
...@@ -19,8 +19,8 @@ module Pod ...@@ -19,8 +19,8 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Target] target @see target # @param [Target] target @see #target
# #
def initialize(sandbox, target) def initialize(sandbox, target)
@sandbox = sandbox @sandbox = sandbox
......
...@@ -8,9 +8,22 @@ module Pod ...@@ -8,9 +8,22 @@ module Pod
# through the installation process. # through the installation process.
# #
class Project < Xcodeproj::Project class Project < Xcodeproj::Project
# @return [PBXGroup] The group for the support files of the aggregate
# targets.
#
attr_reader :support_files_group
# @return [PBXGroup] The group for the Pods.
#
attr_reader :pods
# @return [PBXGroup] The group for Development Pods.
#
attr_reader :development_pods
# Initialize a new instance # Initialize a new instance
# #
# @param [Pathname, String] path @see path # @param [Pathname, String] path @see #path
# @param [Bool] skip_initialization # @param [Bool] skip_initialization
# Whether the project should be initialized from scratch. # Whether the project should be initialized from scratch.
# @param [Int] object_version # @param [Int] object_version
...@@ -27,19 +40,6 @@ module Pod ...@@ -27,19 +40,6 @@ module Pod
self.symroot = LEGACY_BUILD_ROOT self.symroot = LEGACY_BUILD_ROOT
end end
# @return [PBXGroup] The group for the support files of the aggregate
# targets.
#
attr_reader :support_files_group
# @return [PBXGroup] The group for the Pods.
#
attr_reader :pods
# @return [PBXGroup] The group for Development Pods.
#
attr_reader :development_pods
# Generates a list of new UUIDs that created objects can be assigned. # Generates a list of new UUIDs that created objects can be assigned.
# #
# @note Overridden to generate UUIDs in a much faster way, since we don't need to check for collisions # @note Overridden to generate UUIDs in a much faster way, since we don't need to check for collisions
......
...@@ -52,7 +52,7 @@ module Pod ...@@ -52,7 +52,7 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [String, Pathname] root @see root # @param [String, Pathname] root @see #root
# #
def initialize(root) def initialize(root)
FileUtils.mkdir_p(root) FileUtils.mkdir_p(root)
......
...@@ -33,8 +33,8 @@ module Pod ...@@ -33,8 +33,8 @@ module Pod
# Initialize a new instance # Initialize a new instance
# #
# @param [Sandbox::PathList, Pathname] path_list @see path_list # @param [Sandbox::PathList, Pathname] path_list @see #path_list
# @param [Specification::Consumer] spec_consumer @see spec_consumer # @param [Specification::Consumer] spec_consumer @see #spec_consumer
# #
def initialize(path_list, spec_consumer) def initialize(path_list, spec_consumer)
if path_list.is_a?(PathList) if path_list.is_a?(PathList)
......
...@@ -16,7 +16,7 @@ module Pod ...@@ -16,7 +16,7 @@ module Pod
# #
attr_reader :sandbox attr_reader :sandbox
# @param [Sandbox] @see sandbox # @param [Sandbox] @see #sandbox
# #
# @param [String] relative_path # @param [String] relative_path
# the relative path to the sandbox root and hence to the Pods # the relative path to the sandbox root and hence to the Pods
......
...@@ -15,13 +15,31 @@ module Pod ...@@ -15,13 +15,31 @@ module Pod
# @return [Boolean] Whether the target needs to be implemented as a framework. # @return [Boolean] Whether the target needs to be implemented as a framework.
# Computed by analyzer. # Computed by analyzer.
# #
attr_accessor :host_requires_frameworks attr_reader :host_requires_frameworks
alias_method :host_requires_frameworks?, :host_requires_frameworks alias_method :host_requires_frameworks?, :host_requires_frameworks
# @return [Hash{String=>Symbol}] A hash representing the user build
# configurations where each key corresponds to the name of a
# configuration and its value to its type (`:debug` or `:release`).
#
attr_reader :user_build_configurations
# @return [Array<String>] The value for the ARCHS build setting.
#
attr_reader :archs
# Initialize a new target # Initialize a new target
# #
def initialize # @param [Sandbox] sandbox @see #sandbox
@archs = [] # @param [Boolean] host_requires_frameworks @see #host_requires_frameworks
# @param [Hash{String=>Symbol}] user_build_configurations @see #user_build_configurations
# @param [Array<String>] archs @see #archs
#
def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs)
@sandbox = sandbox
@host_requires_frameworks = host_requires_frameworks
@user_build_configurations = user_build_configurations
@archs = archs
end end
# @return [String] the name of the library. # @return [String] the name of the library.
...@@ -102,23 +120,11 @@ module Pod ...@@ -102,23 +120,11 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
# @!group Information storage
# @return [Hash{String=>Symbol}] A hash representing the user build
# configurations where each key corresponds to the name of a
# configuration and its value to its type (`:debug` or `:release`).
#
attr_accessor :user_build_configurations
# @return [PBXNativeTarget] the target generated in the Pods project for # @return [PBXNativeTarget] the target generated in the Pods project for
# this library. # this library.
# #
attr_accessor :native_target attr_accessor :native_target
# @return [Array<String>] The value for the ARCHS build setting.
#
attr_accessor :archs
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
# @!group Support files # @!group Support files
......
...@@ -3,25 +3,73 @@ module Pod ...@@ -3,25 +3,73 @@ module Pod
# of the single Pods. The client targets will then depend on this one. # of the single Pods. The client targets will then depend on this one.
# #
class AggregateTarget < Target class AggregateTarget < Target
# Product types where the product's frameworks must be embedded in a host target
#
EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES = [:app_extension, :framework, :static_library, :messages_extension, :watch_extension, :xpc_service].freeze
# @return [TargetDefinition] the target definition of the Podfile that # @return [TargetDefinition] the target definition of the Podfile that
# generated this target. # generated this target.
#
attr_reader :target_definition attr_reader :target_definition
# Product types where the product's frameworks must be embedded in a host target # @return [Pathname] the folder where the client is stored used for
# computing the relative paths. If integrating it should be the
# folder where the user project is stored, otherwise it should
# be the installation root.
# #
EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES = [:app_extension, :framework, :static_library, :messages_extension, :watch_extension, :xpc_service].freeze attr_reader :client_root
# Initialize a new instance # @return [Xcodeproj::Project] the user project that this target will
# integrate as identified by the analyzer.
#
attr_reader :user_project
# @return [Array<String>] the list of the UUIDs of the user targets that
# will be integrated by this target as identified by the analyzer.
#
# @note The target instances are not stored to prevent editing different
# instances.
#
attr_reader :user_target_uuids
# @return [Hash<String, Xcodeproj::Config>] Map from configuration name to
# configuration file for the target
#
# @note The configurations are generated by the {TargetInstaller} and
# used by {UserProjectIntegrator} to check for any overridden
# values.
#
attr_reader :xcconfigs
# @return [Array<PodTarget>] The dependencies for this target.
#
attr_accessor :pod_targets
# @return [Array<AggregateTarget>] The aggregate targets whose pods this
# target must be able to import, but will not directly link against.
# #
# @param [TargetDefinition] target_definition @see target_definition attr_reader :search_paths_aggregate_targets
# @param [Sandbox] sandbox @see sandbox
# Initialize a new instance
# #
def initialize(target_definition, sandbox) # @param [Sandbox] sandbox @see Target#sandbox
# @param [Boolean] host_requires_frameworks @see Target#host_requires_frameworks
# @param [Hash{String=>Symbol}] user_build_configurations @see Target#user_build_configurations
# @param [Array<String>] archs @see Target#archs
# @param [TargetDefinition] target_definition @see #target_definition
# @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
#
def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, target_definition, client_root, user_project, user_target_uuids, pod_targets)
super(sandbox, host_requires_frameworks, user_build_configurations, archs)
raise "Can't initialize an AggregateTarget with an abstract TargetDefinition" if target_definition.abstract? raise "Can't initialize an AggregateTarget with an abstract TargetDefinition" if target_definition.abstract?
super()
@target_definition = target_definition @target_definition = target_definition
@sandbox = sandbox @client_root = client_root
@pod_targets = [] @user_project = user_project
@user_target_uuids = user_target_uuids
@pod_targets = pod_targets
@search_paths_aggregate_targets = [] @search_paths_aggregate_targets = []
@file_accessors = [] @file_accessors = []
@xcconfigs = {} @xcconfigs = {}
...@@ -81,18 +129,6 @@ module Pod ...@@ -81,18 +129,6 @@ module Pod
target_definition.podfile target_definition.podfile
end end
# @return [Pathname] the folder where the client is stored used for
# computing the relative paths. If integrating it should be the
# folder where the user project is stored, otherwise it should
# be the installation root.
#
attr_accessor :client_root
# @return [Xcodeproj::Project] the user project that this target will
# integrate as identified by the analyzer.
#
attr_accessor :user_project
# @return [Pathname] the path of the user project that this target will # @return [Pathname] the path of the user project that this target will
# integrate as identified by the analyzer. # integrate as identified by the analyzer.
# #
...@@ -100,14 +136,6 @@ module Pod ...@@ -100,14 +136,6 @@ module Pod
user_project.path if user_project user_project.path if user_project
end end
# @return [Array<String>] the list of the UUIDs of the user targets that
# will be integrated by this target as identified by the analyzer.
#
# @note The target instances are not stored to prevent editing different
# instances.
#
attr_accessor :user_target_uuids
# List all user targets that will be integrated by this #target. # List all user targets that will be integrated by this #target.
# #
# @return [Array<PBXNativeTarget>] # @return [Array<PBXNativeTarget>]
...@@ -124,24 +152,6 @@ module Pod ...@@ -124,24 +152,6 @@ module Pod
end end
end end
# @return [Hash<String, Xcodeproj::Config>] Map from configuration name to
# configuration file for the target
#
# @note The configurations are generated by the {TargetInstaller} and
# used by {UserProjectIntegrator} to check for any overridden
# values.
#
attr_reader :xcconfigs
# @return [Array<PodTarget>] The dependencies for this target.
#
attr_accessor :pod_targets
# @return [Array<AggregateTarget>] The aggregate targets whose pods this
# target must be able to import, but will not directly link against.
#
attr_reader :search_paths_aggregate_targets
# @param [String] build_configuration The build configuration for which the # @param [String] build_configuration The build configuration for which the
# the pod targets should be returned. # the pod targets should be returned.
# #
......
...@@ -16,7 +16,7 @@ module Pod ...@@ -16,7 +16,7 @@ module Pod
# #
attr_reader :build_headers attr_reader :build_headers
# @return [String] used as suffix in the label # @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
# and accessors relying on this as #build_product_path. # and accessors relying on this as #build_product_path.
...@@ -38,21 +38,24 @@ module Pod ...@@ -38,21 +38,24 @@ module Pod
# #
attr_accessor :test_native_targets attr_accessor :test_native_targets
# @param [Array<Specification>] specs @see #specs # Initialize a new instance
#
# @param [Sandbox] sandbox @see Target#sandbox
# @param [Boolean] host_requires_frameworks @see Target#host_requires_frameworks
# @param [Hash{String=>Symbol}] user_build_configurations @see Target#user_build_configurations
# @param [Array<String>] archs @see Target#archs
# @param [Array<TargetDefinition>] target_definitions @see #target_definitions # @param [Array<TargetDefinition>] target_definitions @see #target_definitions
# @param [Sandbox] sandbox @see #sandbox
# @param [String] scope_suffix @see #scope_suffix # @param [String] scope_suffix @see #scope_suffix
# #
def initialize(specs, target_definitions, sandbox, scope_suffix = nil) def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, specs, target_definitions, scope_suffix = nil)
super(sandbox, host_requires_frameworks, user_build_configurations, archs)
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 == ''
super()
@specs = specs.dup.freeze @specs = specs.dup.freeze
@test_specs, @non_test_specs = @specs.partition(&:test_specification?) @test_specs, @non_test_specs = @specs.partition(&:test_specification?)
@target_definitions = target_definitions @target_definitions = target_definitions
@sandbox = sandbox
@scope_suffix = scope_suffix @scope_suffix = scope_suffix
@build_headers = Sandbox::HeadersStore.new(sandbox, 'Private', :private) @build_headers = Sandbox::HeadersStore.new(sandbox, 'Private', :private)
@file_accessors = [] @file_accessors = []
...@@ -74,13 +77,10 @@ module Pod ...@@ -74,13 +77,10 @@ module Pod
if cache[cache_key] if cache[cache_key]
cache[cache_key] cache[cache_key]
else else
target = PodTarget.new(specs, [target_definition], sandbox, target_definition.label) target = PodTarget.new(sandbox, host_requires_frameworks, user_build_configurations, archs, specs, [target_definition], target_definition.label)
target.file_accessors = file_accessors target.file_accessors = file_accessors
target.user_build_configurations = user_build_configurations
target.native_target = native_target target.native_target = native_target
target.archs = archs
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.host_requires_frameworks = host_requires_frameworks
cache[cache_key] = target cache[cache_key] = target
end end
end end
......
...@@ -125,15 +125,15 @@ def fixture_target_definition(name = 'Pods', platform = Pod::Platform.ios) ...@@ -125,15 +125,15 @@ def fixture_target_definition(name = 'Pods', platform = Pod::Platform.ios)
'platform' => platform_hash) 'platform' => platform_hash)
end end
def fixture_pod_target(spec_or_name, target_definitions = []) def fixture_pod_target(spec_or_name, host_requires_frameworks = false, user_build_configurations = {}, target_definitions = [])
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], target_definitions) fixture_pod_target_with_specs([spec], host_requires_frameworks, user_build_configurations, target_definitions)
end end
def fixture_pod_target_with_specs(specs, target_definitions = []) def fixture_pod_target_with_specs(specs, host_requires_frameworks = false, user_build_configurations = {}, target_definitions = [])
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) } }
Pod::PodTarget.new(specs, target_definitions, config.sandbox).tap do |pod_target| Pod::PodTarget.new(config.sandbox, host_requires_frameworks, user_build_configurations, [], specs, target_definitions, nil).tap do |pod_target|
specs.each do |spec| specs.each do |spec|
pod_target.file_accessors << fixture_file_accessor(spec, pod_target.platform) pod_target.file_accessors << fixture_file_accessor(spec, pod_target.platform)
consumer = spec.consumer(pod_target.platform) consumer = spec.consumer(pod_target.platform)
...@@ -144,10 +144,7 @@ end ...@@ -144,10 +144,7 @@ end
def fixture_aggregate_target(pod_targets = [], target_definition = nil) def fixture_aggregate_target(pod_targets = [], 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
target = Pod::AggregateTarget.new(target_definition, config.sandbox) Pod::AggregateTarget.new(config.sandbox, false, {}, [], target_definition, config.sandbox.root.dirname, nil, nil, pod_targets)
target.client_root = config.sandbox.root.dirname
target.pod_targets = pod_targets
target
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([spec], [fixture_target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [fixture_target_definition], nil)
@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, [target_definition]) fixture_pod_target(spec, false, {}, [target_definition])
end end
before do before do
...@@ -41,7 +41,8 @@ module Pod ...@@ -41,7 +41,8 @@ module Pod
podfile = @target.target_definition.podfile podfile = @target.target_definition.podfile
podfile.stubs(:defined_in_file).returns(Pathname.new(@target.client_root) + 'Podfile') podfile.stubs(:defined_in_file).returns(Pathname.new(@target.client_root) + 'Podfile')
@target.target_definition.stubs(:podfile).returns(podfile) @target.target_definition.stubs(:podfile).returns(podfile)
@target.client_root = Pathname.new(@target.client_root) + 'NestedFolder' client_root = Pathname.new(@target.client_root) + 'NestedFolder'
@target.stubs(:client_root).returns(client_root)
@generator.target.podfile_dir_relative_path.should == '${SRCROOT}/..' @generator.target.podfile_dir_relative_path.should == '${SRCROOT}/..'
end end
...@@ -159,7 +160,7 @@ module Pod ...@@ -159,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, [target_definition]).scoped.first fixture_pod_target(spec, false, {}, [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
......
...@@ -41,9 +41,8 @@ module Pod ...@@ -41,9 +41,8 @@ module Pod
) )
@spec = fixture_spec('banana-lib/BananaLib.podspec') @spec = fixture_spec('banana-lib/BananaLib.podspec')
@pod_target = fixture_pod_target(@spec) @pod_target = fixture_pod_target(@spec, true)
@pod_target.dependent_targets = [@monkey_pod_target, vendored_dep_target] @pod_target.dependent_targets = [@monkey_pod_target, vendored_dep_target]
@pod_target.host_requires_frameworks = true
@consumer = @pod_target.spec_consumers.first @consumer = @pod_target.spec_consumers.first
@podfile = @pod_target.podfile @podfile = @pod_target.podfile
......
...@@ -10,12 +10,9 @@ module Pod ...@@ -10,12 +10,9 @@ 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([spec], [target_definition], config.sandbox) pod_target = PodTarget.new(sandbox, false, {}, [], [spec], [target_definition], nil)
umbrella = AggregateTarget.new(target_definition, config.sandbox) umbrella = AggregateTarget.new(sandbox, false, {}, [], target_definition, config.sandbox.root.dirname, user_project, [user_target.uuid], [pod_target])
umbrella.user_project = user_project
umbrella.user_target_uuids = [user_target.uuid]
umbrella.stubs(:platform).returns(Platform.new(:ios, '8.0')) umbrella.stubs(:platform).returns(Platform.new(:ios, '8.0'))
umbrella.pod_targets = [pod_target]
result = Installer::PostInstallHooksContext.generate(sandbox, [umbrella]) result = Installer::PostInstallHooksContext.generate(sandbox, [umbrella])
result.class.should == Installer::PostInstallHooksContext result.class.should == Installer::PostInstallHooksContext
......
...@@ -9,10 +9,7 @@ module Pod ...@@ -9,10 +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(target_definition, config.sandbox) @pod_bundle = AggregateTarget.new(config.sandbox, false, {}, [], target_definition, project_path.dirname, @project, [@target.uuid], [])
@pod_bundle.user_project = @project
@pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new( configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
) )
......
...@@ -14,11 +14,7 @@ module Pod ...@@ -14,11 +14,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(target_definition, config.sandbox) @pod_bundle = AggregateTarget.new(config.sandbox, false, { 'Release' => :release, 'Debug' => :debug }, [], target_definition, project_path.dirname, @project, [@target.uuid], [])
@pod_bundle.user_project = @project
@pod_bundle.user_build_configurations = { 'Release' => :release, 'Debug' => :debug }
@pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@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,16 +17,8 @@ module Pod ...@@ -17,16 +17,8 @@ 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(@podfile.target_definitions['SampleProject'], config.sandbox) @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'], [])
@target.client_root = sample_project_path.dirname @empty_library = AggregateTarget.new(config.sandbox, false, { 'Release' => :release, 'Debug' => :debug }, [], @podfile.target_definitions[:empty], sample_project_path.dirname, @target.user_project, ['C0C495321B9E5C47004F9854'], [])
@target.user_project = Xcodeproj::Project.open(@sample_project_path)
@target.user_target_uuids = ['A346496C14F9BE9A0080D870']
@target.user_build_configurations = { 'Release' => :release, 'Debug' => :debug }
@empty_library = AggregateTarget.new(@podfile.target_definitions[:empty], config.sandbox)
@empty_library.client_root = sample_project_path.dirname
@empty_library.user_project = @target.user_project
@empty_library.user_target_uuids = ['C0C495321B9E5C47004F9854']
@empty_library.user_build_configurations = { 'Release' => :release, 'Debug' => :debug }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target, @empty_library]) @integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target, @empty_library])
end end
......
...@@ -26,15 +26,12 @@ module Pod ...@@ -26,15 +26,12 @@ module Pod
@project.add_file_reference(file, group) @project.add_file_reference(file, group)
end end
@target = AggregateTarget.new(@target_definition, config.sandbox) user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
@target.client_root = config.sandbox.root.dirname
@target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
@pod_target = PodTarget.new([@spec], [@target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, user_build_configurations, [], [@spec], [@target_definition], nil)
@pod_target.user_build_configurations = @target.user_build_configurations
@pod_target.file_accessors = [file_accessor] @pod_target.file_accessors = [file_accessor]
@target.pod_targets = [@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)
......
...@@ -196,9 +196,9 @@ module Pod ...@@ -196,9 +196,9 @@ 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([stub('Spec', :test_specification? => false)], [fixture_target_definition], config.sandbox) pod_target_1 = PodTarget.new(config.sandbox, false, {}, [], [stub('Spec', :test_specification? => false)], [fixture_target_definition], nil)
pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')] pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
pod_target_2 = PodTarget.new([stub('Spec', :test_specification? => false)], [fixture_target_definition], config.sandbox) pod_target_2 = PodTarget.new(config.sandbox, false, {}, [], [stub('Spec', :test_specification? => false)], [fixture_target_definition], nil)
pod_target_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')] pod_target_2.file_accessors = [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 }
...@@ -206,7 +206,7 @@ module Pod ...@@ -206,7 +206,7 @@ module Pod
end end
it 'handles pods without file accessors' do it 'handles pods without file accessors' do
pod_target_1 = PodTarget.new([stub('Spec', :test_specification? => false)], [fixture_target_definition], config.sandbox) pod_target_1 = PodTarget.new(config.sandbox, false, {}, [], [stub('Spec', :test_specification? => false)], [fixture_target_definition], nil)
pod_target_1.file_accessors = [] pod_target_1.file_accessors = []
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 == []
......
...@@ -29,9 +29,8 @@ module Pod ...@@ -29,9 +29,8 @@ module Pod
@project.add_file_reference(resource, group) @project.add_file_reference(resource, group)
end end
@pod_target = PodTarget.new([@spec], [@target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, { 'Debug' => :debug, 'Release' => :release }, [], [@spec], [@target_definition], nil)
@pod_target.file_accessors = [file_accessor] @pod_target.file_accessors = [file_accessor]
@pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@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"'
...@@ -180,13 +179,11 @@ module Pod ...@@ -180,13 +179,11 @@ module Pod
@project.add_file_reference(resource, group) @project.add_file_reference(resource, group)
end end
@coconut_pod_target = PodTarget.new([@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition], config.sandbox) @coconut_pod_target = PodTarget.new(config.sandbox, false, { 'Debug' => :debug, 'Release' => :release }, [], [@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition], nil)
@coconut_pod_target.file_accessors = [file_accessor, test_file_accessor] @coconut_pod_target.file_accessors = [file_accessor, test_file_accessor]
@coconut_pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@installer = PodTargetInstaller.new(config.sandbox, @coconut_pod_target) @installer = PodTargetInstaller.new(config.sandbox, @coconut_pod_target)
@coconut_pod_target2 = PodTarget.new([@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition2], config.sandbox) @coconut_pod_target2 = PodTarget.new(config.sandbox, false, { 'Debug' => :debug, 'Release' => :release }, [], [@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition2], nil)
@coconut_pod_target2.file_accessors = [file_accessor, test_file_accessor] @coconut_pod_target2.file_accessors = [file_accessor, test_file_accessor]
@coconut_pod_target2.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@installer2 = PodTargetInstaller.new(config.sandbox, @coconut_pod_target2) @installer2 = PodTargetInstaller.new(config.sandbox, @coconut_pod_target2)
end end
...@@ -378,9 +375,8 @@ module Pod ...@@ -378,9 +375,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([@minions_spec, *@minions_spec.recursive_subspecs], [@target_definition], config.sandbox) @minions_pod_target = PodTarget.new(config.sandbox, false, { 'Debug' => :debug, 'Release' => :release }, [], [@minions_spec, *@minions_spec.recursive_subspecs], [@target_definition], nil)
@minions_pod_target.file_accessors = [file_accessor] @minions_pod_target.file_accessors = [file_accessor]
@minions_pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@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' }
...@@ -490,9 +486,8 @@ module Pod ...@@ -490,9 +486,8 @@ module Pod
@project.add_file_reference(resource, group) @project.add_file_reference(resource, group)
end end
@pod_target = PodTarget.new([@spec], [@target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, { 'Debug' => :debug, 'Release' => :release }, [], [@spec], [@target_definition], nil)
@pod_target.file_accessors = [file_accessor] @pod_target.file_accessors = [file_accessor]
@pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@installer = PodTargetInstaller.new(config.sandbox, @pod_target) @installer = PodTargetInstaller.new(config.sandbox, @pod_target)
end end
...@@ -751,8 +746,7 @@ module Pod ...@@ -751,8 +746,7 @@ module Pod
before do before do
@project.add_pod_group('snake', fixture('snake')) @project.add_pod_group('snake', fixture('snake'))
@pod_target = fixture_pod_target('snake/snake.podspec', [@target_definition]) @pod_target = fixture_pod_target('snake/snake.podspec', false, { 'Debug' => :debug, 'Release' => :release }, [@target_definition])
@pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@pod_target.stubs(:requires_frameworks? => true) @pod_target.stubs(:requires_frameworks? => true)
group = @project.group_for_spec('snake') group = @project.group_for_spec('snake')
@pod_target.file_accessors.first.source_files.each do |file| @pod_target.file_accessors.first.source_files.each do |file|
...@@ -933,9 +927,8 @@ module Pod ...@@ -933,9 +927,8 @@ module Pod
@spec.resource_bundle = nil @spec.resource_bundle = nil
@project.add_pod_group('BananaLib', fixture('banana-lib')) @project.add_pod_group('BananaLib', fixture('banana-lib'))
@pod_target = fixture_pod_target(@spec) @pod_target = fixture_pod_target(@spec, false, 'Debug' => :debug, 'Release' => :release)
@pod_target.stubs(:requires_frameworks? => true) @pod_target.stubs(:requires_frameworks? => true)
@pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
target_installer = PodTargetInstaller.new(config.sandbox, @pod_target) target_installer = PodTargetInstaller.new(config.sandbox, @pod_target)
# Use a file references installer to add the files so that the correct ones are added. # Use a file references installer to add the files so that the correct ones are added.
...@@ -993,8 +986,7 @@ module Pod ...@@ -993,8 +986,7 @@ module Pod
@spec.resource_bundle = { 'banana_bundle' => ['Resources/**/*'] } @spec.resource_bundle = { 'banana_bundle' => ['Resources/**/*'] }
@project.add_pod_group('BananaLib', fixture('banana-lib')) @project.add_pod_group('BananaLib', fixture('banana-lib'))
@pod_target = fixture_pod_target(@spec) @pod_target = fixture_pod_target(@spec, false, 'Debug' => :debug, 'Release' => :release)
@pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
target_installer = PodTargetInstaller.new(config.sandbox, @pod_target) target_installer = PodTargetInstaller.new(config.sandbox, @pod_target)
# Use a file references installer to add the files so that the correct ones are added. # Use a file references installer to add the files so that the correct ones are added.
......
...@@ -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([@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition], config.sandbox) @coconut_pod_target = PodTarget.new(config.sandbox, false, {}, [], [@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition], nil)
@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)
......
...@@ -24,22 +24,20 @@ module Pod ...@@ -24,22 +24,20 @@ module Pod
@project.add_file_reference(file, group) @project.add_file_reference(file, group)
end end
@pod_target = PodTarget.new([@spec], [@target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }, ['$(ARCHS_STANDARD_64_BIT)'], [@spec], [@target_definition], nil)
@pod_target.stubs(:platform).returns(Platform.new(:ios, '6.0')) @pod_target.stubs(:platform).returns(Platform.new(:ios, '6.0'))
@pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
@pod_target.file_accessors = [file_accessor] @pod_target.file_accessors = [file_accessor]
@installer = TargetInstaller.new(config.sandbox, @pod_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
@pod_target.archs = '$(ARCHS_STANDARD_64_BIT)'
@installer.send(:add_target) @installer.send(:add_target)
@installer.send(:native_target).resolved_build_setting('ARCHS').should == { @installer.send(:native_target).resolved_build_setting('ARCHS').should == {
'Release' => '$(ARCHS_STANDARD_64_BIT)', 'Release' => ['$(ARCHS_STANDARD_64_BIT)'],
'Debug' => '$(ARCHS_STANDARD_64_BIT)', 'Debug' => ['$(ARCHS_STANDARD_64_BIT)'],
'AppStore' => '$(ARCHS_STANDARD_64_BIT)', 'AppStore' => ['$(ARCHS_STANDARD_64_BIT)'],
'Test' => '$(ARCHS_STANDARD_64_BIT)', 'Test' => ['$(ARCHS_STANDARD_64_BIT)'],
} }
end end
......
...@@ -102,8 +102,8 @@ module Pod ...@@ -102,8 +102,8 @@ module Pod
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')) target_definition_osx = fixture_target_definition('OSX Target', Platform.new(:osx, '10.8'))
target_definition_ios = fixture_target_definition('iOS Target', Platform.new(:ios, '6.0')) target_definition_ios = fixture_target_definition('iOS Target', Platform.new(:ios, '6.0'))
aggregate_target_osx = AggregateTarget.new(target_definition_osx, config.sandbox) aggregate_target_osx = AggregateTarget.new(config.sandbox, false, {}, [], target_definition_osx, config.sandbox.root.dirname, nil, nil, [])
aggregate_target_ios = AggregateTarget.new(target_definition_ios, config.sandbox) aggregate_target_ios = AggregateTarget.new(config.sandbox, false, {}, [], 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 +134,7 @@ module Pod ...@@ -134,7 +134,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([spec], [target_definition], config.sandbox) pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [target_definition], nil)
@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 +146,7 @@ module Pod ...@@ -146,7 +146,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([spec], [target_definition], config.sandbox) pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [target_definition], nil)
@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 +181,8 @@ module Pod ...@@ -181,8 +181,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([spec], [target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [target_definition], nil)
@target = AggregateTarget.new(target_definition, config.sandbox) @target = AggregateTarget.new(config.sandbox, false, {}, [], target_definition, config.sandbox.root.dirname, nil, nil, [])
@mock_target = mock('PodNativeTarget') @mock_target = mock('PodNativeTarget')
...@@ -267,8 +267,8 @@ module Pod ...@@ -267,8 +267,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([spec, *spec.recursive_subspecs], [target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec, *spec.recursive_subspecs], [target_definition], nil)
@target = AggregateTarget.new(target_definition, config.sandbox) @target = AggregateTarget.new(config.sandbox, false, {}, [], target_definition, config.sandbox.root.dirname, nil, nil, [])
@mock_target = mock('PodNativeTarget') @mock_target = mock('PodNativeTarget')
...@@ -433,8 +433,7 @@ module Pod ...@@ -433,8 +433,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(fixture_target_definition, config.sandbox) aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], fixture_target_definition, config.sandbox.root.dirname, proj, nil, [])
aggregate_target.user_project = proj
@generator.stubs(:aggregate_targets).returns([aggregate_target]) @generator.stubs(:aggregate_targets).returns([aggregate_target])
@generator.send(:prepare) @generator.send(:prepare)
...@@ -471,7 +470,7 @@ module Pod ...@@ -471,7 +470,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([spec, *spec.recursive_subspecs], [target_definition], config.sandbox) pod_target = Pod::PodTarget.new(config.sandbox, false, {}, [], [spec, *spec.recursive_subspecs], [target_definition], nil)
pod_target.stubs(:should_build?).returns(true) pod_target.stubs(:should_build?).returns(true)
@generator.installation_options. @generator.installation_options.
......
...@@ -376,7 +376,7 @@ module Pod ...@@ -376,7 +376,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([@spec], [fixture_target_definition], config.sandbox)] @pod_targets = [PodTarget.new(config.sandbox, false, {}, [], [@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([])
...@@ -422,7 +422,7 @@ module Pod ...@@ -422,7 +422,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(fixture_target_definition('MyApp'), config.sandbox) aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], 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)
...@@ -435,7 +435,7 @@ module Pod ...@@ -435,7 +435,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(fixture_target_definition('MyApp'), config.sandbox) aggregate_target = AggregateTarget.new(config.sandbox, false, {}, [], 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)
...@@ -470,7 +470,7 @@ module Pod ...@@ -470,7 +470,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([spec], [fixture_target_definition], config.sandbox) pod_target = PodTarget.new(config.sandbox, false, {}, [], [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, [])
...@@ -480,7 +480,7 @@ module Pod ...@@ -480,7 +480,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([spec], [fixture_target_definition], config.sandbox) pod_target = PodTarget.new(config.sandbox, false, {}, [], [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, [])
...@@ -553,7 +553,7 @@ module Pod ...@@ -553,7 +553,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([spec], [fixture_target_definition], config.sandbox) pod_target = PodTarget.new(config.sandbox, false, {}, [], [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
...@@ -564,7 +564,7 @@ module Pod ...@@ -564,7 +564,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([spec, *spec.test_specs], [fixture_target_definition], config.sandbox) pod_target = PodTarget.new(config.sandbox, false, {}, [], [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'
...@@ -579,7 +579,7 @@ module Pod ...@@ -579,7 +579,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([spec, *spec.test_specs], [fixture_target_definition], config.sandbox) pod_target = PodTarget.new(config.sandbox, false, {}, [], [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'
...@@ -639,7 +639,8 @@ module Pod ...@@ -639,7 +639,8 @@ module Pod
describe 'Integrating client projects' do describe 'Integrating client projects' do
it 'integrates the client projects' do it 'integrates the client projects' do
@installer.stubs(:aggregate_targets).returns([AggregateTarget.new(fixture_target_definition, config.sandbox)]) target = AggregateTarget.new(config.sandbox, false, {}, [], fixture_target_definition, config.sandbox.root.dirname, nil, nil, [])
@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)
end end
......
...@@ -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(@target_definition, config.sandbox) @lib = AggregateTarget.new(config.sandbox, false, {}, [], @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,8 +28,7 @@ module Pod ...@@ -28,8 +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(@target_definition, config.sandbox) @lib = AggregateTarget.new(config.sandbox, false, {}, [], @target_definition, config.sandbox.root.dirname, nil, nil, [])
@lib.client_root = config.sandbox.root.dirname
end end
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
......
...@@ -6,7 +6,8 @@ module Pod ...@@ -6,7 +6,8 @@ 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(@target_definition, config.sandbox) 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'], [])
end end
it 'returns the target_definition that generated it' do it 'returns the target_definition that generated it' do
...@@ -30,9 +31,6 @@ module Pod ...@@ -30,9 +31,6 @@ module Pod
end end
it 'returns the user targets' do it 'returns the user targets' do
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target.user_project = Xcodeproj::Project.open(project_path)
@target.user_target_uuids = ['A346496C14F9BE9A0080D870']
targets = @target.user_targets targets = @target.user_targets
targets.count.should == 1 targets.count.should == 1
targets.first.class.should == Xcodeproj::Project::PBXNativeTarget targets.first.class.should == Xcodeproj::Project::PBXNativeTarget
...@@ -43,8 +41,7 @@ module Pod ...@@ -43,8 +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(@target_definition, config.sandbox) @target = AggregateTarget.new(config.sandbox, false, {}, [], @target_definition, config.sandbox.root.dirname, nil, nil, [])
@target.client_root = config.sandbox.root.dirname
end end
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
...@@ -90,21 +87,17 @@ module Pod ...@@ -90,21 +87,17 @@ 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([@spec], [@target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, {}, [], [@spec], [@target_definition], nil)
@target = AggregateTarget.new(@target_definition, config.sandbox) @target = AggregateTarget.new(config.sandbox, false, {}, [], @target_definition, config.sandbox.root.dirname, nil, nil, [@pod_target])
@target.pod_targets = [@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([@spec], [@target_definition], config.sandbox) @pod_target_release = PodTarget.new(config.sandbox, false, {}, [], [@spec], [@target_definition], nil)
@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.pod_targets = [@pod_target, @pod_target_release] @target.stubs(:pod_targets).returns([@pod_target, @pod_target_release])
@target.user_build_configurations = { @target.stubs(:user_build_configurations).returns('Debug' => :debug, 'Release' => :release)
'Debug' => :debug,
'Release' => :release,
}
end end
it 'returns pod targets for given build configuration' do it 'returns pod targets for given build configuration' do
...@@ -123,12 +116,9 @@ module Pod ...@@ -123,12 +116,9 @@ 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([@coconut_spec], [@target_definition], config.sandbox) @pod_target_release = PodTarget.new(config.sandbox, false, {}, [], [@coconut_spec], [@target_definition], nil)
@target.pod_targets = [@pod_target] @target.stubs(:pod_targets).returns([@pod_target])
@target.user_build_configurations = { @target.stubs(:user_build_configurations).returns('Debug' => :debug, 'Release' => :release)
'Debug' => :debug,
'Release' => :release,
}
end end
it 'returns non vendored framework input and output paths by config' do it 'returns non vendored framework input and output paths by config' do
...@@ -175,7 +165,7 @@ module Pod ...@@ -175,7 +165,7 @@ module Pod
@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)
@pod_target.stubs(:should_build?).returns(true) @pod_target.stubs(:should_build?).returns(true)
@pod_target.stubs(:requires_frameworks?).returns(true) @pod_target.stubs(:requires_frameworks?).returns(true)
@target.pod_targets = [@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 = @target.framework_paths_by_config
framework_paths_by_config['Debug'].should == [ framework_paths_by_config['Debug'].should == [
{ :name => 'BananaLib.framework', { :name => 'BananaLib.framework',
...@@ -254,8 +244,7 @@ module Pod ...@@ -254,8 +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(@pod_target.target_definitions.first, config.sandbox) @target = AggregateTarget.new(config.sandbox, false, {}, [], @pod_target.target_definitions.first, config.sandbox.root.dirname, nil, nil, [@pod_target])
@target.pod_targets = [@pod_target]
end end
it 'returns that it does not use swift' do it 'returns that it does not use swift' do
...@@ -264,7 +253,7 @@ module Pod ...@@ -264,7 +253,7 @@ module Pod
describe 'Host requires frameworks' do describe 'Host requires frameworks' do
before do before do
@target.host_requires_frameworks = true @target.stubs(:host_requires_frameworks?).returns(true)
end end
it 'returns the product name' do it 'returns the product name' do
...@@ -289,6 +278,10 @@ module Pod ...@@ -289,6 +278,10 @@ module Pod
end end
describe 'Host does not requires frameworks' do describe 'Host does not requires frameworks' do
before do
@target.stubs(:host_requires_frameworks?).returns(false)
end
it 'returns the product name' do it 'returns the product name' do
@target.product_name.should == 'libPods.a' @target.product_name.should == 'libPods.a'
end end
...@@ -314,10 +307,8 @@ module Pod ...@@ -314,10 +307,8 @@ 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(target_definition, config.sandbox)
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj') project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target.user_project = Xcodeproj::Project.open(project_path) @target = AggregateTarget.new(config.sandbox, true, {}, [], target_definition, config.sandbox.root.dirname, Xcodeproj::Project.open(project_path), ['A346496C14F9BE9A0080D870'], [@pod_target])
@target.user_target_uuids = ['A346496C14F9BE9A0080D870']
end end
it 'requires a host target for app extension targets' do it 'requires a host target for app extension targets' do
...@@ -356,8 +347,8 @@ module Pod ...@@ -356,8 +347,8 @@ module Pod
end end
it 'does not require a host target, if there is no user project (manual integration)' do it 'does not require a host target, if there is no user project (manual integration)' do
@target.user_project = nil @target.stubs(:user_project).returns(nil)
@target.user_target_uuids = [] @target.stubs(:user_target_uuids).returns([])
@target.requires_host_target?.should == false @target.requires_host_target?.should == false
end end
...@@ -376,10 +367,8 @@ module Pod ...@@ -376,10 +367,8 @@ 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(target_definition, config.sandbox)
project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj') project_path = SpecHelper.fixture('SampleProject/SampleProject.xcodeproj')
@target.user_project = Xcodeproj::Project.open(project_path) @target = AggregateTarget.new(config.sandbox, true, {}, [], target_definition, config.sandbox.root.dirname, Xcodeproj::Project.open(project_path), ['A346496C14F9BE9A0080D870'], [@pod_target])
@target.user_target_uuids = ['A346496C14F9BE9A0080D870']
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
...@@ -410,10 +399,8 @@ module Pod ...@@ -410,10 +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', [fixture_target_definition('iOS Example')]) @pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec', true, {}, [fixture_target_definition('iOS Example')])
@target = AggregateTarget.new(@pod_target.target_definitions.first, config.sandbox) @target = AggregateTarget.new(config.sandbox, true, {}, [], @pod_target.target_definitions.first, config.sandbox.root.dirname, nil, nil, [@pod_target])
@target.stubs(:requires_frameworks?).returns(true)
@target.pod_targets = [@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([spec], [@target_definition], config.sandbox) @pod_target = PodTarget.new(config.sandbox, false, {}, [], [spec], [@target_definition], nil)
@pod_target.stubs(:platform).returns(Platform.ios) @pod_target.stubs(:platform).returns(Platform.ios)
end end
...@@ -252,7 +252,7 @@ module Pod ...@@ -252,7 +252,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([monkey_spec], [@target_definition], config.sandbox) monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], [monkey_spec], [@target_definition], nil)
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
...@@ -270,7 +270,7 @@ module Pod ...@@ -270,7 +270,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([monkey_spec], [@target_definition], config.sandbox) monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], [monkey_spec], [@target_definition], nil)
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
...@@ -317,7 +317,7 @@ module Pod ...@@ -317,7 +317,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([monkey_spec], [@target_definition], config.sandbox) monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], [monkey_spec], [@target_definition], nil)
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
...@@ -332,7 +332,7 @@ module Pod ...@@ -332,7 +332,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([monkey_spec], [@target_definition], config.sandbox) monkey_pod_target = PodTarget.new(config.sandbox, false, {}, [], [monkey_spec], [@target_definition], nil)
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
...@@ -357,7 +357,7 @@ module Pod ...@@ -357,7 +357,7 @@ module Pod
describe 'Host requires frameworks' do describe 'Host requires frameworks' do
before do before do
@pod_target.host_requires_frameworks = true @pod_target = fixture_pod_target('banana-lib/BananaLib.podspec', true)
end end
it 'returns the product name' do it 'returns the product name' do
...@@ -413,8 +413,7 @@ module Pod ...@@ -413,8 +413,7 @@ module Pod
describe 'With frameworks' do describe 'With frameworks' do
before do before do
@pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec') @pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec', true)
@pod_target.host_requires_frameworks = true
end end
it 'returns that it uses swift' do it 'returns that it uses swift' do
...@@ -490,7 +489,7 @@ module Pod ...@@ -490,7 +489,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([@coconut_spec, *@coconut_spec.recursive_subspecs], [@test_spec_target_definition], config.sandbox) @test_pod_target = PodTarget.new(config.sandbox, false, {}, [], [@coconut_spec, *@coconut_spec.recursive_subspecs], [@test_spec_target_definition], nil)
@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 @target = Target.new(config.sandbox, false, {}, [])
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