Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
63876613
Commit
63876613
authored
Mar 30, 2018
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move file accessor creation into analyzer and make them part of initializer
parent
7813c5f0
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
153 additions
and
163 deletions
+153
-163
installer.rb
lib/cocoapods/installer.rb
+0
-8
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+52
-4
sandbox.rb
lib/cocoapods/sandbox.rb
+0
-23
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+0
-1
pod_target.rb
lib/cocoapods/target/pod_target.rb
+45
-57
spec_helper.rb
spec/spec_helper.rb
+6
-14
aggregate_target_installer_spec.rb
...pods_project_generator/aggregate_target_installer_spec.rb
+1
-2
file_references_installer_spec.rb
.../pods_project_generator/file_references_installer_spec.rb
+3
-6
pod_target_installer_spec.rb
...xcode/pods_project_generator/pod_target_installer_spec.rb
+15
-23
pod_target_integrator_spec.rb
...code/pods_project_generator/pod_target_integrator_spec.rb
+1
-1
target_installer_spec.rb
...ler/xcode/pods_project_generator/target_installer_spec.rb
+3
-3
pods_project_generator_spec.rb
spec/unit/installer/xcode/pods_project_generator_spec.rb
+9
-10
target_validator_spec.rb
spec/unit/installer/xcode/target_validator_spec.rb
+1
-2
installer_spec.rb
spec/unit/installer_spec.rb
+0
-1
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+5
-5
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+12
-3
No files found.
lib/cocoapods/installer.rb
View file @
63876613
...
@@ -160,7 +160,6 @@ module Pod
...
@@ -160,7 +160,6 @@ module Pod
def
download_dependencies
def
download_dependencies
UI
.
section
'Downloading dependencies'
do
UI
.
section
'Downloading dependencies'
do
create_file_accessors
install_pod_sources
install_pod_sources
run_podfile_pre_install_hooks
run_podfile_pre_install_hooks
clean_pod_sources
clean_pod_sources
...
@@ -302,13 +301,6 @@ module Pod
...
@@ -302,13 +301,6 @@ module Pod
end
end
end
end
# @return [void] In this step we create the file accessors for the pod
# targets.
#
def
create_file_accessors
sandbox
.
create_file_accessors
(
pod_targets
)
end
# Downloads, installs the documentation and cleans the sources of the Pods
# Downloads, installs the documentation and cleans the sources of the Pods
# which need to be installed.
# which need to be installed.
#
#
...
...
lib/cocoapods/installer/analyzer.rb
View file @
63876613
...
@@ -591,7 +591,7 @@ module Pod
...
@@ -591,7 +591,7 @@ module Pod
# @param [TargetDefinitions] target_definitions
# @param [TargetDefinitions] target_definitions
# the aggregate target
# the aggregate target
#
#
# @param [Array<Specification>]
pod_
specs
# @param [Array<Specification>] specs
# the specifications of an equal root.
# the specifications of an equal root.
#
#
# @param [String] scope_suffix
# @param [String] scope_suffix
...
@@ -599,7 +599,7 @@ module Pod
...
@@ -599,7 +599,7 @@ module Pod
#
#
# @return [PodTarget]
# @return [PodTarget]
#
#
def
generate_pod_target
(
target_definitions
,
pod_
specs
,
scope_suffix:
nil
)
def
generate_pod_target
(
target_definitions
,
specs
,
scope_suffix:
nil
)
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
user_build_configurations
=
target_inspections
.
map
(
&
:build_configurations
).
reduce
({},
&
:merge
)
user_build_configurations
=
target_inspections
.
map
(
&
:build_configurations
).
reduce
({},
&
:merge
)
...
@@ -611,8 +611,56 @@ module Pod
...
@@ -611,8 +611,56 @@ module Pod
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
,
host_requires_frameworks
=
target_definitions
.
any?
(
&
:uses_frameworks?
)
target_definitions
,
scope_suffix
)
platform
=
determine_platform
(
specs
,
target_definitions
,
host_requires_frameworks
)
file_accessors
=
create_file_accessors
(
specs
,
platform
)
PodTarget
.
new
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
specs
,
target_definitions
,
platform
,
file_accessors
,
scope_suffix
)
end
# Creates the file accessors for a given pod.
#
# @param [Array<Specification>] specs
# the specs to map each file accessor to.
#
# @param [Platform] platform
# the platform to use when generating each file accessor.
#
# @return [Array<FileAccessor>]
#
def
create_file_accessors
(
specs
,
platform
)
name
=
specs
.
first
.
name
pod_root
=
sandbox
.
pod_dir
(
name
)
path_list
=
Sandbox
::
PathList
.
new
(
pod_root
)
specs
.
map
do
|
spec
|
Sandbox
::
FileAccessor
.
new
(
path_list
,
spec
.
consumer
(
platform
))
end
end
# Calculates and returns the platform to use for the given list of specs and target definitions.
#
# @param [Array<Specification>] specs
# the specs to inspect and calculate the platform for.
#
# @param [Array<TargetDefinition>] target_definitions
# the target definitions these specs are part of.
#
# @param [Boolean] host_requires_frameworks
# whether the platform is calculated for a target that needs to be packaged as a framework.
#
# @return [Platform]
#
def
determine_platform
(
specs
,
target_definitions
,
host_requires_frameworks
)
platform_name
=
target_definitions
.
first
.
platform
.
name
default
=
Podfile
::
TargetDefinition
::
PLATFORM_DEFAULTS
[
platform_name
]
deployment_target
=
specs
.
map
do
|
spec
|
Version
.
new
(
spec
.
deployment_target
(
platform_name
)
||
default
)
end
.
max
if
platform_name
==
:ios
&&
host_requires_frameworks
minimum
=
Version
.
new
(
'8.0'
)
deployment_target
=
[
deployment_target
,
minimum
].
max
end
Platform
.
new
(
platform_name
,
deployment_target
)
end
end
# Generates dependencies that require the specific version of the Pods
# Generates dependencies that require the specific version of the Pods
...
...
lib/cocoapods/sandbox.rb
View file @
63876613
...
@@ -393,28 +393,5 @@ module Pod
...
@@ -393,28 +393,5 @@ module Pod
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
public
# @!group Pods Helpers
# Creates the file accessors for the given Pod Targets.
#
# @param [Array<PodTarget>] pod_targets
# The Pod Targets to create file accessors for.
#
def
create_file_accessors
(
pod_targets
)
pod_targets
.
each
do
|
pod_target
|
pod_root
=
pod_dir
(
pod_target
.
root_spec
.
name
)
path_list
=
PathList
.
new
(
pod_root
)
file_accessors
=
pod_target
.
specs
.
map
do
|
spec
|
FileAccessor
.
new
(
path_list
,
spec
.
consumer
(
pod_target
.
platform
))
end
pod_target
.
file_accessors
||=
[]
pod_target
.
file_accessors
.
concat
(
file_accessors
)
end
end
#-------------------------------------------------------------------------#
end
end
end
end
lib/cocoapods/target/aggregate_target.rb
View file @
63876613
...
@@ -71,7 +71,6 @@ module Pod
...
@@ -71,7 +71,6 @@ module Pod
@user_target_uuids
=
user_target_uuids
@user_target_uuids
=
user_target_uuids
@pod_targets
=
pod_targets
@pod_targets
=
pod_targets
@search_paths_aggregate_targets
=
[]
@search_paths_aggregate_targets
=
[]
@file_accessors
=
[]
@xcconfigs
=
{}
@xcconfigs
=
{}
end
end
...
...
lib/cocoapods/target/pod_target.rb
View file @
63876613
module
Pod
module
Pod
# Stores the information relative to the target used to compile a single Pod.
# Stores the information relative to the target used to compile a single Pod.
# A pod can have one or more activated spec
/sub
specs.
# A pod can have one or more activated spec
, subspecs and test
specs.
#
#
class
PodTarget
<
Target
class
PodTarget
<
Target
# @return [Array<Specification>] the spec
and subspecs for
the target.
# @return [Array<Specification>] the spec
, subspecs and test specs of
the target.
#
#
attr_reader
:specs
attr_reader
:specs
# @return [Array<Specification>] All of the test specs within this target.
# Subset of #specs.
#
attr_reader
:test_specs
# @return [Array<Specification>] All of the specs within this target that are not test specs.
# Subset of #specs.
#
attr_reader
:non_test_specs
# @return [Array<TargetDefinition>] the target definitions of the Podfile
# @return [Array<TargetDefinition>] the target definitions of the Podfile
# that generated this target.
# that generated this target.
#
#
attr_reader
:target_definitions
attr_reader
:target_definitions
# @return [HeadersStore] the header directory for the target.
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
# specifications of this target.
#
#
attr_reader
:build_headers
attr_reader
:file_accessors
# @return [Platform] the platform of this target.
#
attr_reader
:platform
# @return [String] the suffix used for this target when deduplicated. May be `nil`.
# @return [String] the suffix used for this target when deduplicated. May be `nil`.
#
#
...
@@ -23,6 +38,10 @@ module Pod
...
@@ -23,6 +38,10 @@ module Pod
#
#
attr_reader
:scope_suffix
attr_reader
:scope_suffix
# @return [HeadersStore] the header directory for the target.
#
attr_reader
:build_headers
# @return [Array<PodTarget>] the targets that this target has a dependency
# @return [Array<PodTarget>] the targets that this target has a dependency
# upon.
# upon.
#
#
...
@@ -38,27 +57,40 @@ module Pod
...
@@ -38,27 +57,40 @@ module Pod
#
#
attr_accessor
:test_native_targets
attr_accessor
:test_native_targets
# @return [Array<PBXNativeTarget>] the resource bundle targets belonging
# to this target.
#
attr_reader
:resource_bundle_targets
# @return [Array<PBXNativeTarget>] the resource bundle test targets belonging
# to this target.
#
attr_reader
:test_resource_bundle_targets
# Initialize a new instance
# Initialize a new instance
#
#
# @param [Sandbox] sandbox @see Target#sandbox
# @param [Sandbox] sandbox @see Target#sandbox
# @param [Boolean] host_requires_frameworks @see Target#host_requires_frameworks
# @param [Boolean] host_requires_frameworks @see Target#host_requires_frameworks
# @param [Hash{String=>Symbol}] user_build_configurations @see Target#user_build_configurations
# @param [Hash{String=>Symbol}] user_build_configurations @see Target#user_build_configurations
# @param [Array<String>] archs @see Target#archs
# @param [Array<String>] archs @see Target#archs
# @param [Platform] platform @see #platform
# @param [Array<TargetDefinition>] target_definitions @see #target_definitions
# @param [Array<TargetDefinition>] target_definitions @see #target_definitions
# @param [Array<Sandbox::FileAccessor>] file_accessors @see #file_accessors
# @param [String] scope_suffix @see #scope_suffix
# @param [String] scope_suffix @see #scope_suffix
#
#
def
initialize
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
specs
,
target_definitions
,
scope_suffix
=
nil
)
def
initialize
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
specs
,
target_definitions
,
platform
,
file_accessors
=
[],
scope_suffix
=
nil
)
super
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
)
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
==
''
@specs
=
specs
.
dup
.
freeze
@specs
=
specs
.
dup
.
freeze
@test_specs
,
@non_test_specs
=
@specs
.
partition
(
&
:test_specification?
)
@target_definitions
=
target_definitions
@target_definitions
=
target_definitions
@platform
=
platform
@file_accessors
=
file_accessors
@scope_suffix
=
scope_suffix
@scope_suffix
=
scope_suffix
@test_specs
,
@non_test_specs
=
@specs
.
partition
(
&
:test_specification?
)
@build_headers
=
Sandbox
::
HeadersStore
.
new
(
sandbox
,
'Private'
,
:private
)
@build_headers
=
Sandbox
::
HeadersStore
.
new
(
sandbox
,
'Private'
,
:private
)
@file_accessors
=
[]
@resource_bundle_targets
=
[]
@resource_bundle_targets
=
[]
@test_resource_bundle_targets
=
[]
@test_resource_bundle_targets
=
[]
@test_native_targets
=
[]
@test_native_targets
=
[]
...
@@ -67,8 +99,11 @@ module Pod
...
@@ -67,8 +99,11 @@ module Pod
@build_config_cache
=
{}
@build_config_cache
=
{}
end
end
# Scopes the current target based on the existing pod targets within the cache.
#
# @param [Hash{Array => PodTarget}] cache
# @param [Hash{Array => PodTarget}] cache
# the cached PodTarget for a previously scoped (specs, target_definition)
# the cached target for a previously scoped target.
#
# @return [Array<PodTarget>] a scoped copy for each target definition.
# @return [Array<PodTarget>] a scoped copy for each target definition.
#
#
def
scoped
(
cache
=
{})
def
scoped
(
cache
=
{})
...
@@ -77,10 +112,10 @@ module Pod
...
@@ -77,10 +112,10 @@ module Pod
if
cache
[
cache_key
]
if
cache
[
cache_key
]
cache
[
cache_key
]
cache
[
cache_key
]
else
else
target
=
PodTarget
.
new
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
specs
,
[
target_definition
],
target_definition
.
label
)
target
=
PodTarget
.
new
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
specs
,
[
target_definition
],
platform
,
file_accessors
,
target_definition
.
label
)
target
.
file_accessors
=
file_accessors
target
.
native_target
=
native_target
target
.
native_target
=
native_target
target
.
dependent_targets
=
dependent_targets
.
flat_map
{
|
pt
|
pt
.
scoped
(
cache
)
}.
select
{
|
pt
|
pt
.
target_definitions
==
[
target_definition
]
}
target
.
dependent_targets
=
dependent_targets
.
flat_map
{
|
pt
|
pt
.
scoped
(
cache
)
}.
select
{
|
pt
|
pt
.
target_definitions
==
[
target_definition
]
}
target
.
test_dependent_targets
=
test_dependent_targets
.
flat_map
{
|
pt
|
pt
.
scoped
(
cache
)
}.
select
{
|
pt
|
pt
.
target_definitions
==
[
target_definition
]
}
cache
[
cache_key
]
=
target
cache
[
cache_key
]
=
target
end
end
end
end
...
@@ -110,32 +145,6 @@ module Pod
...
@@ -110,32 +145,6 @@ module Pod
root_spec
.
swift_version
root_spec
.
swift_version
end
end
# @note The deployment target for the pod target is the maximum of all
# the deployment targets for the current platform of the target
# (or the minimum required to support the current installation
# strategy, if higher).
#
# @return [Platform] the platform for this target.
#
def
platform
@platform
||=
begin
platform_name
=
target_definitions
.
first
.
platform
.
name
default
=
Podfile
::
TargetDefinition
::
PLATFORM_DEFAULTS
[
platform_name
]
deployment_target
=
specs
.
map
do
|
spec
|
Version
.
new
(
spec
.
deployment_target
(
platform_name
)
||
default
)
end
.
max
if
platform_name
==
:ios
&&
requires_frameworks?
minimum
=
Version
.
new
(
'8.0'
)
deployment_target
=
[
deployment_target
,
minimum
].
max
end
Platform
.
new
(
platform_name
,
deployment_target
)
end
end
# @visibility private
#
attr_writer
:platform
# @return [Podfile] The podfile which declares the dependency.
# @return [Podfile] The podfile which declares the dependency.
#
#
def
podfile
def
podfile
...
@@ -150,19 +159,6 @@ module Pod
...
@@ -150,19 +159,6 @@ module Pod
root_spec
.
module_name
root_spec
.
module_name
end
end
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
# specifications of this target.
#
attr_accessor
:file_accessors
# @return [Array<PBXNativeTarget>] the resource bundle targets belonging
# to this target.
attr_reader
:resource_bundle_targets
# @return [Array<PBXNativeTarget>] the resource bundle test targets belonging
# to this target.
attr_reader
:test_resource_bundle_targets
# @return [Bool] Whether or not this target should be built.
# @return [Bool] Whether or not this target should be built.
#
#
# A target should not be built if it has no source files.
# A target should not be built if it has no source files.
...
@@ -234,14 +230,6 @@ module Pod
...
@@ -234,14 +230,6 @@ module Pod
!
test_specs
.
empty?
!
test_specs
.
empty?
end
end
# @return [Array<Specification>] All of the test specs within this target.
#
attr_reader
:test_specs
# @return [Array<Specification>] All of the specs within this target that are not test specs.
#
attr_reader
:non_test_specs
# @return [Array<Symbol>] All of the test supported types within this target.
# @return [Array<Symbol>] All of the test supported types within this target.
#
#
def
supported_test_types
def
supported_test_types
...
...
spec/spec_helper.rb
View file @
63876613
...
@@ -119,27 +119,19 @@ end
...
@@ -119,27 +119,19 @@ end
def
fixture_target_definition
(
name
=
'Pods'
,
platform
=
Pod
::
Platform
.
ios
)
def
fixture_target_definition
(
name
=
'Pods'
,
platform
=
Pod
::
Platform
.
ios
)
platform_hash
=
{
platform
.
symbolic_name
=>
platform
.
deployment_target
}
platform_hash
=
{
platform
.
symbolic_name
=>
platform
.
deployment_target
}
parent
=
Pod
::
Podfile
.
new
parent
=
Pod
::
Podfile
.
new
Pod
::
Podfile
::
TargetDefinition
.
new
(
name
,
parent
,
Pod
::
Podfile
::
TargetDefinition
.
new
(
name
,
parent
,
'abstract'
=>
false
,
'name'
=>
name
,
'platform'
=>
platform_hash
)
'abstract'
=>
false
,
'name'
=>
name
,
'platform'
=>
platform_hash
)
end
end
def
fixture_pod_target
(
spec_or_name
,
host_requires_frameworks
=
false
,
user_build_configurations
=
{},
target_definitions
=
[])
def
fixture_pod_target
(
spec_or_name
,
host_requires_frameworks
=
false
,
user_build_configurations
=
{},
target_definitions
=
[]
,
platform
=
Pod
::
Platform
.
ios
)
spec
=
spec_or_name
.
is_a?
(
Pod
::
Specification
)
?
spec_or_name
:
fixture_spec
(
spec_or_name
)
spec
=
spec_or_name
.
is_a?
(
Pod
::
Specification
)
?
spec_or_name
:
fixture_spec
(
spec_or_name
)
fixture_pod_target_with_specs
([
spec
],
host_requires_frameworks
,
user_build_configurations
,
target_definitions
)
fixture_pod_target_with_specs
([
spec
],
host_requires_frameworks
,
user_build_configurations
,
target_definitions
,
platform
)
end
end
def
fixture_pod_target_with_specs
(
specs
,
host_requires_frameworks
=
false
,
user_build_configurations
=
{},
target_definitions
=
[])
def
fixture_pod_target_with_specs
(
specs
,
host_requires_frameworks
=
false
,
user_build_configurations
=
{},
target_definitions
=
[]
,
platform
=
Pod
::
Platform
.
ios
)
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
(
config
.
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
[],
specs
,
target_definitions
,
nil
).
tap
do
|
pod_target
|
file_accessors
=
specs
.
map
{
|
spec
|
fixture_file_accessor
(
spec
,
platform
)
}
specs
.
each
do
|
spec
|
Pod
::
PodTarget
.
new
(
config
.
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
[],
specs
,
target_definitions
,
platform
,
file_accessors
)
pod_target
.
file_accessors
<<
fixture_file_accessor
(
spec
,
pod_target
.
platform
)
consumer
=
spec
.
consumer
(
pod_target
.
platform
)
pod_target
.
spec_consumers
<<
consumer
end
end
end
end
def
fixture_aggregate_target
(
pod_targets
=
[],
target_definition
=
nil
)
def
fixture_aggregate_target
(
pod_targets
=
[],
target_definition
=
nil
)
...
...
spec/unit/installer/xcode/pods_project_generator/aggregate_target_installer_spec.rb
View file @
63876613
...
@@ -28,8 +28,7 @@ module Pod
...
@@ -28,8 +28,7 @@ module Pod
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
[
@spec
],
[
@target_definition
],
nil
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
[
@spec
],
[
@target_definition
],
Platform
.
ios
,
[
file_accessor
])
@pod_target
.
file_accessors
=
[
file_accessor
]
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
...
...
spec/unit/installer/xcode/pods_project_generator/file_references_installer_spec.rb
View file @
63876613
...
@@ -196,18 +196,15 @@ module Pod
...
@@ -196,18 +196,15 @@ module Pod
describe
'Private Helpers'
do
describe
'Private Helpers'
do
describe
'#file_accessors'
do
describe
'#file_accessors'
do
it
'returns the file accessors'
do
it
'returns the file accessors'
do
pod_target_1
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
nil
)
pod_target_1
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
Platform
.
ios
,
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)])
pod_target_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_2
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
Platform
.
ios
,
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)])
pod_target_2
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
nil
)
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
}
roots
.
should
==
[
fixture
(
'banana-lib'
),
fixture
(
'banana-lib'
)]
roots
.
should
==
[
fixture
(
'banana-lib'
),
fixture
(
'banana-lib'
)]
end
end
it
'handles pods without file accessors'
do
it
'handles pods without file accessors'
do
pod_target_1
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
nil
)
pod_target_1
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
stub
(
'Spec'
,
:test_specification?
=>
false
)],
[
fixture_target_definition
],
Platform
.
ios
,
[])
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
==
[]
end
end
...
...
spec/unit/installer/xcode/pods_project_generator/pod_target_installer_spec.rb
View file @
63876613
...
@@ -29,21 +29,13 @@ module Pod
...
@@ -29,21 +29,13 @@ module Pod
@project
.
add_file_reference
(
resource
,
group
)
@project
.
add_file_reference
(
resource
,
group
)
end
end
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{
'Debug'
=>
:debug
,
'Release'
=>
:release
},
[],
[
@spec
],
[
@target_definition
],
nil
)
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
}
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
[
@spec
],
[
@target_definition
],
Platform
.
new
(
:ios
,
'4.3'
),
[
file_accessor
])
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
end
end
it
'uses the maximum of all spec deployment targets'
do
spec_1
=
Pod
::
Specification
.
new
{
|
s
|
s
.
ios
.
deployment_target
=
'10.10'
}
spec_2
=
Pod
::
Specification
.
new
{
|
s
|
s
.
ios
.
deployment_target
=
'10.9'
}
spec_3
=
Pod
::
Specification
.
new
@pod_target
.
stubs
(
:specs
).
returns
([
spec_1
,
spec_2
,
spec_3
])
@installer
.
send
(
:deployment_target
).
should
==
'10.10'
end
it
'sets the platform and the deployment target for iOS targets'
do
it
'sets the platform and the deployment target for iOS targets'
do
@installer
.
install!
@installer
.
install!
target
=
@project
.
targets
.
first
target
=
@project
.
targets
.
first
...
@@ -53,6 +45,7 @@ module Pod
...
@@ -53,6 +45,7 @@ module Pod
end
end
it
'sets the platform and the deployment target for iOS targets that require frameworks'
do
it
'sets the platform and the deployment target for iOS targets that require frameworks'
do
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'8.0'
))
@pod_target
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
@pod_target
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
@installer
.
install!
@installer
.
install!
target
=
@project
.
targets
.
first
target
=
@project
.
targets
.
first
...
@@ -62,7 +55,7 @@ module Pod
...
@@ -62,7 +55,7 @@ module Pod
end
end
it
'sets the platform and the deployment target for OS X targets'
do
it
'sets the platform and the deployment target for OS X targets'
do
@pod_target
.
target_definitions
.
first
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.8
'
))
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.6
'
))
@installer
.
install!
@installer
.
install!
target
=
@project
.
targets
.
first
target
=
@project
.
targets
.
first
target
.
platform_name
.
should
==
:osx
target
.
platform_name
.
should
==
:osx
...
@@ -179,11 +172,12 @@ module Pod
...
@@ -179,11 +172,12 @@ module Pod
@project
.
add_file_reference
(
resource
,
group
)
@project
.
add_file_reference
(
resource
,
group
)
end
end
@coconut_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{
'Debug'
=>
:debug
,
'Release'
=>
:release
},
[],
[
@coconut_spec
,
*
@coconut_spec
.
recursive_subspecs
],
[
@target_definition
],
nil
)
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
}
@coconut_pod_target
.
file_accessors
=
[
file_accessor
,
test_file_accessor
]
all_specs
=
[
@coconut_spec
,
*
@coconut_spec
.
recursive_subspecs
]
file_accessors
=
[
file_accessor
,
test_file_accessor
]
@coconut_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
all_specs
,
[
@target_definition
],
Platform
.
new
(
:ios
,
'6.0'
),
file_accessors
)
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@coconut_pod_target
)
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@coconut_pod_target
)
@coconut_pod_target2
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{
'Debug'
=>
:debug
,
'Release'
=>
:release
},
[],
[
@coconut_spec
,
*
@coconut_spec
.
recursive_subspecs
],
[
@target_definition2
],
nil
)
@coconut_pod_target2
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
all_specs
,
[
@target_definition2
],
Platform
.
new
(
:osx
,
'10.8'
),
file_accessors
)
@coconut_pod_target2
.
file_accessors
=
[
file_accessor
,
test_file_accessor
]
@installer2
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@coconut_pod_target2
)
@installer2
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@coconut_pod_target2
)
end
end
...
@@ -375,8 +369,7 @@ module Pod
...
@@ -375,8 +369,7 @@ module Pod
@project
.
add_file_reference
(
file
,
group
)
if
file
.
fnmatch?
(
'*.m'
)
||
file
.
fnmatch?
(
'*.h'
)
@project
.
add_file_reference
(
file
,
group
)
if
file
.
fnmatch?
(
'*.m'
)
||
file
.
fnmatch?
(
'*.h'
)
end
end
@minions_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{
'Debug'
=>
:debug
,
'Release'
=>
:release
},
[],
[
@minions_spec
,
*
@minions_spec
.
recursive_subspecs
],
[
@target_definition
],
nil
)
@minions_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{
'Debug'
=>
:debug
,
'Release'
=>
:release
},
[],
[
@minions_spec
,
*
@minions_spec
.
recursive_subspecs
],
[
@target_definition
],
Platform
.
ios
,
[
file_accessor
])
@minions_pod_target
.
file_accessors
=
[
file_accessor
]
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@minions_pod_target
)
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@minions_pod_target
)
@first_json_file
=
file_accessor
.
source_files
.
find
{
|
sf
|
sf
.
extname
==
'.json'
}
@first_json_file
=
file_accessor
.
source_files
.
find
{
|
sf
|
sf
.
extname
==
'.json'
}
...
@@ -418,7 +411,7 @@ module Pod
...
@@ -418,7 +411,7 @@ module Pod
File
.
symlink
(
file_path
,
@source_symlink_file
)
File
.
symlink
(
file_path
,
@source_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Errno
::
ENOENT
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Errno
::
ENOENT
exception
.
message
.
should
.
include
'No such file or directory'
exception
.
message
.
should
.
include
'No such file or directory'
exception
.
message
.
should
.
include
file_path
.
to_s
exception
.
message
.
should
.
include
file_path
.
to_s
...
@@ -429,7 +422,7 @@ module Pod
...
@@ -429,7 +422,7 @@ module Pod
File
.
symlink
(
file_path
,
@header_symlink_file
)
File
.
symlink
(
file_path
,
@header_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Errno
::
ENOENT
exception
=
lambda
{
@installer
.
install!
}.
should
.
raise
Errno
::
ENOENT
exception
.
message
.
should
.
include
'No such file or directory'
exception
.
message
.
should
.
include
'No such file or directory'
exception
.
message
.
should
.
include
file_path
.
to_s
exception
.
message
.
should
.
include
file_path
.
to_s
...
@@ -439,7 +432,7 @@ module Pod
...
@@ -439,7 +432,7 @@ module Pod
File
.
symlink
(
@first_header_file
,
@header_symlink_file
)
File
.
symlink
(
@first_header_file
,
@header_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
group
=
@project
.
group_for_spec
(
'BananaLib'
)
group
=
@project
.
group_for_spec
(
'BananaLib'
)
@project
.
add_file_reference
(
@header_symlink_file
.
to_s
,
group
)
@project
.
add_file_reference
(
@header_symlink_file
.
to_s
,
group
)
lambda
{
@installer
.
install!
}.
should
.
not
.
raise
lambda
{
@installer
.
install!
}.
should
.
not
.
raise
...
@@ -449,7 +442,7 @@ module Pod
...
@@ -449,7 +442,7 @@ module Pod
File
.
symlink
(
@first_source_file
,
@source_symlink_file
)
File
.
symlink
(
@first_source_file
,
@source_symlink_file
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
group
=
@project
.
group_for_spec
(
'BananaLib'
)
group
=
@project
.
group_for_spec
(
'BananaLib'
)
@project
.
add_file_reference
(
@source_symlink_file
.
to_s
,
group
)
@project
.
add_file_reference
(
@source_symlink_file
.
to_s
,
group
)
lambda
{
@installer
.
install!
}.
should
.
not
.
raise
lambda
{
@installer
.
install!
}.
should
.
not
.
raise
...
@@ -486,8 +479,7 @@ module Pod
...
@@ -486,8 +479,7 @@ module Pod
@project
.
add_file_reference
(
resource
,
group
)
@project
.
add_file_reference
(
resource
,
group
)
end
end
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{
'Debug'
=>
:debug
,
'Release'
=>
:release
},
[],
[
@spec
],
[
@target_definition
],
nil
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{
'Debug'
=>
:debug
,
'Release'
=>
:release
},
[],
[
@spec
],
[
@target_definition
],
Platform
.
ios
,
[
file_accessor
])
@pod_target
.
file_accessors
=
[
file_accessor
]
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
@installer
=
PodTargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
end
end
...
...
spec/unit/installer/xcode/pods_project_generator/pod_target_integrator_spec.rb
View file @
63876613
...
@@ -11,7 +11,7 @@ module Pod
...
@@ -11,7 +11,7 @@ module Pod
@project
.
save
@project
.
save
@target_definition
=
fixture_target_definition
@target_definition
=
fixture_target_definition
@coconut_spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
@coconut_spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
@coconut_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
@coconut_spec
,
*
@coconut_spec
.
recursive_subspecs
],
[
@target_definition
],
nil
)
@coconut_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
@coconut_spec
,
*
@coconut_spec
.
recursive_subspecs
],
[
@target_definition
],
Platform
.
ios
)
@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
)
...
...
spec/unit/installer/xcode/pods_project_generator/target_installer_spec.rb
View file @
63876613
...
@@ -24,9 +24,9 @@ module Pod
...
@@ -24,9 +24,9 @@ module Pod
@project
.
add_file_reference
(
file
,
group
)
@project
.
add_file_reference
(
file
,
group
)
end
end
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
},
[
'$(ARCHS_STANDARD_64_BIT)'
],
[
@spec
],
[
@target_definition
],
nil
)
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
archs
=
[
'$(ARCHS_STANDARD_64_BIT)'
]
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
archs
,
[
@spec
],
[
@target_definition
],
Platform
.
ios
,
[
file_accessor
])
@installer
=
TargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
@installer
=
TargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
end
end
...
...
spec/unit/installer/xcode/pods_project_generator_spec.rb
View file @
63876613
...
@@ -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
(
config
.
sandbox
,
false
,
{},
[],
[
spec
],
[
target_definition
],
nil
)
pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
],
[
target_definition
],
Platform
.
ios
)
@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
(
config
.
sandbox
,
false
,
{},
[],
[
spec
],
[
target_definition
],
nil
)
pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
],
[
target_definition
],
Platform
.
ios
)
@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,16 +181,15 @@ module Pod
...
@@ -181,16 +181,15 @@ module Pod
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
@installer
.
podfile
.
root_target_definitions
.
first
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
@installer
.
podfile
.
root_target_definitions
.
first
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
],
[
target_definition
],
nil
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
],
[
target_definition
],
Platform
.
ios
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
@mock_target
=
mock
(
'PodNativeTarget'
)
@mock_target
=
mock
(
'PodNativeTarget'
)
mock_project
=
mock
(
'PodsProject'
,
:frameworks_group
=>
mock
(
'FrameworksGroup'
))
mock_project
=
mock
(
'PodsProject'
,
:frameworks_group
=>
mock
(
'FrameworksGroup'
))
@generator
.
stubs
(
:project
).
returns
(
mock_project
)
@generator
.
stubs
(
:project
).
returns
(
mock_project
)
@target
.
stubs
(
:native_target
).
returns
(
@mock_target
)
@target
.
stubs
(
:native_target
).
returns
(
@mock_target
)
@
target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
])
@
generator
.
stubs
(
:pod_targets
).
returns
([
@pod_target
])
@generator
.
stubs
(
:aggregate_targets
).
returns
([
@target
])
@generator
.
stubs
(
:aggregate_targets
).
returns
([
@target
])
end
end
...
@@ -267,8 +266,8 @@ module Pod
...
@@ -267,8 +266,8 @@ module Pod
spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
@installer
.
podfile
.
root_target_definitions
.
first
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
@installer
.
podfile
.
root_target_definitions
.
first
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
,
*
spec
.
recursive_subspecs
],
[
target_definition
],
nil
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
,
*
spec
.
recursive_subspecs
],
[
target_definition
],
Platform
.
ios
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
@mock_target
=
mock
(
'PodNativeTarget'
)
@mock_target
=
mock
(
'PodNativeTarget'
)
...
@@ -276,7 +275,7 @@ module Pod
...
@@ -276,7 +275,7 @@ module Pod
@generator
.
stubs
(
:project
).
returns
(
mock_project
)
@generator
.
stubs
(
:project
).
returns
(
mock_project
)
@target
.
stubs
(
:native_target
).
returns
(
@mock_target
)
@target
.
stubs
(
:native_target
).
returns
(
@mock_target
)
@
target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
])
@
generator
.
stubs
(
:pod_targets
).
returns
([
@pod_target
])
@generator
.
stubs
(
:aggregate_targets
).
returns
([
@target
])
@generator
.
stubs
(
:aggregate_targets
).
returns
([
@target
])
end
end
...
@@ -470,7 +469,7 @@ module Pod
...
@@ -470,7 +469,7 @@ module Pod
it
'shares test schemes'
do
it
'shares test schemes'
do
spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
@installer
.
podfile
.
root_target_definitions
.
first
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
@installer
.
podfile
.
root_target_definitions
.
first
)
pod_target
=
Pod
::
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
,
*
spec
.
recursive_subspecs
],
[
target_definition
],
nil
)
pod_target
=
Pod
::
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
,
*
spec
.
recursive_subspecs
],
[
target_definition
],
Platform
.
ios
)
pod_target
.
stubs
(
:should_build?
).
returns
(
true
)
pod_target
.
stubs
(
:should_build?
).
returns
(
true
)
@generator
.
installation_options
.
@generator
.
installation_options
.
...
...
spec/unit/installer/xcode/target_validator_spec.rb
View file @
63876613
...
@@ -22,14 +22,13 @@ module Pod
...
@@ -22,14 +22,13 @@ module Pod
options
.
integrate_targets
=
integrate_targets
options
.
integrate_targets
=
integrate_targets
end
end
@analyzer
=
Analyzer
.
new
(
config
.
sandbox
,
podfile
,
lockfile
).
tap
do
|
analyzer
|
@analyzer
=
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
).
tap
do
|
analyzer
|
analyzer
.
installation_options
=
installation_options
analyzer
.
installation_options
=
installation_options
end
end
result
=
@analyzer
.
analyze
result
=
@analyzer
.
analyze
aggregate_targets
=
result
.
targets
aggregate_targets
=
result
.
targets
pod_targets
=
aggregate_targets
.
flat_map
(
&
:pod_targets
).
uniq
pod_targets
=
aggregate_targets
.
flat_map
(
&
:pod_targets
).
uniq
sandbox
.
create_file_accessors
(
pod_targets
)
TargetValidator
.
new
(
aggregate_targets
,
pod_targets
)
TargetValidator
.
new
(
aggregate_targets
,
pod_targets
)
end
end
...
...
spec/unit/installer_spec.rb
View file @
63876613
...
@@ -74,7 +74,6 @@ module Pod
...
@@ -74,7 +74,6 @@ module Pod
it
'in runs the pre-install hooks before cleaning the Pod sources'
do
it
'in runs the pre-install hooks before cleaning the Pod sources'
do
@installer
.
unstub
(
:download_dependencies
)
@installer
.
unstub
(
:download_dependencies
)
@installer
.
stubs
(
:create_file_accessors
)
@installer
.
stubs
(
:install_pod_sources
)
@installer
.
stubs
(
:install_pod_sources
)
def
@installer
.
run_podfile_pre_install_hooks
def
@installer
.
run_podfile_pre_install_hooks
@hook_called
=
true
@hook_called
=
true
...
...
spec/unit/target/aggregate_target_spec.rb
View file @
63876613
...
@@ -87,13 +87,13 @@ module Pod
...
@@ -87,13 +87,13 @@ module Pod
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
abstract
=
false
@target_definition
.
abstract
=
false
@target_definition
.
set_platform
(
:ios
,
'10.0'
)
@target_definition
.
set_platform
(
:ios
,
'10.0'
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
@spec
],
[
@target_definition
],
nil
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
@spec
],
[
@target_definition
],
Platform
.
ios
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
end
end
describe
'with configuration dependent pod targets'
do
describe
'with configuration dependent pod targets'
do
before
do
before
do
@pod_target_release
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
@spec
],
[
@target_definition
],
nil
)
@pod_target_release
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
@spec
],
[
@target_definition
],
Platform
.
ios
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Debug'
).
returns
(
false
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Debug'
).
returns
(
false
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Release'
).
returns
(
true
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Release'
).
returns
(
true
)
@target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
,
@pod_target_release
])
@target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
,
@pod_target_release
])
...
@@ -116,7 +116,7 @@ module Pod
...
@@ -116,7 +116,7 @@ module Pod
describe
'frameworks by config and input output paths'
do
describe
'frameworks by config and input output paths'
do
before
do
before
do
@coconut_spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
@coconut_spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
@pod_target_release
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
@coconut_spec
],
[
@target_definition
],
nil
)
@pod_target_release
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
@coconut_spec
],
[
@target_definition
],
Platform
.
ios
)
@target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
])
@target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
])
@target
.
stubs
(
:user_build_configurations
).
returns
(
'Debug'
=>
:debug
,
'Release'
=>
:release
)
@target
.
stubs
(
:user_build_configurations
).
returns
(
'Debug'
=>
:debug
,
'Release'
=>
:release
)
end
end
...
@@ -185,7 +185,7 @@ module Pod
...
@@ -185,7 +185,7 @@ module Pod
it
'returns vendored frameworks by config'
do
it
'returns vendored frameworks by config'
do
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
@pod_target
.
file_accessors
.
first
.
stubs
(
:vendored_dynamic_artifacts
).
returns
(
@pod_target
.
file_accessors
.
first
.
stubs
(
:vendored_dynamic_artifacts
).
returns
(
[
Pathname
(
'/some/absolute/path/to/FrameworkA.framework'
)],
[
Pathname
(
'/some/absolute/path/to/FrameworkA.framework'
)],
)
)
...
@@ -214,7 +214,7 @@ module Pod
...
@@ -214,7 +214,7 @@ module Pod
it
'returns correct input and output paths for vendored frameworks'
do
it
'returns correct input and output paths for vendored frameworks'
do
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
@pod_target
.
file_accessors
.
first
.
stubs
(
:vendored_dynamic_artifacts
).
returns
(
@pod_target
.
file_accessors
.
first
.
stubs
(
:vendored_dynamic_artifacts
).
returns
(
[
Pathname
(
'/absolute/path/to/FrameworkA.framework'
)],
[
Pathname
(
'/absolute/path/to/FrameworkA.framework'
)],
)
)
...
...
spec/unit/target/pod_target_spec.rb
View file @
63876613
...
@@ -6,8 +6,7 @@ module Pod
...
@@ -6,8 +6,7 @@ module Pod
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
abstract
=
false
@target_definition
.
abstract
=
false
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
],
[
@target_definition
],
nil
)
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
[
spec
],
[
@target_definition
],
Platform
.
ios
)
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
ios
)
end
end
describe
'Meta'
do
describe
'Meta'
do
...
@@ -448,14 +447,24 @@ module Pod
...
@@ -448,14 +447,24 @@ module Pod
describe
'With dependencies'
do
describe
'With dependencies'
do
before
do
before
do
@pod_dependency
=
fixture_pod_target
(
'orange-framework/OrangeFramework.podspec'
)
@pod_dependency
=
fixture_pod_target
(
'orange-framework/OrangeFramework.podspec'
,
false
,
{},
@pod_target
.
target_definitions
)
@test_pod_dependency
=
fixture_pod_target
(
'matryoshka/matryoshka.podspec'
,
false
,
{},
@pod_target
.
target_definitions
)
@pod_target
.
dependent_targets
=
[
@pod_dependency
]
@pod_target
.
dependent_targets
=
[
@pod_dependency
]
@pod_target
.
test_dependent_targets
=
[
@test_pod_dependency
]
end
end
it
'resolves simple dependencies'
do
it
'resolves simple dependencies'
do
@pod_target
.
recursive_dependent_targets
.
should
==
[
@pod_dependency
]
@pod_target
.
recursive_dependent_targets
.
should
==
[
@pod_dependency
]
end
end
it
'scopes test and non test dependencies'
do
scoped_pod_target
=
@pod_target
.
scoped
scoped_pod_target
.
first
.
dependent_targets
.
count
.
should
==
1
scoped_pod_target
.
first
.
dependent_targets
.
first
.
name
.
should
==
'OrangeFramework-Pods'
scoped_pod_target
.
first
.
test_dependent_targets
.
count
.
should
==
1
scoped_pod_target
.
first
.
test_dependent_targets
.
first
.
name
.
should
==
'matryoshka-Pods'
end
describe
'With cyclic dependencies'
do
describe
'With cyclic dependencies'
do
before
do
before
do
@pod_dependency
=
fixture_pod_target
(
'orange-framework/OrangeFramework.podspec'
)
@pod_dependency
=
fixture_pod_target
(
'orange-framework/OrangeFramework.podspec'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment