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
dd25038c
Unverified
Commit
dd25038c
authored
Jan 26, 2018
by
Samuel Giddins
Committed by
GitHub
Jan 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7358 from CocoaPods/seg-resolver-spec-source
Store spec repos in the Lockfile
parents
ae76d127
f4548634
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
61 additions
and
31 deletions
+61
-31
CHANGELOG.md
CHANGELOG.md
+3
-0
Gemfile.lock
Gemfile.lock
+2
-2
installer.rb
lib/cocoapods/installer.rb
+1
-1
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+2
-0
analysis_result.rb
lib/cocoapods/installer/analyzer/analysis_result.rb
+5
-0
resolver.rb
lib/cocoapods/resolver.rb
+7
-2
lazy_specification.rb
lib/cocoapods/resolver/lazy_specification.rb
+28
-18
error_report.rb
lib/cocoapods/user_interface/error_report.rb
+1
-1
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
update_spec.rb
spec/functional/command/update_spec.rb
+5
-1
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+5
-5
installer_spec.rb
spec/unit/installer_spec.rb
+1
-0
No files found.
CHANGELOG.md
View file @
dd25038c
...
@@ -20,6 +20,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -20,6 +20,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
existing specs that have already been pushed.
existing specs that have already been pushed.
[
Samuel Giddins
](
https://github.com/segiddins
)
[
Samuel Giddins
](
https://github.com/segiddins
)
*
Store which specs repo a pod comes from in the lockfile.
[
Samuel Giddins
](
https://github.com/segiddins
)
##### Bug Fixes
##### Bug Fixes
*
Always update input/output paths even if they are empty
*
Always update input/output paths even if they are empty
...
...
Gemfile.lock
View file @
dd25038c
...
@@ -7,7 +7,7 @@ GIT
...
@@ -7,7 +7,7 @@ GIT
GIT
GIT
remote: https://github.com/CocoaPods/Core.git
remote: https://github.com/CocoaPods/Core.git
revision:
b4fb2f193897c789c094d126ebca91034edc261d
revision:
c67c10dc718bae4c07bdfb78d8917134432aaff4
branch: master
branch: master
specs:
specs:
cocoapods-core (1.4.0)
cocoapods-core (1.4.0)
...
@@ -180,7 +180,7 @@ GEM
...
@@ -180,7 +180,7 @@ GEM
gh_inspector (1.0.3)
gh_inspector (1.0.3)
git (1.3.0)
git (1.3.0)
hashdiff (0.3.1)
hashdiff (0.3.1)
i18n (0.9.
1
)
i18n (0.9.
3
)
concurrent-ruby (~> 1.0)
concurrent-ruby (~> 1.0)
inch (0.7.0)
inch (0.7.0)
pry
pry
...
...
lib/cocoapods/installer.rb
View file @
dd25038c
...
@@ -550,7 +550,7 @@ module Pod
...
@@ -550,7 +550,7 @@ module Pod
def
write_lockfiles
def
write_lockfiles
external_source_pods
=
podfile
.
dependencies
.
select
(
&
:external_source
).
map
(
&
:root_name
).
uniq
external_source_pods
=
podfile
.
dependencies
.
select
(
&
:external_source
).
map
(
&
:root_name
).
uniq
checkout_options
=
sandbox
.
checkout_sources
.
select
{
|
root_name
,
_
|
external_source_pods
.
include?
root_name
}
checkout_options
=
sandbox
.
checkout_sources
.
select
{
|
root_name
,
_
|
external_source_pods
.
include?
root_name
}
@lockfile
=
Lockfile
.
generate
(
podfile
,
analysis_result
.
specifications
,
checkout_options
)
@lockfile
=
Lockfile
.
generate
(
podfile
,
analysis_result
.
specifications
,
checkout_options
,
analysis_result
.
specs_by_source
)
UI
.
message
"- Writing Lockfile in
#{
UI
.
path
config
.
lockfile_path
}
"
do
UI
.
message
"- Writing Lockfile in
#{
UI
.
path
config
.
lockfile_path
}
"
do
@lockfile
.
write_to_disk
(
config
.
lockfile_path
)
@lockfile
.
write_to_disk
(
config
.
lockfile_path
)
...
...
lib/cocoapods/installer/analyzer.rb
View file @
dd25038c
...
@@ -90,6 +90,8 @@ module Pod
...
@@ -90,6 +90,8 @@ module Pod
@result
.
specs_by_target
=
resolver_specs_by_target
.
each_with_object
({})
do
|
rspecs_by_target
,
hash
|
@result
.
specs_by_target
=
resolver_specs_by_target
.
each_with_object
({})
do
|
rspecs_by_target
,
hash
|
hash
[
rspecs_by_target
[
0
]]
=
rspecs_by_target
[
1
].
map
(
&
:spec
)
hash
[
rspecs_by_target
[
0
]]
=
rspecs_by_target
[
1
].
map
(
&
:spec
)
end
end
@result
.
specs_by_source
=
Hash
[
resolver_specs_by_target
.
values
.
flatten
(
1
).
group_by
(
&
:source
).
map
{
|
source
,
specs
|
[
source
,
specs
.
map
(
&
:spec
).
uniq
]
}]
sources
.
each
{
|
s
|
@result
.
specs_by_source
[
s
]
||=
[]
}
@result
@result
end
end
...
...
lib/cocoapods/installer/analyzer/analysis_result.rb
View file @
dd25038c
...
@@ -11,6 +11,11 @@ module Pod
...
@@ -11,6 +11,11 @@ module Pod
#
#
attr_accessor
:specs_by_target
attr_accessor
:specs_by_target
# @return [Hash{Source => Array<Specification>}] the
# specifications grouped by spec repo source.
#
attr_accessor
:specs_by_source
# @return [Array<Specification>] the specifications of the resolved
# @return [Array<Specification>] the specifications of the resolved
# version of Pods that should be installed.
# version of Pods that should be installed.
#
#
...
...
lib/cocoapods/resolver.rb
View file @
dd25038c
...
@@ -20,14 +20,19 @@ module Pod
...
@@ -20,14 +20,19 @@ module Pod
#
#
attr_reader
:spec
attr_reader
:spec
# @return [Source] the spec repo source the specification came from
#
attr_reader
:source
# @return [Bool] whether this resolved specification is only used by tests.
# @return [Bool] whether this resolved specification is only used by tests.
#
#
attr_reader
:used_by_tests_only
attr_reader
:used_by_tests_only
alias
used_by_tests_only?
used_by_tests_only
alias
used_by_tests_only?
used_by_tests_only
def
initialize
(
spec
,
used_by_tests_only
)
def
initialize
(
spec
,
used_by_tests_only
,
source
)
@spec
=
spec
@spec
=
spec
@used_by_tests_only
=
used_by_tests_only
@used_by_tests_only
=
used_by_tests_only
@source
=
source
end
end
def
name
def
name
...
@@ -129,7 +134,7 @@ module Pod
...
@@ -129,7 +134,7 @@ module Pod
resolver_specs_by_target
[
target
]
=
specs
.
resolver_specs_by_target
[
target
]
=
specs
.
group_by
(
&
:first
).
group_by
(
&
:first
).
map
{
|
vertex
,
spec_test_only_tuples
|
ResolverSpecification
.
new
(
vertex
.
payload
,
spec_test_only_tuples
.
map
{
|
tuple
|
tuple
[
1
]
}.
all?
)
}.
map
{
|
vertex
,
spec_test_only_tuples
|
ResolverSpecification
.
new
(
vertex
.
payload
,
spec_test_only_tuples
.
map
{
|
tuple
|
tuple
[
1
]
}.
all?
,
vertex
.
payload
.
respond_to?
(
:spec_source
)
&&
vertex
.
payload
.
spec_source
)
}.
sort_by
(
&
:name
)
sort_by
(
&
:name
)
end
end
end
end
...
...
lib/cocoapods/resolver/lazy_specification.rb
View file @
dd25038c
require
'delegate'
module
Pod
module
Pod
class
Specification
class
Specification
class
Set
class
Set
class
LazySpecification
<
BasicObject
class
SpecWithSource
<
DelegateClass
(
Specification
)
attr_reader
:name
,
:version
,
:source
attr_reader
:spec_repo
def
initialize
(
spec
,
source
)
def
initialize
(
name
,
version
,
source
)
super
(
spec
)
@name
=
name
@spec_repo
=
source
@version
=
version
@source
=
source
end
end
def
method_missing
(
method
,
*
args
,
&
block
)
undef
is_a?
specification
.
send
(
method
,
*
args
,
&
block
)
end
end
class
LazySpecification
<
DelegateClass
(
Specification
)
attr_reader
:name
,
:version
,
:spec_source
def
respond_to_missing?
(
method
,
include_all
=
false
)
def
initialize
(
name
,
version
,
spec_source
)
specification
.
respond_to?
(
method
,
include_all
)
@name
=
name
@version
=
version
@spec_source
=
spec_source
end
end
def
subspec_by_name
(
name
=
nil
,
raise_if_missing
=
true
,
include_test_specifications
=
false
)
def
subspec_by_name
(
name
=
nil
,
raise_if_missing
=
true
,
include_test_specifications
=
false
)
if
!
name
||
name
==
self
.
name
subspec
=
self
if
!
name
||
name
==
self
.
name
else
self
specification
.
subspec_by_name
(
name
,
raise_if_missing
,
include_test_specifications
)
else
end
specification
.
subspec_by_name
(
name
,
raise_if_missing
,
include_test_specifications
)
end
return
unless
subspec
SpecWithSource
.
new
subspec
,
spec_source
end
end
def
specification
def
specification
@specification
||=
source
.
specification
(
name
,
version
.
version
)
@specification
||=
s
pec_s
ource
.
specification
(
name
,
version
.
version
)
end
end
alias
__getobj__
specification
undef
is_a?
end
end
class
External
class
External
...
...
lib/cocoapods/user_interface/error_report.rb
View file @
dd25038c
...
@@ -32,7 +32,7 @@ module Pod
...
@@ -32,7 +32,7 @@ module Pod
```
```
#{
exception
.
class
}
-
#{
exception
.
message
}
#{
exception
.
class
}
-
#{
exception
.
message
}
#{
exception
.
backtrace
.
join
(
"
\n
"
)
}
#{
exception
.
backtrace
.
join
(
"
\n
"
)
if
exception
.
backtrace
}
```
```
#{
'――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'
.
reversed
}
#{
'――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'
.
reversed
}
...
...
cocoapods-integration-specs
@
42f00e7a
Subproject commit 4
7f6e71c0f9001d2da80686e9b90870ad394e228
Subproject commit 4
2f00e7a2b76ce69b0f3c7a06f85baa7a874d71b
spec/functional/command/update_spec.rb
View file @
dd25038c
...
@@ -30,7 +30,11 @@ module Pod
...
@@ -30,7 +30,11 @@ module Pod
end
,
end
,
]
]
external_sources
=
{}
external_sources
=
{}
Lockfile
.
generate
(
podfile
,
specs
,
external_sources
).
write_to_disk
(
temporary_directory
+
'Podfile.lock'
)
specs_by_source
=
{
Source
.
new
(
fixture
(
'spec-repos/master'
))
=>
specs
,
}
Lockfile
.
generate
(
podfile
,
specs
,
external_sources
,
specs_by_source
).
write_to_disk
(
temporary_directory
+
'Podfile.lock'
)
end
end
describe
'updates of the spec repos'
do
describe
'updates of the spec repos'
do
...
...
spec/unit/installer/analyzer_spec.rb
View file @
dd25038c
...
@@ -698,8 +698,8 @@ module Pod
...
@@ -698,8 +698,8 @@ module Pod
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
it
'does include pod target if any spec is not used by tests only and is part of target definition'
do
it
'does include pod target if any spec is not used by tests only and is part of target definition'
do
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
false
)
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
false
,
nil
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
,
nil
)
target_definition
=
stub
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
])
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
])
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
...
@@ -707,8 +707,8 @@ module Pod
...
@@ -707,8 +707,8 @@ module Pod
end
end
it
'does not include pod target if its used by tests only'
do
it
'does not include pod target if its used by tests only'
do
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
)
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
,
nil
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
,
nil
)
target_definition
=
stub
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
])
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
])
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
...
@@ -716,7 +716,7 @@ module Pod
...
@@ -716,7 +716,7 @@ module Pod
end
end
it
'does not include pod target if its not part of the target definition'
do
it
'does not include pod target if its not part of the target definition'
do
spec
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
false
)
spec
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
false
,
nil
)
target_definition
=
stub
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[],
:specs
=>
[
spec
.
spec
])
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[],
:specs
=>
[
spec
.
spec
])
resolver_specs_by_target
=
{
target_definition
=>
[
spec
]
}
resolver_specs_by_target
=
{
target_definition
=>
[
spec
]
}
...
...
spec/unit/installer_spec.rb
View file @
dd25038c
...
@@ -564,6 +564,7 @@ module Pod
...
@@ -564,6 +564,7 @@ module Pod
before
do
before
do
@analysis_result
=
Installer
::
Analyzer
::
AnalysisResult
.
new
@analysis_result
=
Installer
::
Analyzer
::
AnalysisResult
.
new
@analysis_result
.
specifications
=
[
fixture_spec
(
'banana-lib/BananaLib.podspec'
)]
@analysis_result
.
specifications
=
[
fixture_spec
(
'banana-lib/BananaLib.podspec'
)]
@analysis_result
.
specs_by_source
=
{}
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
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