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
f97c56da
Commit
f97c56da
authored
Jan 26, 2018
by
Paul Beusterien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better static frameworks transitive dependency error checking
parent
ae76d127
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
5 deletions
+79
-5
CHANGELOG.md
CHANGELOG.md
+4
-0
target_validator.rb
lib/cocoapods/installer/xcode/target_validator.rb
+9
-3
matryoshka.podspec
spec/fixtures/matryoshka/matryoshka.podspec
+0
-1
Outmost.h
spec/fixtures/static-matryoshka/Outmost.h
+0
-0
Outmost.m
spec/fixtures/static-matryoshka/Outmost.m
+0
-0
matryoshka.podspec
spec/fixtures/static-matryoshka/matryoshka.podspec
+14
-0
target_validator_spec.rb
spec/unit/installer/xcode/target_validator_spec.rb
+52
-1
No files found.
CHANGELOG.md
View file @
f97c56da
...
...
@@ -22,6 +22,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
*
Better static frameworks transitive dependency error checking
[
Paul Beusterien
](
https://github.com/paulb777
)
[
#7352
](
https://github.com/CocoaPods/CocoaPods/issues/7352
)
*
Always update input/output paths even if they are empty
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7368
](
https://github.com/CocoaPods/CocoaPods/pull/7368
)
...
...
lib/cocoapods/installer/xcode/target_validator.rb
View file @
f97c56da
...
...
@@ -71,16 +71,22 @@ module Pod
next
unless
aggregate_target
.
requires_frameworks?
aggregate_target
.
user_build_configurations
.
keys
.
each
do
|
config
|
pod_targets
=
aggregate_target
.
pod_targets_for_build_configuration
(
config
)
dynamic_pod_targets
=
aggregate_target
.
pod_targets_for_build_configuration
(
config
).
reject
(
&
:static_framework?
)
dependencies
=
pod_targets
.
select
(
&
:should_build?
).
reject
(
&
:static_framework
?
).
flat_map
(
&
:dependencies
)
depended_upon_targets
=
pod_targets
.
select
{
|
t
|
dependencies
.
include?
(
t
.
pod_name
)
&&
!
t
.
should_build?
}
dependencies
=
dynamic_pod_targets
.
select
(
&
:should_build
?
).
flat_map
(
&
:dependencies
)
depended_upon_targets
=
dynamic_
pod_targets
.
select
{
|
t
|
dependencies
.
include?
(
t
.
pod_name
)
&&
!
t
.
should_build?
}
static_libs
=
depended_upon_targets
.
flat_map
(
&
:file_accessors
).
flat_map
(
&
:vendored_static_artifacts
)
unless
static_libs
.
empty?
raise
Informative
,
"The '
#{
aggregate_target
.
label
}
' target has "
\
"transitive dependencies that include static binaries: (
#{
static_libs
.
to_sentence
}
)"
end
static_framework_deps
=
dynamic_pod_targets
.
select
(
&
:should_build?
).
flat_map
(
&
:recursive_dependent_targets
).
select
(
&
:static_framework?
)
unless
static_framework_deps
.
empty?
raise
Informative
,
"The '
#{
aggregate_target
.
label
}
' target has "
\
"transitive dependencies that include static frameworks: (
#{
static_framework_deps
.
flat_map
(
&
:name
).
to_sentence
}
)"
end
end
end
end
...
...
spec/fixtures/matryoshka/matryoshka.podspec
View file @
f97c56da
...
...
@@ -7,7 +7,6 @@ Pod::Spec.new do |s|
s
.
homepage
=
"http://httpbin.org/html"
s
.
source
=
{
:git
=>
"http://malyutin.local/matryoshka.git"
,
:tag
=>
s
.
version
.
to_s
}
s
.
license
=
'MIT'
s
.
static_framework
=
true
s
.
source_files
=
'Outmost.{h,m}'
...
...
spec/fixtures/static-matryoshka/Outmost.h
0 → 100644
View file @
f97c56da
spec/fixtures/static-matryoshka/Outmost.m
0 → 100644
View file @
f97c56da
spec/fixtures/static-matryoshka/matryoshka.podspec
0 → 100644
View file @
f97c56da
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
"matryoshka"
s
.
version
=
"1.0.0"
s
.
author
=
{
"Matryona Malyutin"
=>
"matryona@malyutin.local"
}
s
.
summary
=
"👩👩👧"
s
.
description
=
"Four levels: outmost (root), outer, inner"
s
.
homepage
=
"http://httpbin.org/html"
s
.
source
=
{
:git
=>
"http://malyutin.local/matryoshka.git"
,
:tag
=>
s
.
version
.
to_s
}
s
.
license
=
'MIT'
s
.
static_framework
=
true
s
.
source_files
=
'Outmost.{h,m}'
s
.
dependency
'monkey'
end
spec/unit/installer/xcode/target_validator_spec.rb
View file @
f97c56da
...
...
@@ -172,6 +172,57 @@ module Pod
@validator
=
create_validator
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
not
.
raise
(
Informative
)
{
@validator
.
validate!
}
end
end
describe
'#verify_no_incorrect_static_framework_transitive_dependencies_with_static_frameworks'
do
before
do
fixture_path
=
ROOT
+
'spec/fixtures'
config
.
repos_dir
=
fixture_path
+
'spec-repos'
@podfile
=
Pod
::
Podfile
.
new
do
install!
'cocoapods'
,
'integrate_targets'
=>
false
platform
:ios
,
'8.0'
project
'SampleProject/SampleProject'
use_frameworks!
pod
'BananaLib'
,
:path
=>
(
fixture_path
+
'banana-lib'
).
to_s
pod
'CoconutLib'
,
:path
=>
(
fixture_path
+
'coconut-lib'
).
to_s
pod
'OrangeFramework'
,
:path
=>
(
fixture_path
+
'orange-framework'
).
to_s
pod
'matryoshka'
,
:path
=>
(
fixture_path
+
'static-matryoshka'
).
to_s
pod
'monkey'
,
:path
=>
(
fixture_path
+
'monkey'
).
to_s
target
'SampleProject'
end
@lockfile
=
generate_lockfile
@file
=
Pathname
(
'/yolo.m'
)
@file
.
stubs
(
:realpath
).
returns
(
@file
)
@lib_thing
=
Pathname
(
'/libThing.a'
)
@lib_thing
.
stubs
(
:realpath
).
returns
(
@lib_thing
)
end
it
'detects transitive static dependencies which are linked directly to the user target'
do
@validator
=
create_validator
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
raise
(
Informative
)
{
@validator
.
validate!
}.
message
.
should
.
match
/transitive.*monkey.a/
end
it
'detects transitive static dependencies which are linked directly to the user target with stubbing'
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@lib_thing
])
@validator
=
create_validator
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
raise
(
Informative
)
{
@validator
.
validate!
}.
message
.
should
.
match
/transitive.*libThing/
end
it
'detects transitive static dependencies to static frameworks from dynamic library pods'
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
@file
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@lib_thing
])
@validator
=
create_validator
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
raise
(
Informative
)
{
@validator
.
validate!
}.
message
.
should
.
match
/transitive.*matryoshka/
end
it
'allows transitive static dependencies when both dependencies are linked against the user target'
do
PodTarget
.
any_instance
.
stubs
(
:should_build?
=>
false
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@lib_thing
])
@validator
=
create_validator
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
not
.
raise
(
Informative
)
{
@validator
.
validate!
}
end
it
'allows transitive static dependencies when building a static framework'
do
PodTarget
.
any_instance
.
stubs
(
:static_framework?
=>
true
)
...
...
@@ -190,7 +241,7 @@ module Pod
platform
:ios
,
'8.0'
project
'SampleProject/SampleProject'
use_frameworks!
pod
'matryoshka
/Bar'
,
:path
=>
(
fixture_path
+
'
matryoshka'
).
to_s
pod
'matryoshka
'
,
:path
=>
(
fixture_path
+
'static-
matryoshka'
).
to_s
pod
'monkey'
,
:path
=>
(
fixture_path
+
'monkey'
).
to_s
target
'SampleProject'
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