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
31f22430
Commit
31f22430
authored
Jan 18, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Analyzer] Use sets in #transitive_dependencies_for_specs
parent
7eb17735
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+17
-11
No files found.
lib/cocoapods/installer/analyzer.rb
View file @
31f22430
...
@@ -512,8 +512,8 @@ module Pod
...
@@ -512,8 +512,8 @@ module Pod
hash
[
name
]
=
values
.
sort_by
{
|
pt
|
pt
.
specs
.
count
}
hash
[
name
]
=
values
.
sort_by
{
|
pt
|
pt
.
specs
.
count
}
end
end
pod_targets
.
each
do
|
target
|
pod_targets
.
each
do
|
target
|
dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
reject
(
&
:test_specification?
)
,
target
.
platform
,
all_resolver_specs
).
group_by
(
&
:root
)
dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
reject
(
&
:test_specification?
)
.
to_set
,
target
.
platform
,
all_resolver_specs
.
to_set
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
select
(
&
:test_specification?
)
,
target
.
platform
,
all_resolver_specs
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
select
(
&
:test_specification?
)
.
to_set
,
target
.
platform
,
all_resolver_specs
.
to_set
).
group_by
(
&
:root
)
test_dependencies
.
delete_if
{
|
k
|
dependencies
.
key?
k
}
test_dependencies
.
delete_if
{
|
k
|
dependencies
.
key?
k
}
target
.
dependent_targets
=
filter_dependencies
(
dependencies
,
pod_targets_by_name
,
target
)
target
.
dependent_targets
=
filter_dependencies
(
dependencies
,
pod_targets_by_name
,
target
)
target
.
test_dependent_targets
=
filter_dependencies
(
test_dependencies
,
pod_targets_by_name
,
target
)
target
.
test_dependent_targets
=
filter_dependencies
(
test_dependencies
,
pod_targets_by_name
,
target
)
...
@@ -527,8 +527,8 @@ module Pod
...
@@ -527,8 +527,8 @@ module Pod
end
end
pod_targets
.
each
do
|
target
|
pod_targets
.
each
do
|
target
|
dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
reject
(
&
:test_specification?
)
,
target
.
platform
,
specs
.
map
(
&
:spec
)
).
group_by
(
&
:root
)
dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
reject
(
&
:test_specification?
)
.
to_set
,
target
.
platform
,
specs
.
map
(
&
:spec
).
to_set
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
select
(
&
:test_specification?
)
,
target
.
platform
,
specs
.
map
(
&
:spec
)
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
select
(
&
:test_specification?
)
.
to_set
,
target
.
platform
,
specs
.
map
(
&
:spec
).
to_set
).
group_by
(
&
:root
)
test_dependencies
.
delete_if
{
|
k
|
dependencies
.
key?
k
}
test_dependencies
.
delete_if
{
|
k
|
dependencies
.
key?
k
}
target
.
dependent_targets
=
pod_targets
.
reject
{
|
t
|
dependencies
[
t
.
root_spec
].
nil?
}
target
.
dependent_targets
=
pod_targets
.
reject
{
|
t
|
dependencies
[
t
.
root_spec
].
nil?
}
target
.
test_dependent_targets
=
pod_targets
.
reject
{
|
t
|
test_dependencies
[
t
.
root_spec
].
nil?
}
target
.
test_dependent_targets
=
pod_targets
.
reject
{
|
t
|
test_dependencies
[
t
.
root_spec
].
nil?
}
...
@@ -566,16 +566,22 @@ module Pod
...
@@ -566,16 +566,22 @@ module Pod
#
#
def
transitive_dependencies_for_specs
(
specs
,
platform
,
all_specs
)
def
transitive_dependencies_for_specs
(
specs
,
platform
,
all_specs
)
return
[]
if
specs
.
empty?
||
all_specs
.
empty?
return
[]
if
specs
.
empty?
||
all_specs
.
empty?
dependent_specs
=
specs
.
flat_map
do
|
spec
|
spec
.
consumer
(
platform
).
dependencies
.
flat_map
do
|
dependency
|
dependent_specs
=
Set
.
new
all_specs
.
find
do
|
s
|
specs
.
each
do
|
spec
|
spec
.
consumer
(
platform
).
dependencies
.
each
do
|
dependency
|
match
=
all_specs
.
find
do
|
s
|
next
false
unless
s
.
name
==
dependency
.
name
next
false
if
specs
.
include?
(
s
)
next
false
if
specs
.
include?
(
s
)
s
.
name
==
dependency
.
nam
e
tru
e
end
end
end
.
compact
dependent_specs
<<
match
if
match
end
.
uniq
end
end
remaining_specs
=
all_specs
-
dependent_specs
remaining_specs
=
all_specs
-
dependent_specs
dependent_specs
+
transitive_dependencies_for_specs
(
dependent_specs
,
platform
,
remaining_specs
)
dependent_specs
.
union
transitive_dependencies_for_specs
(
dependent_specs
,
platform
,
remaining_specs
)
end
end
# Create a target for each spec group
# Create a target for each spec group
...
...
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