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
cd5f5496
Commit
cd5f5496
authored
Mar 06, 2016
by
Olivier Halligon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
📦
] Fix unit tests
parent
0edfb80b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
16 deletions
+31
-16
target_integrator.rb
...ds/installer/user_project_integrator/target_integrator.rb
+12
-4
target_integrator_spec.rb
...staller/user_project_integrator/target_integrator_spec.rb
+19
-12
No files found.
lib/cocoapods/installer/user_project_integrator/target_integrator.rb
View file @
cd5f5496
...
@@ -9,6 +9,14 @@ module Pod
...
@@ -9,6 +9,14 @@ module Pod
class
TargetIntegrator
class
TargetIntegrator
autoload
:XCConfigIntegrator
,
'cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator'
autoload
:XCConfigIntegrator
,
'cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator'
# @return [String] the PACKAGE emoji to use as prefix for every build phase aded to the user project
#
BUILD_PHASE_PREFIX
=
"
\u
{1F4E6} "
.
freeze
# @return [String] the name of the check manifest phase
#
CHECK_MANIFEST_PHASE_NAME
=
'Check Pods Manifest.lock'
.
freeze
# @return [Array<Symbol>] the symbol types, which require that the pod
# @return [Array<Symbol>] the symbol types, which require that the pod
# frameworks are embedded in the output directory / product bundle.
# frameworks are embedded in the output directory / product bundle.
#
#
...
@@ -18,9 +26,9 @@ module Pod
...
@@ -18,9 +26,9 @@ module Pod
#
#
EMBED_FRAMEWORK_PHASE_NAME
=
'Embed Pods Frameworks'
.
freeze
EMBED_FRAMEWORK_PHASE_NAME
=
'Embed Pods Frameworks'
.
freeze
# @return [String] the
PACKAGE emoji to use as prefix for every build phase aded to the user project
# @return [String] the
name of the copy resources phase
#
#
BUILD_PHASE_PREFIX
=
"
\u
{1F4E6} "
.
freeze
COPY_PODS_RESOURCES_PHASE_NAME
=
'Copy Pods Resources'
.
freeze
# @return [AggregateTarget] the target that should be integrated.
# @return [AggregateTarget] the target that should be integrated.
#
#
...
@@ -125,7 +133,7 @@ module Pod
...
@@ -125,7 +133,7 @@ module Pod
# @return [void]
# @return [void]
#
#
def
add_copy_resources_script_phase
def
add_copy_resources_script_phase
phase_name
=
'Copy Pods Resources'
phase_name
=
COPY_PODS_RESOURCES_PHASE_NAME
native_targets
.
each
do
|
native_target
|
native_targets
.
each
do
|
native_target
|
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
script_path
=
target
.
copy_resources_script_relative_path
script_path
=
target
.
copy_resources_script_relative_path
...
@@ -143,7 +151,7 @@ module Pod
...
@@ -143,7 +151,7 @@ module Pod
# @return [void]
# @return [void]
#
#
def
add_check_manifest_lock_script_phase
def
add_check_manifest_lock_script_phase
phase_name
=
'Check Pods Manifest.lock'
phase_name
=
CHECK_MANIFEST_PHASE_NAME
native_targets
.
each
do
|
native_target
|
native_targets
.
each
do
|
native_target
|
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
native_target
.
build_phases
.
unshift
(
phase
).
uniq!
unless
native_target
.
build_phases
.
first
==
phase
native_target
.
build_phases
.
unshift
(
phase
).
uniq!
unless
native_target
.
build_phases
.
first
==
phase
...
...
spec/unit/installer/user_project_integrator/target_integrator_spec.rb
View file @
cd5f5496
require
File
.
expand_path
(
'../../../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../../../spec_helper'
,
__FILE__
)
module
Pod
module
Pod
CHECK_MANIFEST_PHASE_NAME
=
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
BUILD_PHASE_PREFIX
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
CHECK_MANIFEST_PHASE_NAME
EMBED_FRAMEWORK_PHASE_NAME
=
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
BUILD_PHASE_PREFIX
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
EMBED_FRAMEWORK_PHASE_NAME
COPY_PODS_RESOURCES_PHASE_NAME
=
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
BUILD_PHASE_PREFIX
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
COPY_PODS_RESOURCES_PHASE_NAME
describe
TargetIntegrator
=
Installer
::
UserProjectIntegrator
::
TargetIntegrator
do
describe
TargetIntegrator
=
Installer
::
UserProjectIntegrator
::
TargetIntegrator
do
describe
'In general'
do
describe
'In general'
do
# The project contains a `PBXReferenceProxy` in the build files of the
# The project contains a `PBXReferenceProxy` in the build files of the
...
@@ -42,7 +49,7 @@ module Pod
...
@@ -42,7 +49,7 @@ module Pod
it
'fixes the copy resource scripts of legacy installations'
do
it
'fixes the copy resource scripts of legacy installations'
do
@target_integrator
.
integrate!
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Copy Pods Resources'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
COPY_PODS_RESOURCES_PHASE_NAME
}
phase
.
shell_script
=
%("${SRCROOT}/../Pods/Pods-resources.sh"\n)
phase
.
shell_script
=
%("${SRCROOT}/../Pods/Pods-resources.sh"\n)
@target_integrator
.
integrate!
@target_integrator
.
integrate!
phase
.
shell_script
.
strip
.
should
==
"
\"
${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh
\"
"
phase
.
shell_script
.
strip
.
should
==
"
\"
${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh
\"
"
...
@@ -79,14 +86,14 @@ module Pod
...
@@ -79,14 +86,14 @@ module Pod
it
'adds a Copy Pods Resources build phase to each target'
do
it
'adds a Copy Pods Resources build phase to each target'
do
@target_integrator
.
integrate!
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Copy Pods Resources'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
COPY_PODS_RESOURCES_PHASE_NAME
}
phase
.
shell_script
.
strip
.
should
==
"
\"
${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh
\"
"
phase
.
shell_script
.
strip
.
should
==
"
\"
${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh
\"
"
end
end
it
'adds a Check Manifest.lock build phase to each target'
do
it
'adds a Check Manifest.lock build phase to each target'
do
@target_integrator
.
integrate!
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Check Pods Manifest.lock'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
CHECK_MANIFEST_PHASE_NAME
}
phase
.
shell_script
.
should
==
<<-
EOS
.
strip_heredoc
phase
.
shell_script
.
should
==
<<-
EOS
.
strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
if [[ $? != 0 ]] ; then
...
@@ -102,7 +109,7 @@ module Pod
...
@@ -102,7 +109,7 @@ module Pod
@target_integrator
.
integrate!
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
build_phases
.
first
target
.
build_phases
.
first
phase
=
target
.
build_phases
.
find
{
|
bp
|
bp
.
name
==
'Check Pods Manifest.lock'
}
phase
=
target
.
build_phases
.
find
{
|
bp
|
bp
.
name
==
CHECK_MANIFEST_PHASE_NAME
}
target
.
build_phases
.
first
.
should
.
equal?
phase
target
.
build_phases
.
first
.
should
.
equal?
phase
end
end
...
@@ -119,14 +126,14 @@ module Pod
...
@@ -119,14 +126,14 @@ module Pod
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
true
)
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
true
)
@target_integrator
.
integrate!
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Embed Pods Frameworks'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
EMBED_FRAMEWORK_PHASE_NAME
}
phase
.
nil?
.
should
==
false
phase
.
nil?
.
should
==
false
end
end
it
'adds an embed frameworks build phase by default'
do
it
'adds an embed frameworks build phase by default'
do
@target_integrator
.
integrate!
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Embed Pods Frameworks'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
EMBED_FRAMEWORK_PHASE_NAME
}
phase
.
nil?
.
should
==
false
phase
.
nil?
.
should
==
false
end
end
...
@@ -135,7 +142,7 @@ module Pod
...
@@ -135,7 +142,7 @@ module Pod
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
stubs
(
:symbol_type
).
returns
(
:framework
)
target
.
stubs
(
:symbol_type
).
returns
(
:framework
)
@target_integrator
.
integrate!
@target_integrator
.
integrate!
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Embed Pods Frameworks'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
EMBED_FRAMEWORK_PHASE_NAME
}
phase
.
nil?
.
should
==
true
phase
.
nil?
.
should
==
true
end
end
...
@@ -144,7 +151,7 @@ module Pod
...
@@ -144,7 +151,7 @@ module Pod
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
stubs
(
:symbol_type
).
returns
(
:app_extension
)
target
.
stubs
(
:symbol_type
).
returns
(
:app_extension
)
@target_integrator
.
integrate!
@target_integrator
.
integrate!
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Embed Pods Frameworks'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
EMBED_FRAMEWORK_PHASE_NAME
}
phase
.
nil?
.
should
==
false
phase
.
nil?
.
should
==
false
end
end
...
@@ -153,7 +160,7 @@ module Pod
...
@@ -153,7 +160,7 @@ module Pod
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
stubs
(
:symbol_type
).
returns
(
:watch_extension
)
target
.
stubs
(
:symbol_type
).
returns
(
:watch_extension
)
@target_integrator
.
integrate!
@target_integrator
.
integrate!
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Embed Pods Frameworks'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
EMBED_FRAMEWORK_PHASE_NAME
}
phase
.
nil?
.
should
==
false
phase
.
nil?
.
should
==
false
end
end
...
@@ -162,7 +169,7 @@ module Pod
...
@@ -162,7 +169,7 @@ module Pod
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
stubs
(
:symbol_type
).
returns
(
:watch2_extension
)
target
.
stubs
(
:symbol_type
).
returns
(
:watch2_extension
)
@target_integrator
.
integrate!
@target_integrator
.
integrate!
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Embed Pods Frameworks'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
EMBED_FRAMEWORK_PHASE_NAME
}
phase
.
nil?
.
should
==
false
phase
.
nil?
.
should
==
false
end
end
...
@@ -172,7 +179,7 @@ module Pod
...
@@ -172,7 +179,7 @@ module Pod
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
false
)
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
false
)
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
@target_integrator
.
integrate!
@target_integrator
.
integrate!
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Embed Pods Frameworks'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
EMBED_FRAMEWORK_PHASE_NAME
}
phase
.
should
.
not
.
be
.
nil
phase
.
should
.
not
.
be
.
nil
end
end
...
@@ -182,7 +189,7 @@ module Pod
...
@@ -182,7 +189,7 @@ module Pod
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
false
)
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
false
)
@target_integrator
.
integrate!
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Embed Pods Frameworks'
}
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
EMBED_FRAMEWORK_PHASE_NAME
}
phase
.
nil?
.
should
==
false
phase
.
nil?
.
should
==
false
end
end
end
end
...
...
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