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
a1a2b981
Commit
a1a2b981
authored
Mar 24, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Analyzer] Speed up #filter_pod_targets_for_target_definition
parent
ac26c003
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
21 deletions
+20
-21
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+20
-21
No files found.
lib/cocoapods/installer/analyzer.rb
View file @
a1a2b981
...
@@ -467,9 +467,8 @@ module Pod
...
@@ -467,9 +467,8 @@ module Pod
#
#
def
filter_pod_targets_for_target_definition
(
target_definition
,
pod_targets
,
resolver_specs_by_target
)
def
filter_pod_targets_for_target_definition
(
target_definition
,
pod_targets
,
resolver_specs_by_target
)
pod_targets
.
select
do
|
pod_target
|
pod_targets
.
select
do
|
pod_target
|
included_in_target_definition
=
pod_target
.
target_definitions
.
include?
(
target_definition
)
next
false
unless
pod_target
.
target_definitions
.
include?
(
target_definition
)
used_by_tests_only
=
resolver_specs_by_target
[
target_definition
].
select
{
|
resolver_spec
|
pod_target
.
specs
.
include?
(
resolver_spec
.
spec
)
}.
all?
(
&
:used_by_tests_only?
)
resolver_specs_by_target
[
target_definition
].
any?
{
|
resolver_spec
|
!
resolver_spec
.
used_by_tests_only?
&&
pod_target
.
specs
.
include?
(
resolver_spec
.
spec
)
}
included_in_target_definition
&&
!
used_by_tests_only
end
end
end
end
...
@@ -510,9 +509,9 @@ module Pod
...
@@ -510,9 +509,9 @@ 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
|
all_specs
=
all_resolver_specs
.
to_set
all_specs
=
all_resolver_specs
.
group_by
(
&
:name
)
dependencies
=
transitive_dependencies_for_specs
(
target
.
non_test_specs
.
to_set
,
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
dependencies
=
transitive_dependencies_for_specs
(
target
.
non_test_specs
.
to_set
,
target
.
platform
,
all_specs
.
dup
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
test_specs
.
to_set
,
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
test_specs
.
to_set
,
target
.
platform
,
all_specs
.
dup
).
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
)
...
@@ -526,9 +525,9 @@ module Pod
...
@@ -526,9 +525,9 @@ module Pod
end
end
pod_targets
.
each
do
|
target
|
pod_targets
.
each
do
|
target
|
all_specs
=
specs
.
map
(
&
:spec
).
to_set
all_specs
=
specs
.
map
(
&
:spec
).
group_by
(
&
:name
)
dependencies
=
transitive_dependencies_for_specs
(
target
.
non_test_specs
.
to_set
,
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
dependencies
=
transitive_dependencies_for_specs
(
target
.
non_test_specs
.
to_set
,
target
.
platform
,
all_specs
.
dup
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
test_specs
.
to_set
,
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
test_specs
.
to_set
,
target
.
platform
,
all_specs
.
dup
).
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?
}
...
@@ -559,7 +558,7 @@ module Pod
...
@@ -559,7 +558,7 @@ module Pod
# @param [Platform] platform
# @param [Platform] platform
# The platform for which the dependencies should be returned.
# The platform for which the dependencies should be returned.
#
#
# @param [
Array<
Specification>] all_specs
# @param [
Hash<String,
Specification>] all_specs
# All specifications which are installed alongside.
# All specifications which are installed alongside.
#
#
# @return [Array<Specification>]
# @return [Array<Specification>]
...
@@ -568,20 +567,20 @@ module Pod
...
@@ -568,20 +567,20 @@ module Pod
return
[]
if
specs
.
empty?
||
all_specs
.
empty?
return
[]
if
specs
.
empty?
||
all_specs
.
empty?
dependent_specs
=
Set
.
new
dependent_specs
=
Set
.
new
specs
.
each
do
|
spec
|
to_process
=
specs
spec
.
consumer
(
platform
).
dependencies
.
each
do
|
dependency
|
loop
do
match
=
all_specs
.
find
do
|
s
|
break
if
to_process
.
empty?
next
false
unless
s
.
name
==
dependency
.
name
next_to_process
=
Set
.
new
next
false
if
specs
.
include?
(
s
)
to_process
.
each
do
|
s
|
true
s
.
dependencies
(
platform
).
each
do
|
dep
|
all_specs
[
dep
.
name
].
each
do
|
spec
|
next_to_process
.
add
(
spec
)
if
dependent_specs
.
add?
(
spec
)
end
end
end
dependent_specs
<<
match
if
match
end
end
to_process
=
next_to_process
end
end
dependent_specs
-
specs
remaining_specs
=
all_specs
-
dependent_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