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
7c68caba
Commit
7c68caba
authored
Jan 25, 2016
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Analyzer] More consistent scope suffixes
parent
e0ff376b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
18 deletions
+40
-18
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+17
-10
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+23
-8
No files found.
lib/cocoapods/installer/analyzer.rb
View file @
7c68caba
...
@@ -348,18 +348,22 @@ module Pod
...
@@ -348,18 +348,22 @@ module Pod
result
=
nil
result
=
nil
all_spec_variants
=
targets_by_distinctors
.
keys
.
map
{
|
k
|
k
[
0
]
}
all_spec_variants
=
targets_by_distinctors
.
keys
.
map
{
|
k
|
k
[
0
]
}
all_platform_variants
=
targets_by_distinctors
.
keys
.
map
{
|
k
|
k
[
1
]
}
all_platform_variants
=
targets_by_distinctors
.
keys
.
map
{
|
k
|
k
[
1
]
}
if
all_platform_variants
.
uniq
.
count
==
all_platform_variants
.
count
all_platform_name_variants
=
all_platform_variants
.
map
(
&
:name
)
all_platform_name_variants
=
all_platform_variants
.
map
(
&
:name
)
platform_name_proc
=
nil
if
all_platform_name_variants
.
uniq
.
count
==
all_platform_name_variants
.
count
if
all_platform_name_variants
.
uniq
.
count
==
all_platform_name_variants
.
count
# => Platform name
# => Platform name
result
=
targets_by_distinctors
.
map
{
|
d
,
_
|
[
d
,
Platform
.
string_name
(
d
[
1
].
symbolic_name
).
tr
(
' '
,
''
)]
}
platform_name_proc
=
proc
{
|
platform
|
Platform
.
string_name
(
platform
.
symbolic_name
).
tr
(
' '
,
''
)
}
else
else
# => Platform name + SDK version
# => Platform name + SDK version
result
=
targets_by_distinctors
.
map
{
|
d
,
_
|
[
d
,
d
[
1
].
to_s
.
tr
(
' '
,
''
)]
}
platform_name_proc
=
proc
{
|
platform
|
platform
.
to_s
.
tr
(
' '
,
''
)
}
end
end
elsif
all_spec_variants
.
uniq
.
count
==
all_spec_variants
.
count
if
all_platform_variants
.
uniq
.
count
==
all_platform_variants
.
count
result
=
targets_by_distinctors
.
map
{
|
d
,
_
|
[
d
,
platform_name_proc
.
call
(
d
[
1
])]
}
else
common_specs
=
all_spec_variants
.
reduce
(
all_spec_variants
.
first
,
&
:&
)
common_specs
=
all_spec_variants
.
reduce
(
all_spec_variants
.
first
,
&
:&
)
if
all_spec_variants
.
uniq
.
count
==
all_spec_variants
.
count
result
=
targets_by_distinctors
.
map
do
|
distinctor
,
_
|
result
=
targets_by_distinctors
.
map
do
|
distinctor
,
_
|
specs
,
=
*
distinctor
specs
,
=
*
distinctor
specs
-=
common_specs
specs
-=
common_specs
...
@@ -368,12 +372,15 @@ module Pod
...
@@ -368,12 +372,15 @@ module Pod
[
distinctor
,
subspec_names
.
empty?
?
nil
:
subspec_names
.
join
(
'-'
)]
[
distinctor
,
subspec_names
.
empty?
?
nil
:
subspec_names
.
join
(
'-'
)]
end
end
else
else
result
=
targets_by_distinctors
.
map
do
|
distinctor
,
target_definitions
|
result
=
targets_by_distinctors
.
map
do
|
distinctor
,
_
|
names
=
target_definitions
.
map
do
|
target_definition
|
specs
,
platform
=
*
distinctor
target_definition
.
root?
?
'Pods'
:
target_definition
.
name
specs
-=
common_specs
subspec_names
=
specs
.
map
{
|
spec
|
spec
.
name
.
split
(
'/'
)[
1
..-
1
].
join
(
'_'
)
}
platform_name
=
platform_name_proc
.
call
(
platform
)
name_parts
=
[
platform_name
]
+
subspec_names
# => Platform name (+ SDK version) + subspecs names without common subspecs
[
distinctor
,
name_parts
.
join
(
'-'
)]
end
end
# => *All* target definition names
[
distinctor
,
names
.
join
(
'-'
)]
end
end
end
end
...
...
spec/unit/installer/analyzer_spec.rb
View file @
7c68caba
...
@@ -163,18 +163,33 @@ module Pod
...
@@ -163,18 +163,33 @@ module Pod
@analyzer
.
send
(
:scope_suffix_for_distinctor
,
specs
).
values
.
should
==
[
nil
,
'Foo'
,
'Bar'
]
@analyzer
.
send
(
:scope_suffix_for_distinctor
,
specs
).
values
.
should
==
[
nil
,
'Foo'
,
'Bar'
]
end
end
it
'returns scopes by
target definition labels
'
do
it
'returns scopes by
platform names and subspec names if they qualify
'
do
specs
=
{
specs
=
{
[[
@root_spec
],
Platform
.
ios
]
=>
[
@target_definitions
[
0
]],
[[
@root_spec
],
Platform
.
ios
]
=>
[
@target_definitions
[
0
]],
[[
@root_spec
,
stub
(
:name
=>
'Spec/Foo'
)],
Platform
.
ios
]
=>
[
@target_definitions
[
1
]
,
@target_definitions
[
2
]
],
[[
@root_spec
,
stub
(
:name
=>
'Spec/Foo'
)],
Platform
.
ios
]
=>
[
@target_definitions
[
1
]],
[[
@root_spec
],
Platform
.
osx
]
=>
[
@target_definitions
[
3
]],
[[
@root_spec
],
Platform
.
osx
]
=>
[
@target_definitions
[
2
]],
[[
@root_spec
,
stub
(
:name
=>
'Spec/Bar'
)],
Platform
.
osx
]
=>
[
@target_definitions
[
4
]],
[[
@root_spec
,
stub
(
:name
=>
'Spec/Bar'
)],
Platform
.
osx
]
=>
[
@target_definitions
[
3
]],
}
}
@analyzer
.
send
(
:scope_suffix_for_distinctor
,
specs
).
values
.
should
==
[
@analyzer
.
send
(
:scope_suffix_for_distinctor
,
specs
).
values
.
should
==
[
'Pods'
,
'iOS'
,
'Target Definition 1-Target Definition 2'
,
'iOS-Foo'
,
'Target Definition 3'
,
'OSX'
,
'Target Definition 4'
,
'OSX-Bar'
,
]
end
it
'returns scopes by versioned platform names and subspec names if they qualify'
do
specs
=
{
[[
@root_spec
],
Platform
.
new
(
:ios
,
'7.0'
)]
=>
[
@target_definitions
[
0
]],
[[
@root_spec
,
stub
(
:name
=>
'Spec/Foo'
)],
Platform
.
ios
]
=>
[
@target_definitions
[
1
]],
[[
@root_spec
],
Platform
.
osx
]
=>
[
@target_definitions
[
2
]],
[[
@root_spec
,
stub
(
:name
=>
'Spec/Bar'
)],
Platform
.
osx
]
=>
[
@target_definitions
[
3
]],
}
@analyzer
.
send
(
:scope_suffix_for_distinctor
,
specs
).
values
.
should
==
[
'iOS7.0'
,
'iOS-Foo'
,
'OSX'
,
'OSX-Bar'
,
]
]
end
end
end
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