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
70487ea7
Commit
70487ea7
authored
Jul 05, 2016
by
Samuel Giddins
Committed by
GitHub
Jul 05, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5505 from DanToml/dan_4014
[Installer] Verify no duplicate static libs
parents
c5d3cc85
6246b387
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
13 deletions
+43
-13
CHANGELOG.md
CHANGELOG.md
+4
-1
installer.rb
lib/cocoapods/installer.rb
+18
-9
validator.rb
lib/cocoapods/validator.rb
+1
-1
installer_spec.rb
spec/unit/installer_spec.rb
+20
-2
No files found.
CHANGELOG.md
View file @
70487ea7
...
@@ -12,7 +12,7 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -12,7 +12,7 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Daniel Tomlinson
](
https://github.com/dantoml
)
[
Daniel Tomlinson
](
https://github.com/dantoml
)
[
#5480
](
https://github.com/CocoaPods/CocoaPods/pull/5480
)
[
#5480
](
https://github.com/CocoaPods/CocoaPods/pull/5480
)
*
Add the ability to inhibit swift warnings.
*
Add the ability to inhibit swift warnings.
[
Peter Ryszkiewicz
](
https://github.com/pRizz
)
[
Peter Ryszkiewicz
](
https://github.com/pRizz
)
[
#5414
](
https://github.com/CocoaPods/CocoaPods/pull/5414
)
[
#5414
](
https://github.com/CocoaPods/CocoaPods/pull/5414
)
...
@@ -74,6 +74,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -74,6 +74,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Boris Bügling
](
https://github.com/neonichu
)
[
Boris Bügling
](
https://github.com/neonichu
)
[
#5528
](
https://github.com/CocoaPods/CocoaPods/issues/5528
)
[
#5528
](
https://github.com/CocoaPods/CocoaPods/issues/5528
)
*
Error during install when there are duplicate library names.
[
Daniel Tomlinson
](
https://github.com/dantoml
)
[
#4014
](
https://github.com/CocoaPods/CocoaPods/issues/4014
)
## 1.0.1 (2016-06-02)
## 1.0.1 (2016-06-02)
...
...
lib/cocoapods/installer.rb
View file @
70487ea7
...
@@ -110,7 +110,7 @@ module Pod
...
@@ -110,7 +110,7 @@ module Pod
prepare
prepare
resolve_dependencies
resolve_dependencies
download_dependencies
download_dependencies
verify_no_duplicate_framework_names
verify_no_duplicate_framework_
and_library_
names
verify_no_static_framework_transitive_dependencies
verify_no_static_framework_transitive_dependencies
verify_framework_usage
verify_framework_usage
generate_pods_project
generate_pods_project
...
@@ -389,23 +389,32 @@ module Pod
...
@@ -389,23 +389,32 @@ module Pod
end
end
end
end
def
verify_no_duplicate_framework_names
def
verify_no_duplicate_framework_
and_library_
names
aggregate_targets
.
each
do
|
aggregate_target
|
aggregate_targets
.
each
do
|
aggregate_target
|
aggregate_target
.
user_build_configurations
.
keys
.
each
do
|
config
|
aggregate_target
.
user_build_configurations
.
keys
.
each
do
|
config
|
pod_targets
=
aggregate_target
.
pod_targets_for_build_configuration
(
config
)
pod_targets
=
aggregate_target
.
pod_targets_for_build_configuration
(
config
)
vendored_frameworks
=
pod_targets
.
flat_map
(
&
:file_accessors
).
flat_map
(
&
:vendored_frameworks
).
uniq
file_accessors
=
pod_targets
.
flat_map
(
&
:file_accessors
)
frameworks
=
vendored_frameworks
.
map
{
|
fw
|
fw
.
basename
(
'.framework'
)
}
frameworks
=
file_accessors
.
flat_map
(
&
:vendored_frameworks
).
uniq
.
map
(
&
:basename
)
frameworks
+=
pod_targets
.
select
{
|
pt
|
pt
.
should_build?
&&
pt
.
requires_frameworks?
}.
map
(
&
:product_module_name
)
frameworks
+=
pod_targets
.
select
{
|
pt
|
pt
.
should_build?
&&
pt
.
requires_frameworks?
}.
map
(
&
:product_module_name
)
verify_no_duplicate_names
(
frameworks
,
aggregate_target
.
label
,
'frameworks'
)
duplicates
=
frameworks
.
group_by
{
|
f
|
f
}.
select
{
|
_
,
v
|
v
.
size
>
1
}.
keys
libraries
=
file_accessors
.
flat_map
(
&
:vendored_libraries
).
uniq
.
map
(
&
:basename
)
unless
duplicates
.
empty?
libraries
+=
pod_targets
.
select
{
|
pt
|
pt
.
should_build?
&&
!
pt
.
requires_frameworks?
}.
map
(
&
:product_name
)
raise
Informative
,
"The '
#{
aggregate_target
.
label
}
' target has "
\
verify_no_duplicate_names
(
libraries
,
aggregate_target
.
label
,
'libraries'
)
"frameworks with conflicting names:
#{
duplicates
.
to_sentence
}
."
end
end
end
end
end
end
end
def
verify_no_duplicate_names
(
names
,
label
,
type
)
duplicates
=
names
.
map
{
|
n
|
n
.
to_s
.
downcase
}.
group_by
{
|
f
|
f
}.
select
{
|
_
,
v
|
v
.
size
>
1
}.
keys
unless
duplicates
.
empty?
raise
Informative
,
"The '
#{
label
}
' target has "
\
"
#{
type
}
with conflicting names:
#{
duplicates
.
to_sentence
}
."
end
end
def
verify_no_static_framework_transitive_dependencies
def
verify_no_static_framework_transitive_dependencies
aggregate_targets
.
each
do
|
aggregate_target
|
aggregate_targets
.
each
do
|
aggregate_target
|
next
unless
aggregate_target
.
requires_frameworks?
next
unless
aggregate_target
.
requires_frameworks?
...
...
lib/cocoapods/validator.rb
View file @
70487ea7
...
@@ -434,7 +434,7 @@ module Pod
...
@@ -434,7 +434,7 @@ module Pod
# for all available platforms with xcodebuild.
# for all available platforms with xcodebuild.
#
#
def
install_pod
def
install_pod
%i(verify_no_duplicate_framework_names
%i(verify_no_duplicate_framework_
and_library_
names
verify_no_static_framework_transitive_dependencies
verify_no_static_framework_transitive_dependencies
verify_framework_usage generate_pods_project integrate_user_project
verify_framework_usage generate_pods_project integrate_user_project
perform_post_install_actions)
.
each
{
|
m
|
@installer
.
send
(
m
)
}
perform_post_install_actions)
.
each
{
|
m
|
@installer
.
send
(
m
)
}
...
...
spec/unit/installer_spec.rb
View file @
70487ea7
...
@@ -61,7 +61,7 @@ module Pod
...
@@ -61,7 +61,7 @@ module Pod
before
do
before
do
@installer
.
stubs
(
:resolve_dependencies
)
@installer
.
stubs
(
:resolve_dependencies
)
@installer
.
stubs
(
:download_dependencies
)
@installer
.
stubs
(
:download_dependencies
)
@installer
.
stubs
(
:verify_no_duplicate_framework_names
)
@installer
.
stubs
(
:verify_no_duplicate_framework_
and_library_
names
)
@installer
.
stubs
(
:verify_no_static_framework_transitive_dependencies
)
@installer
.
stubs
(
:verify_no_static_framework_transitive_dependencies
)
@installer
.
stubs
(
:verify_framework_usage
)
@installer
.
stubs
(
:verify_framework_usage
)
@installer
.
stubs
(
:generate_pods_project
)
@installer
.
stubs
(
:generate_pods_project
)
...
@@ -258,7 +258,25 @@ module Pod
...
@@ -258,7 +258,25 @@ module Pod
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
describe
'#verify_no_duplicate_framework_names'
do
describe
'#verify_no_duplicate_framework_and_library_names'
do
it
'detects duplicate library names'
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
Pathname
(
'a/libBananalib.a'
)])
Pod
::
Specification
.
any_instance
.
stubs
(
:dependencies
).
returns
([])
fixture_path
=
ROOT
+
'spec/fixtures'
config
.
repos_dir
=
fixture_path
+
'spec-repos'
podfile
=
Pod
::
Podfile
.
new
do
platform
:ios
,
'8.0'
project
'SampleProject/SampleProject'
pod
'BananaLib'
,
:path
=>
(
fixture_path
+
'banana-lib'
).
to_s
target
'SampleProject'
end
lockfile
=
generate_lockfile
@installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
,
lockfile
)
@installer
.
installation_options
.
integrate_targets
=
false
should
.
raise
(
Informative
)
{
@installer
.
install!
}.
message
.
should
.
match
/conflict.*bananalib/
end
it
'detects duplicate framework names'
do
it
'detects duplicate framework names'
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_frameworks
).
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_frameworks
).
returns
([
Pathname
(
'a/monkey.framework'
)]).
then
.
returns
([
Pathname
(
'a/monkey.framework'
)]).
then
.
...
...
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