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
8ef1a584
Commit
8ef1a584
authored
Apr 23, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move computing pod targets by config to the analyzer
For performance, since the analyzer has the dependency cache
parent
071e84d9
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
133 additions
and
112 deletions
+133
-112
CHANGELOG.md
CHANGELOG.md
+4
-0
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+40
-6
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+5
-7
pod_target.rb
lib/cocoapods/target/pod_target.rb
+0
-45
spec_helper.rb
spec/spec_helper.rb
+1
-1
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+56
-5
post_install_hooks_context_spec.rb
spec/unit/installer/post_install_hooks_context_spec.rb
+1
-1
xcconfig_integrator_spec.rb
..._integrator/target_integrator/xcconfig_integrator_spec.rb
+1
-1
target_integrator_spec.rb
...staller/user_project_integrator/target_integrator_spec.rb
+1
-1
user_project_integrator_spec.rb
spec/unit/installer/user_project_integrator_spec.rb
+2
-2
aggregate_target_installer_spec.rb
...pods_project_generator/aggregate_target_installer_spec.rb
+2
-1
pods_project_generator_spec.rb
spec/unit/installer/xcode/pods_project_generator_spec.rb
+1
-1
installer_spec.rb
spec/unit/installer_spec.rb
+3
-3
library_spec.rb
spec/unit/library_spec.rb
+2
-2
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+11
-11
aggregate_target_settings_spec.rb
...t/target/build_settings/aggregate_target_settings_spec.rb
+3
-3
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+0
-22
No files found.
CHANGELOG.md
View file @
8ef1a584
...
@@ -65,6 +65,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -65,6 +65,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Samuel Giddins
](
https://github.com/segiddins
)
[
Samuel Giddins
](
https://github.com/segiddins
)
*
Improve performance of grouping pods by configuration.
[
Samuel Giddins
](
https://github.com/segiddins
)
## 1.5.0 (2018-04-04)
## 1.5.0 (2018-04-04)
##### Enhancements
##### Enhancements
...
...
lib/cocoapods/installer/analyzer.rb
View file @
8ef1a584
...
@@ -448,7 +448,8 @@ module Pod
...
@@ -448,7 +448,8 @@ module Pod
end
end
end
end
platform
=
target_definition
.
platform
platform
=
target_definition
.
platform
pod_targets
=
filter_pod_targets_for_target_definition
(
target_definition
,
pod_targets
,
resolver_specs_by_target
)
build_configurations
=
user_build_configurations
.
keys
.
concat
(
target_definition
.
all_whitelisted_configurations
).
uniq
pod_targets
=
filter_pod_targets_for_target_definition
(
target_definition
,
pod_targets
,
resolver_specs_by_target
,
build_configurations
)
AggregateTarget
.
new
(
sandbox
,
target_definition
.
uses_frameworks?
,
user_build_configurations
,
archs
,
platform
,
AggregateTarget
.
new
(
sandbox
,
target_definition
.
uses_frameworks?
,
user_build_configurations
,
archs
,
platform
,
target_definition
,
client_root
,
user_project
,
user_target_uuids
,
pod_targets
)
target_definition
,
client_root
,
user_project
,
user_target_uuids
,
pod_targets
)
end
end
...
@@ -465,13 +466,46 @@ module Pod
...
@@ -465,13 +466,46 @@ module Pod
# @param [Hash{Podfile::TargetDefinition => Array<ResolvedSpecification>}] resolver_specs_by_target
# @param [Hash{Podfile::TargetDefinition => Array<ResolvedSpecification>}] resolver_specs_by_target
# the resolved specifications grouped by target.
# the resolved specifications grouped by target.
#
#
# @return [Array<PodTarget>] the filtered list of pod targets.
# @param [Array<String>] build_configurations
# The list of all build configurations the targets will be built for.
#
#
def
filter_pod_targets_for_target_definition
(
target_definition
,
pod_targets
,
resolver_specs_by_target
)
# @return [Hash<String => Array<PodTarget>>]
pod_targets
.
select
do
|
pod_target
|
# the filtered list of pod targets, grouped by build configuration.
next
false
unless
pod_target
.
target_definitions
.
include?
(
target_definition
)
#
resolver_specs_by_target
[
target_definition
].
any?
{
|
resolver_spec
|
!
resolver_spec
.
used_by_tests_only?
&&
pod_target
.
specs
.
include?
(
resolver_spec
.
spec
)
}
def
filter_pod_targets_for_target_definition
(
target_definition
,
pod_targets
,
resolver_specs_by_target
,
build_configurations
)
pod_targets_by_build_config
=
Hash
.
new
([].
freeze
)
build_configurations
.
each
{
|
config
|
pod_targets_by_build_config
[
config
]
=
[]
}
pod_targets
.
each
do
|
pod_target
|
next
unless
pod_target
.
target_definitions
.
include?
(
target_definition
)
next
unless
resolver_specs_by_target
[
target_definition
].
any?
{
|
resolver_spec
|
!
resolver_spec
.
used_by_tests_only?
&&
pod_target
.
specs
.
include?
(
resolver_spec
.
spec
)
}
pod_name
=
pod_target
.
pod_name
dependencies
=
@podfile_dependency_cache
.
target_definition_dependencies
(
target_definition
).
select
do
|
dependency
|
Specification
.
root_name
(
dependency
.
name
)
==
pod_name
end
build_configurations
.
each
do
|
configuration_name
|
whitelists
=
dependencies
.
map
do
|
dependency
|
target_definition
.
pod_whitelisted_for_configuration?
(
dependency
.
name
,
configuration_name
)
end
.
uniq
case
whitelists
when
[],
[
true
]
then
nil
when
[
false
]
then
next
else
raise
Informative
,
"The subspecs of `
#{
pod_name
}
` are linked to "
\
"different build configurations for the `
#{
target_definition
}
` "
\
'target. CocoaPods does not currently support subspecs across '
\
'different build configurations.'
end
pod_targets_by_build_config
[
configuration_name
]
<<
pod_target
end
end
end
pod_targets_by_build_config
end
end
# Setup the pod targets for an aggregate target. Deduplicates resulting
# Setup the pod targets for an aggregate target. Deduplicates resulting
...
...
lib/cocoapods/target/aggregate_target.rb
View file @
8ef1a584
...
@@ -61,10 +61,10 @@ module Pod
...
@@ -61,10 +61,10 @@ module Pod
# @param [Pathname] client_root @see #client_root
# @param [Pathname] client_root @see #client_root
# @param [Xcodeproj::Project] user_project @see #user_project
# @param [Xcodeproj::Project] user_project @see #user_project
# @param [Array<String>] user_target_uuids @see #user_target_uuids
# @param [Array<String>] user_target_uuids @see #user_target_uuids
# @param [Array<PodTarget>] pod_targets
@see #pod_targets
# @param [Array<PodTarget>] pod_targets
_for_build_configuration @see #pod_targets_for_build_configuration
#
#
def
initialize
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
platform
,
target_definition
,
def
initialize
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
platform
,
target_definition
,
client_root
,
user_project
,
user_target_uuids
,
pod_targets
)
client_root
,
user_project
,
user_target_uuids
,
pod_targets
_for_build_configuration
)
super
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
platform
)
super
(
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
platform
)
raise
"Can't initialize an AggregateTarget without a TargetDefinition!"
if
target_definition
.
nil?
raise
"Can't initialize an AggregateTarget without a TargetDefinition!"
if
target_definition
.
nil?
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?
...
@@ -72,7 +72,8 @@ module Pod
...
@@ -72,7 +72,8 @@ module Pod
@client_root
=
client_root
@client_root
=
client_root
@user_project
=
user_project
@user_project
=
user_project
@user_target_uuids
=
user_target_uuids
@user_target_uuids
=
user_target_uuids
@pod_targets
=
pod_targets
@pod_targets_for_build_configuration
=
pod_targets_for_build_configuration
@pod_targets
=
pod_targets_for_build_configuration
.
values
.
flatten
.
uniq
@search_paths_aggregate_targets
=
[]
@search_paths_aggregate_targets
=
[]
@xcconfigs
=
{}
@xcconfigs
=
{}
end
end
...
@@ -157,10 +158,7 @@ module Pod
...
@@ -157,10 +158,7 @@ module Pod
# configuration.
# configuration.
#
#
def
pod_targets_for_build_configuration
(
build_configuration
)
def
pod_targets_for_build_configuration
(
build_configuration
)
@pod_targets_for_build_configuration
||=
{}
@pod_targets_for_build_configuration
[
build_configuration
]
||
[]
@pod_targets_for_build_configuration
[
build_configuration
]
||=
pod_targets
.
select
do
|
pod_target
|
pod_target
.
include_in_build_config?
(
target_definition
,
build_configuration
)
end
end
end
# @return [Array<Specification>] The specifications used by this aggregate target.
# @return [Array<Specification>] The specifications used by this aggregate target.
...
...
lib/cocoapods/target/pod_target.rb
View file @
8ef1a584
...
@@ -471,37 +471,6 @@ module Pod
...
@@ -471,37 +471,6 @@ module Pod
[
self
,
*
recursive_dependent_targets
,
*
recursive_test_dependent_targets
].
uniq
[
self
,
*
recursive_dependent_targets
,
*
recursive_test_dependent_targets
].
uniq
end
end
# Checks if the target should be included in the build configuration with
# the given name of a given target definition.
#
# @param [TargetDefinition] target_definition
# The target definition to check.
#
# @param [String] configuration_name
# The name of the build configuration.
#
def
include_in_build_config?
(
target_definition
,
configuration_name
)
key
=
[
target_definition
.
label
,
configuration_name
]
if
@build_config_cache
.
key?
(
key
)
return
@build_config_cache
[
key
]
end
whitelists
=
target_definition_dependencies
(
target_definition
).
map
do
|
dependency
|
target_definition
.
pod_whitelisted_for_configuration?
(
dependency
.
name
,
configuration_name
)
end
.
uniq
if
whitelists
.
empty?
@build_config_cache
[
key
]
=
true
elsif
whitelists
.
count
==
1
@build_config_cache
[
key
]
=
whitelists
.
first
else
raise
Informative
,
"The subspecs of `
#{
pod_name
}
` are linked to "
\
"different build configurations for the `
#{
target_definition
}
` "
\
'target. CocoaPods does not currently support subspecs across '
\
'different build configurations.'
end
end
# Checks if warnings should be inhibited for this pod.
# Checks if warnings should be inhibited for this pod.
#
#
# @return [Bool]
# @return [Bool]
...
@@ -597,20 +566,6 @@ module Pod
...
@@ -597,20 +566,6 @@ module Pod
private
private
# @param [TargetDefinition] target_definition
# The target definition to check.
#
# @return [Array<Dependency>] The dependency of the target definition for
# this Pod. Return an empty array if the Pod is not a direct
# dependency of the target definition but the dependency of one or
# more Pods.
#
def
target_definition_dependencies
(
target_definition
)
target_definition
.
dependencies
.
select
do
|
dependency
|
Specification
.
root_name
(
dependency
.
name
)
==
pod_name
end
end
def
create_build_settings
def
create_build_settings
BuildSettings
::
PodTargetSettings
.
new
(
self
,
false
)
BuildSettings
::
PodTargetSettings
.
new
(
self
,
false
)
end
end
...
...
spec/spec_helper.rb
View file @
8ef1a584
...
@@ -150,7 +150,7 @@ def fixture_aggregate_target(pod_targets = [], host_requires_frameworks = false,
...
@@ -150,7 +150,7 @@ def fixture_aggregate_target(pod_targets = [], host_requires_frameworks = false,
archs
=
[],
platform
=
Pod
::
Platform
.
new
(
:ios
,
'6.0'
),
target_definition
=
nil
)
archs
=
[],
platform
=
Pod
::
Platform
.
new
(
:ios
,
'6.0'
),
target_definition
=
nil
)
target_definition
||=
pod_targets
.
flat_map
(
&
:target_definitions
).
first
||
fixture_target_definition
target_definition
||=
pod_targets
.
flat_map
(
&
:target_definitions
).
first
||
fixture_target_definition
Pod
::
AggregateTarget
.
new
(
config
.
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
platform
,
Pod
::
AggregateTarget
.
new
(
config
.
sandbox
,
host_requires_frameworks
,
user_build_configurations
,
archs
,
platform
,
target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
pod_targets
)
target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
'Release'
=>
pod_targets
)
end
end
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
...
...
spec/unit/installer/analyzer_spec.rb
View file @
8ef1a584
...
@@ -701,13 +701,14 @@ module Pod
...
@@ -701,13 +701,14 @@ module Pod
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
describe
'#filter_pod_targets_for_target_definition'
do
it
'does include pod target if any spec is not used by tests only and is part of target definition'
do
it
'does include pod target if any spec is not used by tests only and is part of target definition'
do
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
false
,
nil
)
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
false
,
nil
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
,
nil
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
,
nil
)
target_definition
=
stub
target_definition
=
@podfile
.
target_definitions
[
'SampleProject'
]
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
]
)
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
],
:pod_name
=>
'Pod1'
)
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
target_definition
,
[
pod_target
],
resolver_specs_by_target
).
should
==
[
pod_target
]
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
target_definition
,
[
pod_target
],
resolver_specs_by_target
,
%w(Release)
).
should
==
{
'Release'
=>
[
pod_target
]
}
end
end
it
'does not include pod target if its used by tests only'
do
it
'does not include pod target if its used by tests only'
do
...
@@ -716,7 +717,7 @@ module Pod
...
@@ -716,7 +717,7 @@ module Pod
target_definition
=
stub
(
'TargetDefinition'
)
target_definition
=
stub
(
'TargetDefinition'
)
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
])
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
])
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
target_definition
,
[
pod_target
],
resolver_specs_by_target
).
should
.
be
.
empty
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
target_definition
,
[
pod_target
],
resolver_specs_by_target
,
%w(Release)
).
should
==
{
'Release'
=>
[]
}
end
end
it
'does not include pod target if its not part of the target definition'
do
it
'does not include pod target if its not part of the target definition'
do
...
@@ -724,8 +725,58 @@ module Pod
...
@@ -724,8 +725,58 @@ module Pod
target_definition
=
stub
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[],
:specs
=>
[
spec
.
spec
])
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[],
:specs
=>
[
spec
.
spec
])
resolver_specs_by_target
=
{
target_definition
=>
[
spec
]
}
resolver_specs_by_target
=
{
target_definition
=>
[
spec
]
}
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
target_definition
,
[
pod_target
],
resolver_specs_by_target
).
should
.
be
.
empty
@analyzer
.
send
(
:filter_pod_targets_for_target_definition
,
target_definition
,
[
pod_target
],
resolver_specs_by_target
,
%w(Release)
).
should
==
{
'Release'
=>
[]
}
end
it
'returns whether it is whitelisted in a build configuration'
do
target_definition
=
@podfile
.
target_definitions
[
'SampleProject'
]
target_definition
.
whitelist_pod_for_configuration
(
'JSONKit'
,
'Debug'
)
aggregate_target
=
@analyzer
.
analyze
.
targets
.
find
{
|
t
|
t
.
target_definition
==
target_definition
}
aggregate_target
.
pod_targets_for_build_configuration
(
'Debug'
).
map
(
&
:name
).
should
.
include
'JSONKit'
aggregate_target
.
pod_targets_for_build_configuration
(
'Release'
).
map
(
&
:name
).
should
.
not
.
include
'JSONKit'
end
it
'allows a pod that is a dependency for other pods to be whitelisted'
do
@podfile
=
Podfile
.
new
do
platform
:ios
,
'8.0'
project
'SampleProject/SampleProject'
target
'SampleProject'
do
pod
'AFNetworking'
,
:configuration
=>
'Debug'
pod
'AFNetworkActivityLogger'
end
end
end
@analyzer
=
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
@podfile
)
target_definition
=
@podfile
.
target_definitions
[
'SampleProject'
]
aggregate_target
=
@analyzer
.
analyze
.
targets
.
find
{
|
t
|
t
.
target_definition
==
target_definition
}
aggregate_target
.
pod_targets_for_build_configuration
(
'Debug'
).
map
(
&
:name
).
should
.
include
'AFNetworking'
aggregate_target
.
pod_targets_for_build_configuration
(
'Release'
).
map
(
&
:name
).
should
.
not
.
include
'AFNetworking'
end
it
'raises if a Pod is whitelisted for different build configurations'
do
@podfile
=
Podfile
.
new
do
platform
:ios
,
'8.0'
project
'SampleProject/SampleProject'
target
'SampleProject'
do
pod
'AFNetworking'
pod
'AFNetworking/NSURLConnection'
,
:configuration
=>
'Debug'
pod
'AFNetworkActivityLogger'
end
end
@analyzer
=
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
@podfile
)
should
.
raise
(
Informative
)
do
@analyzer
.
analyze
end
.
message
.
should
.
include
'The subspecs of `AFNetworking` are linked to different build configurations for the `Pods-SampleProject` target. CocoaPods does not currently support subspecs across different build configurations.'
end
end
#-------------------------------------------------------------------------#
describe
'extension targets'
do
describe
'extension targets'
do
before
do
before
do
...
...
spec/unit/installer/post_install_hooks_context_spec.rb
View file @
8ef1a584
...
@@ -11,7 +11,7 @@ module Pod
...
@@ -11,7 +11,7 @@ module Pod
user_target
=
user_project
.
native_targets
.
find
{
|
np
|
np
.
name
==
'SampleProject'
}
user_target
=
user_project
.
native_targets
.
find
{
|
np
|
np
.
name
==
'SampleProject'
}
target_definition
=
fixture_target_definition
target_definition
=
fixture_target_definition
pod_target
=
PodTarget
.
new
(
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
spec
],
[
target_definition
],
nil
)
pod_target
=
PodTarget
.
new
(
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
spec
],
[
target_definition
],
nil
)
umbrella
=
AggregateTarget
.
new
(
sandbox
,
false
,
{},
[],
Platform
.
ios
,
target_definition
,
config
.
sandbox
.
root
.
dirname
,
user_project
,
[
user_target
.
uuid
],
[
pod_target
])
umbrella
=
AggregateTarget
.
new
(
sandbox
,
false
,
{},
[],
Platform
.
ios
,
target_definition
,
config
.
sandbox
.
root
.
dirname
,
user_project
,
[
user_target
.
uuid
],
'Release'
=>
[
pod_target
])
umbrella
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'8.0'
))
umbrella
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'8.0'
))
result
=
Installer
::
PostInstallHooksContext
.
generate
(
sandbox
,
[
umbrella
])
result
=
Installer
::
PostInstallHooksContext
.
generate
(
sandbox
,
[
umbrella
])
...
...
spec/unit/installer/user_project_integrator/target_integrator/xcconfig_integrator_spec.rb
View file @
8ef1a584
...
@@ -9,7 +9,7 @@ module Pod
...
@@ -9,7 +9,7 @@ module Pod
@target
=
@project
.
targets
.
first
@target
=
@project
.
targets
.
first
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
.
abstract
=
false
target_definition
.
abstract
=
false
@pod_bundle
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
target_definition
,
project_path
.
dirname
,
@project
,
[
@target
.
uuid
],
[]
)
@pod_bundle
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
target_definition
,
project_path
.
dirname
,
@project
,
[
@target
.
uuid
],
{}
)
configuration
=
Xcodeproj
::
Config
.
new
(
configuration
=
Xcodeproj
::
Config
.
new
(
'GCC_PREPROCESSOR_DEFINITIONS'
=>
'$(inherited) COCOAPODS=1'
,
'GCC_PREPROCESSOR_DEFINITIONS'
=>
'$(inherited) COCOAPODS=1'
,
)
)
...
...
spec/unit/installer/user_project_integrator/target_integrator_spec.rb
View file @
8ef1a584
...
@@ -15,7 +15,7 @@ module Pod
...
@@ -15,7 +15,7 @@ module Pod
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
.
abstract
=
false
target_definition
.
abstract
=
false
user_build_configurations
=
{
'Release'
=>
:release
,
'Debug'
=>
:debug
}
user_build_configurations
=
{
'Release'
=>
:release
,
'Debug'
=>
:debug
}
@pod_bundle
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
ios
,
target_definition
,
project_path
.
dirname
,
@project
,
[
@target
.
uuid
],
[]
)
@pod_bundle
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
ios
,
target_definition
,
project_path
.
dirname
,
@project
,
[
@target
.
uuid
],
{}
)
@pod_bundle
.
stubs
(
:resource_paths_by_config
).
returns
(
'Release'
=>
%w(${PODS_ROOT}/Lib/Resources/image.png)
)
@pod_bundle
.
stubs
(
: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
(
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
8ef1a584
...
@@ -18,8 +18,8 @@ module Pod
...
@@ -18,8 +18,8 @@ module Pod
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
user_build_configurations
=
{
'Release'
=>
:release
,
'Debug'
=>
:debug
}
user_build_configurations
=
{
'Release'
=>
:release
,
'Debug'
=>
:debug
}
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
ios
,
@podfile
.
target_definitions
[
'SampleProject'
],
sample_project_path
.
dirname
,
Xcodeproj
::
Project
.
open
(
@sample_project_path
),
[
'A346496C14F9BE9A0080D870'
],
[]
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
ios
,
@podfile
.
target_definitions
[
'SampleProject'
],
sample_project_path
.
dirname
,
Xcodeproj
::
Project
.
open
(
@sample_project_path
),
[
'A346496C14F9BE9A0080D870'
],
{}
)
@empty_library
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
ios
,
@podfile
.
target_definitions
[
:empty
],
sample_project_path
.
dirname
,
@target
.
user_project
,
[
'C0C495321B9E5C47004F9854'
],
[]
)
@empty_library
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
ios
,
@podfile
.
target_definitions
[
:empty
],
sample_project_path
.
dirname
,
@target
.
user_project
,
[
'C0C495321B9E5C47004F9854'
],
{}
)
@integrator
=
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
temporary_directory
,
[
@target
,
@empty_library
])
@integrator
=
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
temporary_directory
,
[
@target
,
@empty_library
])
end
end
...
...
spec/unit/installer/xcode/pods_project_generator/aggregate_target_installer_spec.rb
View file @
8ef1a584
...
@@ -28,7 +28,8 @@ module Pod
...
@@ -28,7 +28,8 @@ module Pod
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
new
(
:ios
,
'6.0'
),
[
@spec
],
[
@target_definition
],
[
file_accessor
])
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
new
(
:ios
,
'6.0'
),
[
@spec
],
[
@target_definition
],
[
file_accessor
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
new
(
:ios
,
'6.0'
),
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
pod_targets_by_config
=
Hash
[
user_build_configurations
.
each_key
.
map
{
|
c
|
[
c
,
[
@pod_target
]]
}]
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
user_build_configurations
,
[],
Platform
.
new
(
:ios
,
'6.0'
),
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
pod_targets_by_config
)
@installer
=
AggregateTargetInstaller
.
new
(
config
.
sandbox
,
@project
,
@target
)
@installer
=
AggregateTargetInstaller
.
new
(
config
.
sandbox
,
@project
,
@target
)
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
end
end
...
...
spec/unit/installer/xcode/pods_project_generator_spec.rb
View file @
8ef1a584
...
@@ -325,7 +325,7 @@ module Pod
...
@@ -325,7 +325,7 @@ module Pod
target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{
'App Store'
=>
:release
,
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'Test'
=>
:debug
},
{
'App Store'
=>
:release
,
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'Test'
=>
:debug
},
[],
Platform
.
new
(
:ios
,
'6.0'
),
fixture_target_definition
,
[],
Platform
.
new
(
:ios
,
'6.0'
),
fixture_target_definition
,
config
.
sandbox
.
root
.
dirname
,
proj
,
nil
,
[]
)
config
.
sandbox
.
root
.
dirname
,
proj
,
nil
,
{}
)
target
.
stubs
(
:user_targets
).
returns
([
user_target
])
target
.
stubs
(
:user_targets
).
returns
([
user_target
])
...
...
spec/unit/installer_spec.rb
View file @
8ef1a584
...
@@ -421,7 +421,7 @@ module Pod
...
@@ -421,7 +421,7 @@ module Pod
end
end
it
'deletes the target support file dirs of the removed aggregate targets'
do
it
'deletes the target support file dirs of the removed aggregate targets'
do
aggregate_target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
fixture_target_definition
(
'MyApp'
),
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[]
)
aggregate_target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
fixture_target_definition
(
'MyApp'
),
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
{}
)
@installer
.
stubs
(
:aggregate_targets
).
returns
([
aggregate_target
])
@installer
.
stubs
(
:aggregate_targets
).
returns
([
aggregate_target
])
FileUtils
.
mkdir_p
(
config
.
sandbox
.
target_support_files_root
)
FileUtils
.
mkdir_p
(
config
.
sandbox
.
target_support_files_root
)
FileUtils
.
mkdir_p
(
@installer
.
aggregate_targets
.
first
.
support_files_dir
)
FileUtils
.
mkdir_p
(
@installer
.
aggregate_targets
.
first
.
support_files_dir
)
...
@@ -434,7 +434,7 @@ module Pod
...
@@ -434,7 +434,7 @@ module Pod
end
end
it
'does not delete the target support file dirs for non removed aggregate targets'
do
it
'does not delete the target support file dirs for non removed aggregate targets'
do
aggregate_target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
fixture_target_definition
(
'MyApp'
),
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[]
)
aggregate_target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
fixture_target_definition
(
'MyApp'
),
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
{}
)
@installer
.
stubs
(
:aggregate_targets
).
returns
([
aggregate_target
])
@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
)
...
@@ -638,7 +638,7 @@ module Pod
...
@@ -638,7 +638,7 @@ module Pod
describe
'Integrating client projects'
do
describe
'Integrating client projects'
do
it
'integrates the client projects'
do
it
'integrates the client projects'
do
target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
fixture_target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[]
)
target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
fixture_target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
{}
)
@installer
.
stubs
(
:aggregate_targets
).
returns
([
target
])
@installer
.
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
)
...
...
spec/unit/library_spec.rb
View file @
8ef1a584
...
@@ -5,7 +5,7 @@ module Pod
...
@@ -5,7 +5,7 @@ module Pod
describe
'In general'
do
describe
'In general'
do
before
do
before
do
@target_definition
=
fixture_target_definition
@target_definition
=
fixture_target_definition
@lib
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[]
)
@lib
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
{}
)
end
end
it
'returns the target_definition that generated it'
do
it
'returns the target_definition that generated it'
do
...
@@ -28,7 +28,7 @@ module Pod
...
@@ -28,7 +28,7 @@ module Pod
describe
'Support files'
do
describe
'Support files'
do
before
do
before
do
@target_definition
=
fixture_target_definition
@target_definition
=
fixture_target_definition
@lib
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[]
)
@lib
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
{}
)
end
end
it
'returns the absolute path of the xcconfig file'
do
it
'returns the absolute path of the xcconfig file'
do
...
...
spec/unit/target/aggregate_target_spec.rb
View file @
8ef1a584
...
@@ -7,7 +7,7 @@ module Pod
...
@@ -7,7 +7,7 @@ module Pod
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
abstract
=
false
@target_definition
.
abstract
=
false
project_path
=
SpecHelper
.
fixture
(
'SampleProject/SampleProject.xcodeproj'
)
project_path
=
SpecHelper
.
fixture
(
'SampleProject/SampleProject.xcodeproj'
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
Xcodeproj
::
Project
.
open
(
project_path
),
[
'A346496C14F9BE9A0080D870'
],
[]
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
Xcodeproj
::
Project
.
open
(
project_path
),
[
'A346496C14F9BE9A0080D870'
],
{}
)
end
end
it
'returns the target_definition that generated it'
do
it
'returns the target_definition that generated it'
do
...
@@ -41,7 +41,7 @@ module Pod
...
@@ -41,7 +41,7 @@ module Pod
before
do
before
do
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
abstract
=
false
@target_definition
.
abstract
=
false
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[]
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
{}
)
end
end
it
'returns the absolute path of the xcconfig file'
do
it
'returns the absolute path of the xcconfig file'
do
...
@@ -88,14 +88,14 @@ module Pod
...
@@ -88,14 +88,14 @@ module Pod
@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
,
{},
[],
Platform
.
ios
,
[
@spec
],
[
@target_definition
])
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
@spec
],
[
@target_definition
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@target_definition
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
'Release'
=>
[
@pod_target
],
'Debug'
=>
[
@pod_target
])
end
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
,
{},
[],
Platform
.
ios
,
[
@spec
],
[
@target_definition
])
@pod_target_release
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
@spec
],
[
@target_definition
])
@
pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Debug'
).
returns
(
false
)
@
target
.
stubs
(
:pod_targets_for_build_configuration
).
with
(
'Debug'
).
returns
([
@pod_target
]
)
@
pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Release'
).
returns
(
true
)
@
target
.
stubs
(
:pod_targets_for_build_configuration
).
with
(
'Release'
).
returns
([
@pod_target
,
@pod_target_release
]
)
@target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
,
@pod_target_release
])
@target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
,
@pod_target_release
])
@target
.
stubs
(
:user_build_configurations
).
returns
(
'Debug'
=>
:debug
,
'Release'
=>
:release
)
@target
.
stubs
(
:user_build_configurations
).
returns
(
'Debug'
=>
:debug
,
'Release'
=>
:release
)
end
end
...
@@ -161,10 +161,10 @@ module Pod
...
@@ -161,10 +161,10 @@ module Pod
it
'returns non vendored frameworks by config with different release and debug targets'
do
it
'returns non vendored frameworks by config with different release and debug targets'
do
@pod_target_release
.
stubs
(
:should_build?
).
returns
(
true
)
@pod_target_release
.
stubs
(
:should_build?
).
returns
(
true
)
@pod_target_release
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
@pod_target_release
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Debug'
).
returns
(
false
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Release'
).
returns
(
true
)
@pod_target
.
stubs
(
:should_build?
).
returns
(
true
)
@pod_target
.
stubs
(
:should_build?
).
returns
(
true
)
@pod_target
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
@pod_target
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
@target
.
stubs
(
:pod_targets_for_build_configuration
).
with
(
'Debug'
).
returns
([
@pod_target
])
@target
.
stubs
(
:pod_targets_for_build_configuration
).
with
(
'Release'
).
returns
([
@pod_target
,
@pod_target_release
])
@target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
,
@pod_target_release
])
@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
==
[
...
@@ -244,7 +244,7 @@ module Pod
...
@@ -244,7 +244,7 @@ module Pod
describe
'With libraries'
do
describe
'With libraries'
do
before
do
before
do
@pod_target
=
fixture_pod_target
(
'banana-lib/BananaLib.podspec'
)
@pod_target
=
fixture_pod_target
(
'banana-lib/BananaLib.podspec'
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@pod_target
.
target_definitions
.
first
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
@pod_target
.
target_definitions
.
first
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
'Release'
=>
[
@pod_target
],
'Debug'
=>
[
@pod_target
])
end
end
it
'returns that it does not use swift'
do
it
'returns that it does not use swift'
do
...
@@ -308,7 +308,7 @@ module Pod
...
@@ -308,7 +308,7 @@ module Pod
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
.
abstract
=
false
target_definition
.
abstract
=
false
project_path
=
SpecHelper
.
fixture
(
'SampleProject/SampleProject.xcodeproj'
)
project_path
=
SpecHelper
.
fixture
(
'SampleProject/SampleProject.xcodeproj'
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
true
,
{},
[],
Platform
.
ios
,
target_definition
,
config
.
sandbox
.
root
.
dirname
,
Xcodeproj
::
Project
.
open
(
project_path
),
[
'A346496C14F9BE9A0080D870'
],
[
@pod_target
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
true
,
{},
[],
Platform
.
ios
,
target_definition
,
config
.
sandbox
.
root
.
dirname
,
Xcodeproj
::
Project
.
open
(
project_path
),
[
'A346496C14F9BE9A0080D870'
],
'Release'
=>
[
@pod_target
],
'Debug'
=>
[
@pod_target
])
end
end
it
'requires a host target for app extension targets'
do
it
'requires a host target for app extension targets'
do
...
@@ -368,7 +368,7 @@ module Pod
...
@@ -368,7 +368,7 @@ module Pod
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
.
abstract
=
false
target_definition
.
abstract
=
false
project_path
=
SpecHelper
.
fixture
(
'SampleProject/SampleProject.xcodeproj'
)
project_path
=
SpecHelper
.
fixture
(
'SampleProject/SampleProject.xcodeproj'
)
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
true
,
{},
[],
Platform
.
ios
,
target_definition
,
config
.
sandbox
.
root
.
dirname
,
Xcodeproj
::
Project
.
open
(
project_path
),
[
'A346496C14F9BE9A0080D870'
],
[
@pod_target
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
true
,
{},
[],
Platform
.
ios
,
target_definition
,
config
.
sandbox
.
root
.
dirname
,
Xcodeproj
::
Project
.
open
(
project_path
),
[
'A346496C14F9BE9A0080D870'
],
'Release'
=>
[
@pod_target
],
'Debug'
=>
[
@pod_target
])
end
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
...
@@ -400,7 +400,7 @@ module Pod
...
@@ -400,7 +400,7 @@ module Pod
describe
'With frameworks'
do
describe
'With frameworks'
do
before
do
before
do
@pod_target
=
fixture_pod_target
(
'orange-framework/OrangeFramework.podspec'
,
true
,
{},
[],
Platform
.
ios
,
[
fixture_target_definition
(
'iOS Example'
)])
@pod_target
=
fixture_pod_target
(
'orange-framework/OrangeFramework.podspec'
,
true
,
{},
[],
Platform
.
ios
,
[
fixture_target_definition
(
'iOS Example'
)])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
true
,
{},
[],
Platform
.
ios
,
@pod_target
.
target_definitions
.
first
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
[
@pod_target
])
@target
=
AggregateTarget
.
new
(
config
.
sandbox
,
true
,
{},
[],
Platform
.
ios
,
@pod_target
.
target_definitions
.
first
,
config
.
sandbox
.
root
.
dirname
,
nil
,
nil
,
'Release'
=>
[
@pod_target
])
end
end
it
'returns that it uses swift'
do
it
'returns that it uses swift'
do
...
...
spec/unit/target/build_settings/aggregate_target_settings_spec.rb
View file @
8ef1a584
...
@@ -223,7 +223,7 @@ module Pod
...
@@ -223,7 +223,7 @@ module Pod
)
)
pod_target
.
stubs
(
:build_settings
=>
PodTargetSettings
.
new
(
pod_target
,
false
))
pod_target
.
stubs
(
:build_settings
=>
PodTargetSettings
.
new
(
pod_target
,
false
))
aggregate_target
=
fixture_aggregate_target
([
pod_target
])
aggregate_target
=
fixture_aggregate_target
([
pod_target
])
@generator
=
AggregateTargetSettings
.
new
(
aggregate_target
,
'
Debug
'
)
@generator
=
AggregateTargetSettings
.
new
(
aggregate_target
,
'
Release
'
)
@generator
.
other_ldflags
.
should
==
%w(-ObjC -l"PodTarget" -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "StaticFramework" -framework "VendoredFramework" -framework "XCTest")
@generator
.
other_ldflags
.
should
==
%w(-ObjC -l"PodTarget" -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "StaticFramework" -framework "VendoredFramework" -framework "XCTest")
end
end
end
end
...
@@ -452,7 +452,7 @@ module Pod
...
@@ -452,7 +452,7 @@ module Pod
)
)
pod_target
.
stubs
(
:build_settings
=>
PodTargetSettings
.
new
(
pod_target
,
false
))
pod_target
.
stubs
(
:build_settings
=>
PodTargetSettings
.
new
(
pod_target
,
false
))
aggregate_target
=
fixture_aggregate_target
([
pod_target
])
aggregate_target
=
fixture_aggregate_target
([
pod_target
])
@generator
=
AggregateTargetSettings
.
new
(
aggregate_target
,
'
Debug
'
)
@generator
=
AggregateTargetSettings
.
new
(
aggregate_target
,
'
Release
'
)
@generator
.
other_ldflags
.
should
==
%w(-ObjC -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "PodTarget" -framework "VendoredFramework" -framework "XCTest")
@generator
.
other_ldflags
.
should
==
%w(-ObjC -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "PodTarget" -framework "VendoredFramework" -framework "XCTest")
end
end
...
@@ -494,7 +494,7 @@ module Pod
...
@@ -494,7 +494,7 @@ module Pod
)
)
pod_target
.
stubs
(
:build_settings
=>
PodTargetSettings
.
new
(
pod_target
,
false
))
pod_target
.
stubs
(
:build_settings
=>
PodTargetSettings
.
new
(
pod_target
,
false
))
aggregate_target
=
fixture_aggregate_target
([
pod_target
])
aggregate_target
=
fixture_aggregate_target
([
pod_target
])
@generator
=
AggregateTargetSettings
.
new
(
aggregate_target
,
'
Debug
'
)
@generator
=
AggregateTargetSettings
.
new
(
aggregate_target
,
'
Release
'
)
@generator
.
other_ldflags
.
should
==
%w(-ObjC -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "PodTarget" -framework "StaticFramework" -framework "VendoredFramework" -framework "XCTest")
@generator
.
other_ldflags
.
should
==
%w(-ObjC -l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "PodTarget" -framework "StaticFramework" -framework "VendoredFramework" -framework "XCTest")
end
end
end
end
...
...
spec/unit/target/pod_target_spec.rb
View file @
8ef1a584
...
@@ -71,28 +71,6 @@ module Pod
...
@@ -71,28 +71,6 @@ module Pod
@pod_target
.
dependencies
.
should
==
[
'monkey'
]
@pod_target
.
dependencies
.
should
==
[
'monkey'
]
end
end
it
'returns whether it is whitelisted in a build configuration'
do
@target_definition
.
store_pod
(
'BananaLib'
)
@target_definition
.
whitelist_pod_for_configuration
(
'BananaLib'
,
'debug'
)
@pod_target
.
include_in_build_config?
(
@target_definition
,
'Debug'
).
should
.
be
.
true
@pod_target
.
include_in_build_config?
(
@target_definition
,
'Release'
).
should
.
be
.
false
end
it
'is whitelisted on all build configurations of it is a dependency of other Pods'
do
@pod_target
.
include_in_build_config?
(
@target_definition
,
'Debug'
).
should
.
be
.
true
@pod_target
.
include_in_build_config?
(
@target_definition
,
'Release'
).
should
.
be
.
true
end
it
'raises if a Pod is whitelisted for different build configurations'
do
@target_definition
.
store_pod
(
'BananaLib'
)
@target_definition
.
store_pod
(
'BananaLib/Subspec'
)
@target_definition
.
whitelist_pod_for_configuration
(
'BananaLib'
,
'debug'
)
message
=
should
.
raise
Informative
do
@pod_target
.
include_in_build_config?
(
@target_definition
,
'release'
).
should
.
be
.
true
end
.
message
message
.
should
.
match
/subspecs across different build configurations/
end
it
'builds a pod target if there are actual source files'
do
it
'builds a pod target if there are actual source files'
do
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@pod_target
)
fa
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'foo.m'
)])
fa
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'foo.m'
)])
...
...
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