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
38269a2a
Commit
38269a2a
authored
Apr 22, 2016
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Analyzer] Detect if a source update is needed
parent
242da6b5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
3 deletions
+38
-3
install.rb
lib/cocoapods/command/install.rb
+1
-1
installer.rb
lib/cocoapods/installer.rb
+6
-2
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+27
-0
specs_state.rb
lib/cocoapods/installer/analyzer/specs_state.rb
+4
-0
No files found.
lib/cocoapods/command/install.rb
View file @
38269a2a
...
@@ -32,7 +32,7 @@ module Pod
...
@@ -32,7 +32,7 @@ module Pod
def
run
def
run
verify_podfile_exists!
verify_podfile_exists!
installer
=
installer_for_config
installer
=
installer_for_config
installer
.
repo_update
=
repo_update?
(
:default
=>
false
)
installer
.
repo_update
=
repo_update?
(
:default
=>
nil
)
installer
.
update
=
false
installer
.
update
=
false
installer
.
install!
installer
.
install!
end
end
...
...
lib/cocoapods/installer.rb
View file @
38269a2a
...
@@ -143,12 +143,16 @@ module Pod
...
@@ -143,12 +143,16 @@ module Pod
plugin_sources
=
run_source_provider_hooks
plugin_sources
=
run_source_provider_hooks
analyzer
.
sources
.
insert
(
0
,
*
plugin_sources
)
analyzer
.
sources
.
insert
(
0
,
*
plugin_sources
)
analyzer
.
pre_analysis_fetching
UI
.
section
'Updating local specs repositories'
do
UI
.
section
'Updating local specs repositories'
do
analyzer
.
update_repositories
analyzer
.
update_repositories
end
if
repo_update?
end
if
repo_update?
||
(
repo_update
.
nil?
&&
analyzer
.
needs_spec_repo_update?
)
UI
.
section
'Analyzing dependencies'
do
UI
.
section
'Analyzing dependencies'
do
analyze
(
analyzer
)
analyzer
.
update
=
update
@analysis_result
=
analyzer
.
analyze_after_fetch
@aggregate_targets
=
@analysis_result
.
targets
validate_build_configurations
validate_build_configurations
clean_sandbox
clean_sandbox
end
end
...
...
lib/cocoapods/installer/analyzer.rb
View file @
38269a2a
...
@@ -47,6 +47,25 @@ module Pod
...
@@ -47,6 +47,25 @@ module Pod
@allow_pre_downloads
=
true
@allow_pre_downloads
=
true
end
end
def
needs_spec_repo_update?
raise
'Called without @result'
unless
@result
return
true
if
!
lockfile
||
!
@result
.
podfile_state
.
unchanged?
resolver
=
Resolver
.
new
(
sandbox
,
podfile
,
locked_dependencies
,
sources
)
dependencies
=
podfile
.
dependencies
.
group_by
(
&
:root_name
)
lockfile
.
pod_names
.
none?
do
|
name
|
version
=
lockfile
.
version
(
name
)
deps
=
dependencies
[
name
]
||
[
Dependency
.
new
(
name
,
version
)]
deps
.
all?
do
|
dep
|
set
=
resolver
.
send
(
:find_cached_set
,
dep
)
return
true
unless
spec_file
=
set
.
specification_paths_for_version
(
version
).
first
return
true
unless
spec
=
Specification
.
from_file
(
spec_file
)
spec
.
checksum
==
lockfile
.
checksum
(
name
)
end
end
rescue
true
end
# Performs the analysis.
# Performs the analysis.
#
#
# The Podfile and the Lockfile provide the information necessary to
# The Podfile and the Lockfile provide the information necessary to
...
@@ -59,6 +78,12 @@ module Pod
...
@@ -59,6 +78,12 @@ module Pod
# @return [AnalysisResult]
# @return [AnalysisResult]
#
#
def
analyze
(
allow_fetches
=
true
)
def
analyze
(
allow_fetches
=
true
)
pre_analysis_fetching
(
allow_fetches
)
analyze_after_fetch
end
def
pre_analysis_fetching
(
allow_fetches
=
true
)
validate_podfile!
validate_podfile!
validate_lockfile_version!
validate_lockfile_version!
@result
=
AnalysisResult
.
new
@result
=
AnalysisResult
.
new
...
@@ -71,7 +96,9 @@ module Pod
...
@@ -71,7 +96,9 @@ module Pod
store_existing_checkout_options
store_existing_checkout_options
fetch_external_sources
if
allow_fetches
fetch_external_sources
if
allow_fetches
end
def
analyze_after_fetch
@locked_dependencies
=
generate_version_locking_dependencies
@locked_dependencies
=
generate_version_locking_dependencies
@result
.
specs_by_target
=
validate_platforms
(
resolve_dependencies
)
@result
.
specs_by_target
=
validate_platforms
(
resolve_dependencies
)
@result
.
specifications
=
generate_specifications
@result
.
specifications
=
generate_specifications
...
...
lib/cocoapods/installer/analyzer/specs_state.rb
View file @
38269a2a
...
@@ -78,6 +78,10 @@ module Pod
...
@@ -78,6 +78,10 @@ module Pod
def
add_name
(
name
,
state
)
def
add_name
(
name
,
state
)
send
(
state
)
<<
Specification
.
root_name
(
name
)
send
(
state
)
<<
Specification
.
root_name
(
name
)
end
end
def
unchanged?
[
added
,
deleted
,
changed
].
all?
(
&
:empty?
)
end
end
end
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