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
938e1a69
Commit
938e1a69
authored
Jan 27, 2016
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Analyzer] Transitive scoped deps don't hinder deduplication anymore
parent
f0a2e213
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
49 deletions
+11
-49
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+4
-16
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+7
-33
No files found.
lib/cocoapods/installer/analyzer.rb
View file @
938e1a69
...
...
@@ -286,7 +286,6 @@ module Pod
# @return [Array<PodTarget>]
#
def
generate_pod_targets
(
specs_by_target
)
dedupe_cache
=
{}
if
installation_options
.
deduplicate_targets?
all_specs
=
specs_by_target
.
flat_map
do
|
target_definition
,
dependent_specs
|
dependent_specs
.
group_by
(
&
:root
).
map
do
|
root_spec
,
specs
|
...
...
@@ -313,28 +312,17 @@ module Pod
generate_pod_target
(
target_definitions
,
specs
)
end
end
# A `PodTarget` can't be deduplicated if any of its
# transitive dependencies can't be deduplicated.
pod_targets
.
flat_map
do
|
target
|
dependent_targets
=
transitive_dependencies_for_pod_target
(
target
,
pod_targets
)
target
.
dependent_targets
=
dependent_targets
if
dependent_targets
.
any?
(
&
:scoped?
)
target
.
scoped
(
dedupe_cache
)
else
target
end
end
else
dedupe_cache
=
{}
pod_targets
=
specs_by_target
.
flat_map
do
|
target_definition
,
specs
|
grouped_specs
=
specs
.
group_by
.
group_by
(
&
:root
).
values
.
uniq
grouped_specs
.
flat_map
do
|
pod_specs
|
generate_pod_target
([
target_definition
],
pod_specs
).
scoped
(
dedupe_cache
)
end
end
pod_targets
.
each
do
|
target
|
target
.
dependent_targets
=
transitive_dependencies_for_pod_target
(
target
,
pod_targets
)
end
end
pod_targets
.
each
do
|
target
|
target
.
dependent_targets
=
transitive_dependencies_for_pod_target
(
target
,
pod_targets
)
end
end
...
...
spec/unit/installer/analyzer_spec.rb
View file @
938e1a69
...
...
@@ -257,6 +257,7 @@ module Pod
source
SpecHelper
.
test_repo_url
platform
:ios
,
'6.0'
project
'SampleProject/SampleProject'
target
'SampleProject'
do
pod
'BananaLib'
pod
'monkey'
...
...
@@ -266,32 +267,6 @@ module Pod
pod
'monkey'
end
end
end
analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
podfile
)
result
=
analyzer
.
analyze
result
.
targets
.
flat_map
{
|
at
|
at
.
pod_targets
.
map
{
|
pt
|
"
#{
at
.
name
}
/
#{
pt
.
name
}
"
}
}.
sort
.
should
==
%w(
Pods-SampleProject-TestRunner/BananaLib
Pods-SampleProject-TestRunner/monkey
Pods-SampleProject/BananaLib
Pods-SampleProject/monkey
)
.
sort
end
it
"doesn't deduplicate targets, where transitive dependencies can't be deduplicated"
do
podfile
=
Pod
::
Podfile
.
new
do
source
SpecHelper
.
test_repo_url
platform
:ios
,
'6.0'
project
'SampleProject/SampleProject'
pod
'BananaLib'
pod
'monkey'
target
'SampleProject'
do
target
'TestRunner'
do
pod
'BananaLib'
pod
'monkey'
end
end
target
'CLITool'
do
platform
:osx
,
'10.10'
...
...
@@ -301,13 +276,12 @@ module Pod
analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
podfile
)
result
=
analyzer
.
analyze
result
.
targets
.
flat_map
{
|
at
|
at
.
pod_targets
.
map
{
|
pt
|
"
#{
at
.
name
}
/
#{
pt
.
name
}
"
}
}.
sort
.
should
==
%w(
Pods-CLITool/monkey-OSX
Pods-SampleProject-TestRunner/BananaLib-Pods-SampleProject-TestRunner
Pods-SampleProject-TestRunner/monkey-iOS
Pods-SampleProject/BananaLib-Pods-SampleProject
Pods-SampleProject/monkey-iOS
)
.
sort
pod_targets
=
result
.
targets
.
flat_map
(
&
:pod_targets
).
uniq
Hash
[
pod_targets
.
map
{
|
t
|
[
t
.
label
,
t
.
target_definitions
.
map
(
&
:label
).
sort
]
}.
sort
].
should
==
{
'BananaLib'
=>
%w(Pods-SampleProject Pods-SampleProject-TestRunner)
,
'monkey-iOS'
=>
%w(Pods-SampleProject Pods-SampleProject-TestRunner)
,
'monkey-OSX'
=>
%w(Pods-CLITool)
,
}
end
it
"doesn't deduplicate targets when deduplication is disabled"
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