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