Commit 06bab6d9 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Analyzer] Use specific checkout options from lockfile

parent 9ca5e278
GIT
remote: https://github.com/CocoaPods/Core.git
revision: 60a486e8141323390dc5ff7f6676cf893a251a48
branch: master
revision: 854ff482bc9d41b1acebbaae2fc6c67204a08d0f
branch: lockfile-checkout-options
specs:
cocoapods-core (0.35.0.rc2)
activesupport (>= 3.2.15)
......
......@@ -13,9 +13,11 @@ module Pod
# hash.
#
def self.from_dependency(dependency, podfile_path)
name = dependency.root_name
params = dependency.external_source
from_params(dependency.external_source, dependency, podfile_path)
end
def self.from_params(params, dependency, podfile_path)
name = dependency.root_name
if klass = concrete_class_from_params(params)
klass.new(name, params, podfile_path)
else
......
......@@ -466,7 +466,7 @@ module Pod
#
def write_lockfiles
# checkout_options = sandbox.checkout_options
@lockfile = Lockfile.generate(podfile, analysis_result.specifications)
@lockfile = Lockfile.generate(podfile, analysis_result.specifications, sandbox.checkout_sources)
UI.message "- Writing Lockfile in #{UI.path config.lockfile_path}" do
@lockfile.write_to_disk(config.lockfile_path)
......
......@@ -264,34 +264,55 @@ module Pod
#
def fetch_external_sources
return unless allow_pre_downloads?
deps_to_fetch = []
deps_to_fetch_if_needed = []
deps_with_external_source = podfile.dependencies.select(&:external_source)
deps_with_different_sources = podfile.dependencies.group_by(&:root_name).select { |_root_name, dependencies| dependencies.map(&:external_source).uniq.count > 1 }
deps_with_different_sources.each do |root_name, dependencies|
raise Informative, "There are multiple dependencies with different sources for `#{root_name}` in #{UI.path podfile.defined_in_file}:\n\n- #{dependencies.map(&:to_s).join("\n- ")}"
end
unless dependencies_to_fetch.empty?
UI.section 'Fetching external sources' do
dependencies_to_fetch.sort.each do |dependency|
fetch_external_source(dependency, !pods_to_fetch.include?(dependency.name))
end
end
end
end
def fetch_external_source(dependency, use_lockfile_options)
checkout_options = lockfile.checkout_options_for_pod_named(dependency.root_name) if lockfile
if checkout_options && use_lockfile_options
source = ExternalSources.from_params(checkout_options, dependency, podfile.defined_in_file)
else
source = ExternalSources.from_dependency(dependency, podfile.defined_in_file)
end
source.fetch(sandbox)
end
def dependencies_to_fetch
@deps_to_fetch ||= begin
deps_to_fetch = []
deps_to_fetch_if_needed = []
deps_with_external_source = podfile.dependencies.select(&:external_source)
if update_mode == :all
deps_to_fetch = deps_with_external_source
else
pods_to_fetch = result.podfile_state.added + result.podfile_state.changed
if update_mode == :selected
pods_to_fetch += update[:pods]
end
deps_to_fetch = deps_with_external_source.select { |dep| pods_to_fetch.include?(dep.name) }
deps_to_fetch_if_needed = deps_with_external_source.select { |dep| result.podfile_state.unchanged.include?(dep.name) }
deps_to_fetch += deps_to_fetch_if_needed.select { |dep| sandbox.specification(dep.name).nil? || !dep.external_source[:local].nil? || !dep.external_source[:path].nil? || !sandbox.pod_dir(dep.name).directory? }
end
unless deps_to_fetch.empty?
UI.section 'Fetching external sources' do
deps_to_fetch.uniq(&:root_name).sort.each do |dependency|
source = ExternalSources.from_dependency(dependency, podfile.defined_in_file)
source.fetch(sandbox)
deps_to_fetch.uniq(&:root_name)
end
end
def pods_to_fetch
@pods_to_fetch ||= begin
pods_to_fetch = result.podfile_state.added + result.podfile_state.changed
if update_mode == :selected
pods_to_fetch += update[:pods]
end
pods_to_fetch
end
end
......
......@@ -63,7 +63,8 @@ module Pod
s.version = '1.0'
end,
]
Lockfile.generate(podfile, specs).write_to_disk(temporary_directory + 'Podfile.lock')
external_sources = {}
Lockfile.generate(podfile, specs, external_sources).write_to_disk(temporary_directory + 'Podfile.lock')
end
it 'for a single missing Pod' do
......
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