[Analyzer] Unlock local dependencies if their specification changes

parent 1160056e
...@@ -68,10 +68,11 @@ module Pod ...@@ -68,10 +68,11 @@ module Pod
verify_platforms_specified! verify_platforms_specified!
end end
@result.podfile_state = generate_podfile_state @result.podfile_state = generate_podfile_state
@locked_dependencies = generate_version_locking_dependencies
store_existing_checkout_options store_existing_checkout_options
fetch_external_sources if allow_fetches fetch_external_sources if allow_fetches
@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
@result.targets = generate_targets @result.targets = generate_targets
...@@ -417,8 +418,11 @@ module Pod ...@@ -417,8 +418,11 @@ module Pod
else else
pods_to_update = result.podfile_state.changed + result.podfile_state.deleted pods_to_update = result.podfile_state.changed + result.podfile_state.deleted
pods_to_update += update[:pods] if update_mode == :selected pods_to_update += update[:pods] if update_mode == :selected
pods_to_update += podfile.dependencies.select(&:local?).map(&:name) local_pod_names = podfile.dependencies.select(&:local?).map(&:root_name)
LockingDependencyAnalyzer.generate_version_locking_dependencies(lockfile, pods_to_update) pods_to_unlock = local_pod_names.reject do |pod_name|
sandbox.specification(pod_name).checksum == lockfile.checksum(pod_name)
end
LockingDependencyAnalyzer.generate_version_locking_dependencies(lockfile, pods_to_update, pods_to_unlock)
end end
end end
......
...@@ -6,6 +6,8 @@ module Pod ...@@ -6,6 +6,8 @@ module Pod
# Generates dependencies that require the specific version of the Pods # Generates dependencies that require the specific version of the Pods
# that haven't changed in the {Lockfile}. # that haven't changed in the {Lockfile}.
module LockingDependencyAnalyzer module LockingDependencyAnalyzer
class << self; attr_accessor :pods_to_unlock; end
# Generates dependencies that require the specific version of the Pods # Generates dependencies that require the specific version of the Pods
# that haven't changed in the {Lockfile}. # that haven't changed in the {Lockfile}.
# #
...@@ -17,7 +19,8 @@ module Pod ...@@ -17,7 +19,8 @@ module Pod
# generated by the lockfile that prevent the resolver to update # generated by the lockfile that prevent the resolver to update
# a Pod. # a Pod.
# #
def self.generate_version_locking_dependencies(lockfile, pods_to_update) def self.generate_version_locking_dependencies(lockfile, pods_to_update, pods_to_unlock = nil)
self.pods_to_unlock = pods_to_unlock
dependency_graph = Molinillo::DependencyGraph.new dependency_graph = Molinillo::DependencyGraph.new
if lockfile if lockfile
...@@ -58,6 +61,9 @@ module Pod ...@@ -58,6 +61,9 @@ module Pod
def self.add_child_vertex_to_graph(dependency_string, parents, dependency_graph) def self.add_child_vertex_to_graph(dependency_string, parents, dependency_graph)
dependency = Dependency.from_string(dependency_string) dependency = Dependency.from_string(dependency_string)
if self.pods_to_unlock.any? { |name| dependency.root_name == name }
dependency = Dependency.new(dependency.name)
end
dependency_graph.add_child_vertex(dependency.name, parents.empty? ? dependency : nil, parents, nil) dependency_graph.add_child_vertex(dependency.name, parents.empty? ? dependency : nil, parents, nil)
dependency dependency
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment