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
...
@@ -77,7 +77,7 @@ module Pod
end
end
end
end
end
if
config
.
verbose?
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
end
unless
config
.
skip_repo_update?
unless
config
.
skip_repo_update?
...
@@ -117,11 +117,11 @@ module Pod
...
@@ -117,11 +117,11 @@ module Pod
unless
@pods_to_install
unless
@pods_to_install
if
lockfile
if
lockfile
@pods_to_install
=
specs
.
select
do
|
spec
|
@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
)
end
.
map
(
&
:name
)
if
update_mode
if
update_mode
@pods_to_install
+=
specs
.
select
do
|
spec
|
@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
.
map
(
&
:name
)
end
end
@pods_to_install
+=
@pods_by_state
[
:added
]
+
@pods_by_state
[
:changed
]
@pods_to_install
+=
@pods_by_state
[
:added
]
+
@pods_by_state
[
:changed
]
...
@@ -139,7 +139,7 @@ module Pod
...
@@ -139,7 +139,7 @@ module Pod
def
removed_pods
def
removed_pods
return
[]
unless
lockfile
return
[]
unless
lockfile
unless
@removed_pods
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
}
installed
=
specs
.
map
{
|
spec
|
spec
.
name
.
split
(
'/'
).
first
}
@removed_pods
=
previusly_installed
-
installed
@removed_pods
=
previusly_installed
-
installed
end
end
...
@@ -155,17 +155,19 @@ module Pod
...
@@ -155,17 +155,19 @@ module Pod
@cached_sets
[
set_name
]
||=
begin
@cached_sets
[
set_name
]
||=
begin
if
dependency
.
specification
if
dependency
.
specification
Specification
::
Set
::
External
.
new
(
dependency
.
specification
)
Specification
::
Set
::
External
.
new
(
dependency
.
specification
)
elsif
external_source
=
dependency
.
external_source
elsif
dependency
.
external_source
if
update_mode
&&
update_external_specs
if
update_mode
&&
update_external_specs
# Always update external sources in update mode.
# Always update external sources in update mode.
external_source
=
ExternalSources
.
from_dependency
(
dependency
)
specification
=
external_source
.
specification_from_external
(
@sandbox
,
platform
)
specification
=
external_source
.
specification_from_external
(
@sandbox
,
platform
)
else
else
# Don't update external sources in install mode if not needed.
# 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
)
specification
=
external_source
.
specification_from_sandbox
(
@sandbox
,
platform
)
end
end
set
=
Specification
::
Set
::
External
.
new
(
specification
)
set
=
Specification
::
Set
::
External
.
new
(
specification
)
if
dependency
.
subspec_dependency?
if
dependency
.
subspec_dependency?
@cached_sets
[
dependency
.
root_
spec_
name
]
||=
set
@cached_sets
[
dependency
.
root_name
]
||=
set
end
end
set
set
else
else
...
@@ -186,7 +188,7 @@ module Pod
...
@@ -186,7 +188,7 @@ module Pod
dependencies
.
each
do
|
dependency
|
dependencies
.
each
do
|
dependency
|
# Replace the dependency with a more specific one if the pod is already installed.
# Replace the dependency with a more specific one if the pod is already installed.
if
!
update_mode
&&
@pods_to_lock
.
include?
(
dependency
.
name
)
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
end
UI
.
message
(
"-
#{
dependency
}
"
,
''
,
2
)
do
UI
.
message
(
"-
#{
dependency
}
"
,
''
,
2
)
do
set
=
find_cached_set
(
dependency
,
target_definition
.
platform
)
set
=
find_cached_set
(
dependency
,
target_definition
.
platform
)
...
@@ -195,7 +197,7 @@ module Pod
...
@@ -195,7 +197,7 @@ module Pod
# Ensure we don't resolve the same spec twice for one target
# Ensure we don't resolve the same spec twice for one target
unless
@loaded_specs
.
include?
(
dependency
.
name
)
unless
@loaded_specs
.
include?
(
dependency
.
name
)
spec
=
set
.
specification
.
subspec_by_name
(
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
@loaded_specs
<<
spec
.
name
@cached_specs
[
spec
.
name
]
=
spec
@cached_specs
[
spec
.
name
]
=
spec
# Configure the specification
# Configure the specification
...
...
spec/unit/resolver_spec.rb
View file @
fd2e4e57
...
@@ -110,12 +110,11 @@ module Pod
...
@@ -110,12 +110,11 @@ module Pod
}
}
end
end
# TODO inline podspecs are deprecated
xit
"it includes only the main subspec of a specification node"
do
xit
"it includes only the main subspec of a specification node"
do
@podfile
=
Podfile
.
new
do
spec
=
Spec
.
new
do
|
s
|
platform
:ios
pod
do
|
s
|
s
.
name
=
'RestKit'
s
.
name
=
'RestKit'
s
.
version
=
'
0.10.0'
s
.
version
=
'999999
0.10.0'
s
.
preferred_dependency
=
'JSON'
s
.
preferred_dependency
=
'JSON'
...
@@ -136,10 +135,21 @@ module Pod
...
@@ -136,10 +135,21 @@ module Pod
os
.
subspec
'CoreData'
os
.
subspec
'CoreData'
end
end
end
end
@podfile
=
Podfile
.
new
do
platform
:ios
pod
'RestKit'
end
end
Set
.
any_instance
.
stubs
(
:specification
).
returns
(
spec
)
resolver
=
Resolver
.
new
(
@podfile
,
nil
,
stub
(
'sandbox'
))
resolver
=
Resolver
.
new
(
@podfile
,
nil
,
stub
(
'sandbox'
))
resolver
.
find_cached_set
()
specs
=
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
specs
=
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
specs
.
should
.
not
.
include
'RestKit/ObjectMapping/XML'
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{
specs
.
should
==
%w{
LibComponentLogging-Core
LibComponentLogging-Core
LibComponentLogging-NSLog
LibComponentLogging-NSLog
...
@@ -172,7 +182,7 @@ module Pod
...
@@ -172,7 +182,7 @@ module Pod
fss
.
subspec
'SecondSubSpec'
fss
.
subspec
'SecondSubSpec'
end
end
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
=
Resolver
.
new
(
@podfile
,
nil
,
stub
(
'sandbox'
))
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
.
should
==
%w{ MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec }
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
.
should
==
%w{ MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec }
end
end
...
@@ -287,7 +297,7 @@ module Pod
...
@@ -287,7 +297,7 @@ module Pod
s
.
name
=
'libPusher'
s
.
name
=
'libPusher'
s
.
version
=
'1.3'
s
.
version
=
'1.3'
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
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
@resolver
.
resolve
@resolver
.
should_install?
(
"JSONKit"
).
should
.
be
.
false
@resolver
.
should_install?
(
"JSONKit"
).
should
.
be
.
false
...
@@ -347,9 +357,8 @@ module Pod
...
@@ -347,9 +357,8 @@ module Pod
describe
"Concerning Update mode"
do
describe
"Concerning Update mode"
do
before
do
before
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
repos_dir
=
fixture
(
'spec-repos'
)
@
podfile
=
Podfile
.
new
do
previous_
podfile
=
Podfile
.
new
do
platform
:ios
platform
:ios
pod
'BlocksKit'
,
'1.5.2'
pod
'JSONKit'
pod
'JSONKit'
pod
'libPusher'
pod
'libPusher'
end
end
...
@@ -363,7 +372,13 @@ module Pod
...
@@ -363,7 +372,13 @@ module Pod
s
.
version
=
"1.4"
s
.
version
=
"1.4"
end
]
end
]
@specs
.
each
{
|
s
|
s
.
activate_platform
(
:ios
)
}
@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
=
Resolver
.
new
(
@podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
update_mode
=
true
@resolver
.
update_mode
=
true
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