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`
existing specs that have already been pushed.
[
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
*
Always update input/output paths even if they are empty
...
...
Gemfile.lock
View file @
dd25038c
...
...
@@ -7,7 +7,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Core.git
revision:
b4fb2f193897c789c094d126ebca91034edc261d
revision:
c67c10dc718bae4c07bdfb78d8917134432aaff4
branch: master
specs:
cocoapods-core (1.4.0)
...
...
@@ -180,7 +180,7 @@ GEM
gh_inspector (1.0.3)
git (1.3.0)
hashdiff (0.3.1)
i18n (0.9.
1
)
i18n (0.9.
3
)
concurrent-ruby (~> 1.0)
inch (0.7.0)
pry
...
...
lib/cocoapods/installer.rb
View file @
dd25038c
...
...
@@ -550,7 +550,7 @@ module Pod
def
write_lockfiles
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
}
@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
@lockfile
.
write_to_disk
(
config
.
lockfile_path
)
...
...
lib/cocoapods/installer/analyzer.rb
View file @
dd25038c
...
...
@@ -90,6 +90,8 @@ module Pod
@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
)
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
end
...
...
lib/cocoapods/installer/analyzer/analysis_result.rb
View file @
dd25038c
...
...
@@ -11,6 +11,11 @@ module Pod
#
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
# version of Pods that should be installed.
#
...
...
lib/cocoapods/resolver.rb
View file @
dd25038c
...
...
@@ -20,14 +20,19 @@ module Pod
#
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.
#
attr_reader
: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
@used_by_tests_only
=
used_by_tests_only
@source
=
source
end
def
name
...
...
@@ -129,7 +134,7 @@ module Pod
resolver_specs_by_target
[
target
]
=
specs
.
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
)
end
end
...
...
lib/cocoapods/resolver/lazy_specification.rb
View file @
dd25038c
require
'delegate'
module
Pod
class
Specification
class
Set
class
LazySpecification
<
BasicObject
attr_reader
:name
,
:version
,
:source
def
initialize
(
name
,
version
,
source
)
@name
=
name
@version
=
version
@source
=
source
class
SpecWithSource
<
DelegateClass
(
Specification
)
attr_reader
:spec_repo
def
initialize
(
spec
,
source
)
super
(
spec
)
@spec_repo
=
source
end
def
method_missing
(
method
,
*
args
,
&
block
)
specification
.
send
(
method
,
*
args
,
&
block
)
end
undef
is_a?
end
class
LazySpecification
<
DelegateClass
(
Specification
)
attr_reader
:name
,
:version
,
:spec_source
def
respond_to_missing?
(
method
,
include_all
=
false
)
specification
.
respond_to?
(
method
,
include_all
)
def
initialize
(
name
,
version
,
spec_source
)
@name
=
name
@version
=
version
@spec_source
=
spec_source
end
def
subspec_by_name
(
name
=
nil
,
raise_if_missing
=
true
,
include_test_specifications
=
false
)
if
!
name
||
name
==
self
.
name
self
else
specification
.
subspec_by_name
(
name
,
raise_if_missing
,
include_test_specifications
)
end
subspec
=
if
!
name
||
name
==
self
.
name
self
else
specification
.
subspec_by_name
(
name
,
raise_if_missing
,
include_test_specifications
)
end
return
unless
subspec
SpecWithSource
.
new
subspec
,
spec_source
end
def
specification
@specification
||=
source
.
specification
(
name
,
version
.
version
)
@specification
||=
s
pec_s
ource
.
specification
(
name
,
version
.
version
)
end
alias
__getobj__
specification
undef
is_a?
end
class
External
...
...
lib/cocoapods/user_interface/error_report.rb
View file @
dd25038c
...
...
@@ -32,7 +32,7 @@ module Pod
```
#{
exception
.
class
}
-
#{
exception
.
message
}
#{
exception
.
backtrace
.
join
(
"
\n
"
)
}
#{
exception
.
backtrace
.
join
(
"
\n
"
)
if
exception
.
backtrace
}
```
#{
'――― 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
end
,
]
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
describe
'updates of the spec repos'
do
...
...
spec/unit/installer/analyzer_spec.rb
View file @
dd25038c
...
...
@@ -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
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
false
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
)
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
false
,
nil
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
,
nil
)
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
])
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
...
...
@@ -707,8 +707,8 @@ module Pod
end
it
'does not include pod target if its used by tests only'
do
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
)
spec1
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
,
nil
)
spec2
=
Resolver
::
ResolverSpecification
.
new
(
stub
,
true
,
nil
)
target_definition
=
stub
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[
target_definition
],
:specs
=>
[
spec1
.
spec
,
spec2
.
spec
])
resolver_specs_by_target
=
{
target_definition
=>
[
spec1
,
spec2
]
}
...
...
@@ -716,7 +716,7 @@ module Pod
end
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
pod_target
=
stub
(
:name
=>
'Pod1'
,
:target_definitions
=>
[],
:specs
=>
[
spec
.
spec
])
resolver_specs_by_target
=
{
target_definition
=>
[
spec
]
}
...
...
spec/unit/installer_spec.rb
View file @
dd25038c
...
...
@@ -564,6 +564,7 @@ module Pod
before
do
@analysis_result
=
Installer
::
Analyzer
::
AnalysisResult
.
new
@analysis_result
.
specifications
=
[
fixture_spec
(
'banana-lib/BananaLib.podspec'
)]
@analysis_result
.
specs_by_source
=
{}
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
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