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
b45fcf1b
Commit
b45fcf1b
authored
Mar 07, 2016
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4985 from CocoaPods/ali/build-phase-emoji
Add emoji in CocoaPods Build Phases
parents
a4961a6d
3f75bf99
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
21 deletions
+48
-21
CHANGELOG.md
CHANGELOG.md
+5
-0
target_integrator.rb
...ds/installer/user_project_integrator/target_integrator.rb
+23
-8
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
target_integrator_spec.rb
...staller/user_project_integrator/target_integrator_spec.rb
+19
-12
No files found.
CHANGELOG.md
View file @
b45fcf1b
...
...
@@ -8,6 +8,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
*
Add :package: emoji in front of CocoaPods Script Build Phases
to quickly and visually differentiate them from other phases.
[
Olivier Halligon
](
https://github.com/AliSoftware
)
[
#4985
](
https://github.com/CocoaPods/CocoaPods/issues/4985
)
*
Enable syntax highlighting on the Podfile in the generated
`Pods.xcodeproj`
.
[
Samuel Giddins
](
https://github.com/segiddins
)
...
...
lib/cocoapods/installer/user_project_integrator/target_integrator.rb
View file @
b45fcf1b
...
...
@@ -9,6 +9,14 @@ module Pod
class
TargetIntegrator
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
# frameworks are embedded in the output directory / product bundle.
#
...
...
@@ -18,6 +26,10 @@ module Pod
#
EMBED_FRAMEWORK_PHASE_NAME
=
'Embed Pods Frameworks'
.
freeze
# @return [String] the name of the copy resources phase
#
COPY_PODS_RESOURCES_PHASE_NAME
=
'Copy Pods Resources'
.
freeze
# @return [AggregateTarget] the target that should be integrated.
#
attr_reader
:target
...
...
@@ -121,7 +133,7 @@ module Pod
# @return [void]
#
def
add_copy_resources_script_phase
phase_name
=
'Copy Pods Resources'
phase_name
=
COPY_PODS_RESOURCES_PHASE_NAME
native_targets
.
each
do
|
native_target
|
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
script_path
=
target
.
copy_resources_script_relative_path
...
...
@@ -139,7 +151,7 @@ module Pod
# @return [void]
#
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
|
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
native_target
.
build_phases
.
unshift
(
phase
).
uniq!
unless
native_target
.
build_phases
.
first
==
phase
...
...
@@ -201,14 +213,17 @@ module Pod
end
def
create_or_update_build_phase
(
target
,
phase_name
,
phase_class
=
Xcodeproj
::
Project
::
Object
::
PBXShellScriptBuildPhase
)
target
.
build_phases
.
grep
(
phase_class
).
find
{
|
phase
|
phase
.
name
==
phase_name
}
||
prefixed_phase_name
=
BUILD_PHASE_PREFIX
+
phase_name
build_phases
=
target
.
build_phases
.
grep
(
phase_class
)
build_phases
.
find
{
|
phase
|
phase
.
name
==
prefixed_phase_name
}
||
build_phases
.
find
{
|
phase
|
phase
.
name
==
phase_name
}.
tap
{
|
p
|
p
.
name
=
prefixed_phase_name
if
p
}
||
target
.
project
.
new
(
phase_class
).
tap
do
|
phase
|
UI
.
message
(
"Adding Build Phase '
#{
phase_name
}
' to project."
)
do
phase
.
name
=
phase_name
phase
.
show_env_vars_in_log
=
'0'
target
.
build_phases
<<
phase
end
UI
.
message
(
"Adding Build Phase '
#{
prefixed_phase_name
}
' to project."
)
do
phase
.
name
=
prefixed_phase_name
phase
.
show_env_vars_in_log
=
'0'
target
.
build_phases
<<
phase
end
end
end
end
end
...
...
cocoapods-integration-specs
@
37012367
Subproject commit
af3e74dcca333d15396a1ca60e7552277e0a9926
Subproject commit
37012367ef73dee7c403b4b56157ef81fca00741
spec/unit/installer/user_project_integrator/target_integrator_spec.rb
View file @
b45fcf1b
...
...
@@ -26,6 +26,9 @@ module Pod
@target_integrator
.
private_methods
.
grep
(
/^update_to_cocoapods_/
).
each
do
|
method
|
@target_integrator
.
stubs
(
method
)
end
@phase_prefix
=
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
BUILD_PHASE_PREFIX
@embed_framework_phase_name
=
@phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
EMBED_FRAMEWORK_PHASE_NAME
end
describe
'#integrate!'
do
...
...
@@ -42,7 +45,8 @@ module Pod
it
'fixes the copy resource scripts of legacy installations'
do
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Copy Pods Resources'
}
phase_name
=
@phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
COPY_PODS_RESOURCES_PHASE_NAME
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
phase
.
shell_script
=
%("${SRCROOT}/../Pods/Pods-resources.sh"\n)
@target_integrator
.
integrate!
phase
.
shell_script
.
strip
.
should
==
"
\"
${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh
\"
"
...
...
@@ -79,14 +83,16 @@ module Pod
it
'adds a Copy Pods Resources build phase to each target'
do
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Copy Pods Resources'
}
phase_name
=
@phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
COPY_PODS_RESOURCES_PHASE_NAME
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
phase
.
shell_script
.
strip
.
should
==
"
\"
${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh
\"
"
end
it
'adds a Check Manifest.lock build phase to each target'
do
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
'Check Pods Manifest.lock'
}
phase_name
=
@phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
CHECK_MANIFEST_PHASE_NAME
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
phase
.
shell_script
.
should
==
<<-
EOS
.
strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
...
...
@@ -102,7 +108,8 @@ module Pod
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
build_phases
.
first
phase
=
target
.
build_phases
.
find
{
|
bp
|
bp
.
name
==
'Check Pods Manifest.lock'
}
phase_name
=
@phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
CHECK_MANIFEST_PHASE_NAME
phase
=
target
.
build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
target
.
build_phases
.
first
.
should
.
equal?
phase
end
...
...
@@ -119,14 +126,14 @@ module Pod
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
true
)
@target_integrator
.
integrate!
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
end
it
'adds an embed frameworks build phase by default'
do
@target_integrator
.
integrate!
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
end
...
...
@@ -135,7 +142,7 @@ module Pod
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
stubs
(
:symbol_type
).
returns
(
:framework
)
@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
end
...
...
@@ -144,7 +151,7 @@ module Pod
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
stubs
(
:symbol_type
).
returns
(
:app_extension
)
@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
end
...
...
@@ -153,7 +160,7 @@ module Pod
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
stubs
(
:symbol_type
).
returns
(
:watch_extension
)
@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
end
...
...
@@ -162,7 +169,7 @@ module Pod
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
stubs
(
:symbol_type
).
returns
(
:watch2_extension
)
@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
end
...
...
@@ -172,7 +179,7 @@ module Pod
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
false
)
target
=
@target_integrator
.
send
(
:native_targets
).
first
@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
end
...
...
@@ -182,7 +189,7 @@ module Pod
@pod_bundle
.
stubs
(
:requires_frameworks?
=>
false
)
@target_integrator
.
integrate!
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
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