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
345bc370
Commit
345bc370
authored
Jun 26, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TargetIntegrator] Refactor create or update of build phase logic
parent
725ec0b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
target_integrator.rb
...ds/installer/user_project_integrator/target_integrator.rb
+16
-17
No files found.
lib/cocoapods/installer/user_project_integrator/target_integrator.rb
View file @
345bc370
...
@@ -142,19 +142,13 @@ module Pod
...
@@ -142,19 +142,13 @@ module Pod
# @return [void]
# @return [void]
#
#
def
add_embed_frameworks_script_phase
def
add_embed_frameworks_script_phase
phase_name
=
'Embed Pods Frameworks'
targets_to_embed_in
=
native_targets_to_integrate
.
select
do
|
target
|
targets_to_embed_in
=
native_targets_to_integrate
.
select
do
|
target
|
EMBED_FRAMEWORK_TARGET_TYPES
.
include?
(
target
.
symbol_type
)
EMBED_FRAMEWORK_TARGET_TYPES
.
include?
(
target
.
symbol_type
)
end
end
targets_to_embed_in
.
each
do
|
native_target
|
targets_to_embed_in
.
each
do
|
native_target
|
embed_build_phase
=
native_target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
phase
=
create_or_update_build_phase
(
native_target
,
'Embed Pods Frameworks'
)
unless
embed_build_phase
.
present?
UI
.
message
(
"Adding Build Phase '
#{
phase_name
}
' to project."
)
embed_build_phase
=
native_target
.
new_shell_script_build_phase
(
phase_name
)
end
script_path
=
target
.
embed_frameworks_script_relative_path
script_path
=
target
.
embed_frameworks_script_relative_path
embed_build_phase
.
shell_script
=
%("#{script_path}"\n)
phase
.
shell_script
=
%("#{script_path}"\n)
embed_build_phase
.
show_env_vars_in_log
=
'0'
end
end
end
end
...
@@ -189,11 +183,9 @@ module Pod
...
@@ -189,11 +183,9 @@ module Pod
def
add_copy_resources_script_phase
def
add_copy_resources_script_phase
phase_name
=
'Copy Pods Resources'
phase_name
=
'Copy Pods Resources'
native_targets_to_integrate
.
each
do
|
native_target
|
native_targets_to_integrate
.
each
do
|
native_target
|
phase
=
native_target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
phase
||=
native_target
.
new_shell_script_build_phase
(
phase_name
)
script_path
=
target
.
copy_resources_script_relative_path
script_path
=
target
.
copy_resources_script_relative_path
phase
.
shell_script
=
%("#{script_path}"\n)
phase
.
shell_script
=
%("#{script_path}"\n)
phase
.
show_env_vars_in_log
=
'0'
end
end
end
end
...
@@ -209,11 +201,8 @@ module Pod
...
@@ -209,11 +201,8 @@ module Pod
def
add_check_manifest_lock_script_phase
def
add_check_manifest_lock_script_phase
phase_name
=
'Check Pods Manifest.lock'
phase_name
=
'Check Pods Manifest.lock'
native_targets_to_integrate
.
each
do
|
native_target
|
native_targets_to_integrate
.
each
do
|
native_target
|
phase
=
native_target
.
shell_script_build_phases
.
find
{
|
phase
|
phase
.
name
==
phase_name
}
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
phase
||=
native_target
.
project
.
new
(
Xcodeproj
::
Project
::
Object
::
PBXShellScriptBuildPhase
).
tap
do
|
phase
|
native_target
.
build_phases
.
unshift
(
phase
).
uniq!
native_target
.
build_phases
.
unshift
(
phase
)
end
phase
.
name
=
phase_name
phase
.
shell_script
=
<<-
EOS
.
strip_heredoc
phase
.
shell_script
=
<<-
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
...
@@ -223,7 +212,6 @@ module Pod
...
@@ -223,7 +212,6 @@ module Pod
exit 1
exit 1
fi
fi
EOS
EOS
phase
.
show_env_vars_in_log
=
'0'
end
end
end
end
...
@@ -279,6 +267,17 @@ module Pod
...
@@ -279,6 +267,17 @@ module Pod
"Integrating target `
#{
target
.
name
}
` "
\
"Integrating target `
#{
target
.
name
}
` "
\
"(
#{
UI
.
path
target
.
user_project_path
}
project)"
"(
#{
UI
.
path
target
.
user_project_path
}
project)"
end
end
def
create_or_update_build_phase
(
target
,
phase_name
,
phase_class
=
Xcodeproj
::
Project
::
Object
::
PBXShellScriptBuildPhase
)
phase
=
target
.
build_phases
.
grep
(
phase_class
).
find
{
|
phase
|
phase
.
name
==
phase_name
}
||
(
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
end
)
end
end
end
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