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
bd809d25
Commit
bd809d25
authored
Oct 06, 2017
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warn when a pod that was added or changed includes script phases
parent
e504e0c8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
15 deletions
+60
-15
CHANGELOG.md
CHANGELOG.md
+4
-0
installer.rb
lib/cocoapods/installer.rb
+20
-14
pod_target.rb
lib/cocoapods/target/pod_target.rb
+7
-1
installer_spec.rb
spec/unit/installer_spec.rb
+29
-0
No files found.
CHANGELOG.md
View file @
bd809d25
...
@@ -30,6 +30,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -30,6 +30,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
##### Bug Fixes
*
Warn when a pod that was added or changed includes script phases
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7110
](
https://github.com/CocoaPods/CocoaPods/pull/7110
)
*
Build pod targets with script phases and integrate them properly
*
Build pod targets with script phases and integrate them properly
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7104
](
https://github.com/CocoaPods/CocoaPods/pull/7104
)
[
#7104
](
https://github.com/CocoaPods/CocoaPods/pull/7104
)
...
...
lib/cocoapods/installer.rb
View file @
bd809d25
...
@@ -355,7 +355,7 @@ module Pod
...
@@ -355,7 +355,7 @@ module Pod
end
end
# Install the Pods. If the resolver indicated that a Pod should be
# Install the Pods. If the resolver indicated that a Pod should be
# installed and it exits, it is removed an then reinstalled. In any case if
# installed and it exits, it is removed an
d
then reinstalled. In any case if
# the Pod doesn't exits it is installed.
# the Pod doesn't exits it is installed.
#
#
# @return [void]
# @return [void]
...
@@ -423,6 +423,7 @@ module Pod
...
@@ -423,6 +423,7 @@ module Pod
unlock_pod_sources
unlock_pod_sources
run_plugins_post_install_hooks
run_plugins_post_install_hooks
warn_for_deprecations
warn_for_deprecations
warn_for_installed_script_phases
lock_pod_sources
lock_pod_sources
print_post_install_message
print_post_install_message
end
end
...
@@ -523,6 +524,24 @@ module Pod
...
@@ -523,6 +524,24 @@ module Pod
end
end
end
end
# Prints a warning for any pods that included script phases
#
# @return [void]
#
def
warn_for_installed_script_phases
pods_to_install
=
sandbox_state
.
added
|
sandbox_state
.
changed
pod_targets
.
each
do
|
pod_target
|
spec
=
pod_target
.
root_spec
if
pods_to_install
.
include?
(
spec
.
name
)
script_phase_count
=
pod_target
.
script_phases
.
count
unless
script_phase_count
.
zero?
UI
.
warn
"
#{
spec
.
name
}
has added
#{
pod_target
.
script_phases
.
count
}
#{
'script phase'
.
pluralize
(
script_phase_count
)
}
. "
\
'Please inspect before executing a build. See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.'
end
end
end
end
# Writes the Podfile and the lock files.
# Writes the Podfile and the lock files.
#
#
# @todo Pass the checkout options to the Lockfile.
# @todo Pass the checkout options to the Lockfile.
...
@@ -626,19 +645,6 @@ module Pod
...
@@ -626,19 +645,6 @@ module Pod
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
public
# @return [Array<Library>] The targets of the development pods generated by
# the installation process.
#
def
development_pod_targets
pod_targets
.
select
do
|
pod_target
|
sandbox
.
development_pods
.
keys
.
include?
(
pod_target
.
pod_name
)
end
end
#-------------------------------------------------------------------------#
private
private
# @!group Private helpers
# @!group Private helpers
...
...
lib/cocoapods/target/pod_target.rb
View file @
bd809d25
...
@@ -185,10 +185,16 @@ module Pod
...
@@ -185,10 +185,16 @@ module Pod
end
end
end
end
# @return [Array<Hash{Symbol=>String}>] An array of hashes where each hash represents a single script phase.
#
def
script_phases
spec_consumers
.
map
(
&
:script_phases
).
flatten
end
# @return [Boolean] Whether the target contains any script phases.
# @return [Boolean] Whether the target contains any script phases.
#
#
def
contains_script_phases?
def
contains_script_phases?
!
s
pec_consumers
.
map
(
&
:script_phases
).
flatten
.
empty?
!
s
cript_phases
.
empty?
end
end
# @return [Hash{Array => Specification}] a hash where the keys are the test native targets and the value
# @return [Hash{Array => Specification}] a hash where the keys are the test native targets and the value
...
...
spec/unit/installer_spec.rb
View file @
bd809d25
...
@@ -514,6 +514,35 @@ module Pod
...
@@ -514,6 +514,35 @@ module Pod
end
.
message
.
should
.
include
'Could not install \'RandomPod\' pod. There is no target that supports it.'
end
.
message
.
should
.
include
'Could not install \'RandomPod\' pod. There is no target that supports it.'
end
end
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
([
spec
,
*
spec
.
test_specs
],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
sandbox_state
=
Installer
::
Analyzer
::
SpecsState
.
new
sandbox_state
.
added
<<
'CoconutLib'
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
stubs
(
:root_specs
).
returns
([
spec
])
@installer
.
stubs
(
:sandbox_state
).
returns
(
sandbox_state
)
@installer
.
send
(
:warn_for_installed_script_phases
)
UI
.
warnings
.
should
.
include
'CoconutLib has added 1 script phase. Please inspect before executing a build. '
\
'See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.'
end
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
([
spec
,
*
spec
.
test_specs
],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
sandbox_state
=
Installer
::
Analyzer
::
SpecsState
.
new
sandbox_state
.
unchanged
<<
'CoconutLib'
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
stubs
(
:root_specs
).
returns
([
spec
])
@installer
.
stubs
(
:sandbox_state
).
returns
(
sandbox_state
)
@installer
.
send
(
:warn_for_installed_script_phases
)
UI
.
warnings
.
should
.
be
.
empty
end
#--------------------------------------#
#--------------------------------------#
describe
'#clean'
do
describe
'#clean'
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