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
fd2e4e57
Commit
fd2e4e57
authored
Nov 20, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Resolver] adapted for Core extraction
parent
a1dbc948
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
17 deletions
+34
-17
resolver.rb
lib/cocoapods/resolver.rb
+10
-8
resolver_spec.rb
spec/unit/resolver_spec.rb
+24
-9
No files found.
lib/cocoapods/resolver.rb
View file @
fd2e4e57
...
...
@@ -77,7 +77,7 @@ module Pod
end
end
end
if
config
.
verbose?
@pods_to_lock
=
(
lockfile
.
pod
s
_names
-
@pods_by_state
[
:added
]
-
@pods_by_state
[
:changed
]
-
@pods_by_state
[
:removed
]).
uniq
@pods_to_lock
=
(
lockfile
.
pod_names
-
@pods_by_state
[
:added
]
-
@pods_by_state
[
:changed
]
-
@pods_by_state
[
:removed
]).
uniq
end
unless
config
.
skip_repo_update?
...
...
@@ -117,11 +117,11 @@ module Pod
unless
@pods_to_install
if
lockfile
@pods_to_install
=
specs
.
select
do
|
spec
|
spec
.
version
!=
lockfile
.
pod
s_versions
[
spec
.
root_spec_
name
]
spec
.
version
!=
lockfile
.
pod
_versions
[
spec
.
root
.
name
]
end
.
map
(
&
:name
)
if
update_mode
@pods_to_install
+=
specs
.
select
do
|
spec
|
spec
.
version
.
head?
||
pods_from_external_sources
.
include?
(
spec
.
root
_spec_
name
)
spec
.
version
.
head?
||
pods_from_external_sources
.
include?
(
spec
.
root
.
name
)
end
.
map
(
&
:name
)
end
@pods_to_install
+=
@pods_by_state
[
:added
]
+
@pods_by_state
[
:changed
]
...
...
@@ -139,7 +139,7 @@ module Pod
def
removed_pods
return
[]
unless
lockfile
unless
@removed_pods
previusly_installed
=
lockfile
.
pod
s
_names
.
map
{
|
pod_name
|
pod_name
.
split
(
'/'
).
first
}
previusly_installed
=
lockfile
.
pod_names
.
map
{
|
pod_name
|
pod_name
.
split
(
'/'
).
first
}
installed
=
specs
.
map
{
|
spec
|
spec
.
name
.
split
(
'/'
).
first
}
@removed_pods
=
previusly_installed
-
installed
end
...
...
@@ -155,17 +155,19 @@ module Pod
@cached_sets
[
set_name
]
||=
begin
if
dependency
.
specification
Specification
::
Set
::
External
.
new
(
dependency
.
specification
)
elsif
external_source
=
dependency
.
external_source
elsif
dependency
.
external_source
if
update_mode
&&
update_external_specs
# Always update external sources in update mode.
external_source
=
ExternalSources
.
from_dependency
(
dependency
)
specification
=
external_source
.
specification_from_external
(
@sandbox
,
platform
)
else
# Don't update external sources in install mode if not needed.
external_source
=
ExternalSources
.
from_dependency
(
dependency
)
specification
=
external_source
.
specification_from_sandbox
(
@sandbox
,
platform
)
end
set
=
Specification
::
Set
::
External
.
new
(
specification
)
if
dependency
.
subspec_dependency?
@cached_sets
[
dependency
.
root_
spec_
name
]
||=
set
@cached_sets
[
dependency
.
root_name
]
||=
set
end
set
else
...
...
@@ -186,7 +188,7 @@ module Pod
dependencies
.
each
do
|
dependency
|
# Replace the dependency with a more specific one if the pod is already installed.
if
!
update_mode
&&
@pods_to_lock
.
include?
(
dependency
.
name
)
dependency
=
lockfile
.
dependency_
for_installed_pod_with_root
_named
(
dependency
.
name
)
dependency
=
lockfile
.
dependency_
to_lock_pod
_named
(
dependency
.
name
)
end
UI
.
message
(
"-
#{
dependency
}
"
,
''
,
2
)
do
set
=
find_cached_set
(
dependency
,
target_definition
.
platform
)
...
...
@@ -195,7 +197,7 @@ module Pod
# Ensure we don't resolve the same spec twice for one target
unless
@loaded_specs
.
include?
(
dependency
.
name
)
spec
=
set
.
specification
.
subspec_by_name
(
dependency
.
name
)
@pods_from_external_sources
<<
spec
.
root
_spec_
name
if
dependency
.
external?
@pods_from_external_sources
<<
spec
.
root
.
name
if
dependency
.
external?
@loaded_specs
<<
spec
.
name
@cached_specs
[
spec
.
name
]
=
spec
# Configure the specification
...
...
spec/unit/resolver_spec.rb
View file @
fd2e4e57
...
...
@@ -110,12 +110,11 @@ module Pod
}
end
# TODO inline podspecs are deprecated
xit
"it includes only the main subspec of a specification node"
do
@podfile
=
Podfile
.
new
do
platform
:ios
pod
do
|
s
|
spec
=
Spec
.
new
do
|
s
|
s
.
name
=
'RestKit'
s
.
version
=
'
0.10.0'
s
.
version
=
'999999
0.10.0'
s
.
preferred_dependency
=
'JSON'
...
...
@@ -136,10 +135,21 @@ module Pod
os
.
subspec
'CoreData'
end
end
@podfile
=
Podfile
.
new
do
platform
:ios
pod
'RestKit'
end
Set
.
any_instance
.
stubs
(
:specification
).
returns
(
spec
)
resolver
=
Resolver
.
new
(
@podfile
,
nil
,
stub
(
'sandbox'
))
resolver
.
find_cached_set
()
specs
=
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
specs
.
should
.
not
.
include
'RestKit/ObjectMapping/XML'
spec
=
resolver
.
specs_by_target
.
values
.
first
.
first
spec
.
name
.
should
==
'test'
spec
.
version
.
should
==
'9999990.10.0'
specs
.
should
==
%w{
LibComponentLogging-Core
LibComponentLogging-NSLog
...
...
@@ -172,7 +182,7 @@ module Pod
fss
.
subspec
'SecondSubSpec'
end
end
@podfile
.
dependencies
.
first
.
external_sour
ce
.
stubs
(
:specification_from_sandbox
).
returns
(
spec
)
ExternalSources
::
GitSource
.
any_instan
ce
.
stubs
(
:specification_from_sandbox
).
returns
(
spec
)
resolver
=
Resolver
.
new
(
@podfile
,
nil
,
stub
(
'sandbox'
))
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
.
should
==
%w{ MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec }
end
...
...
@@ -287,7 +297,7 @@ module Pod
s
.
name
=
'libPusher'
s
.
version
=
'1.3'
end
podfile
.
dependencies
.
first
.
external_sour
ce
.
stubs
(
:specification_from_sandbox
).
returns
(
spec
)
ExternalSources
::
GitSource
.
any_instan
ce
.
stubs
(
:specification_from_sandbox
).
returns
(
spec
)
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
@resolver
.
should_install?
(
"JSONKit"
).
should
.
be
.
false
...
...
@@ -347,9 +357,8 @@ module Pod
describe
"Concerning Update mode"
do
before
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
@
podfile
=
Podfile
.
new
do
previous_
podfile
=
Podfile
.
new
do
platform
:ios
pod
'BlocksKit'
,
'1.5.2'
pod
'JSONKit'
pod
'libPusher'
end
...
...
@@ -363,7 +372,13 @@ module Pod
s
.
version
=
"1.4"
end
]
@specs
.
each
{
|
s
|
s
.
activate_platform
(
:ios
)
}
@lockfile
=
Lockfile
.
generate
(
@podfile
,
@specs
)
@lockfile
=
Lockfile
.
generate
(
previous_podfile
,
@specs
)
@podfile
=
Podfile
.
new
do
platform
:ios
pod
'BlocksKit'
,
'1.5.2'
pod
'JSONKit'
pod
'libPusher'
end
@resolver
=
Resolver
.
new
(
@podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
update_mode
=
true
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