Commit 03d27ea0 authored by Fabio Pelosin's avatar Fabio Pelosin

[Resolver] Check target plafroms instead of podfile.

parent 03138241
...@@ -20,10 +20,10 @@ module Pod ...@@ -20,10 +20,10 @@ module Pod
targets_and_specs = {} targets_and_specs = {}
@podfile.target_definitions.values.each do |target_definition| @podfile.target_definitions.values.each do |target_definition|
puts "\nResolving dependencies for target `#{target_definition.name}'".green if config.verbose? puts "\nResolving dependencies for target `#{target_definition.name}' (#{target_definition.platform})".green if config.verbose?
@loaded_specs = [] @loaded_specs = []
# TODO @podfile.platform will change to target_definition.platform # TODO @podfile.platform will change to target_definition.platform
find_dependency_sets(@podfile, target_definition.dependencies, target_definition.platform) find_dependency_sets(@podfile, target_definition.dependencies, target_definition)
targets_and_specs[target_definition] = @specs.values_at(*@loaded_specs).sort_by(&:name) targets_and_specs[target_definition] = @specs.values_at(*@loaded_specs).sort_by(&:name)
end end
...@@ -56,11 +56,11 @@ module Pod ...@@ -56,11 +56,11 @@ module Pod
end end
end end
def find_dependency_sets(dependent_specification, dependencies, platform) def find_dependency_sets(dependent_specification, dependencies, target_definition)
@log_indent += 1 @log_indent += 1
dependencies.each do |dependency| dependencies.each do |dependency|
puts ' ' * @log_indent + "- #{dependency}" if config.verbose? puts ' ' * @log_indent + "- #{dependency}" if config.verbose?
set = find_cached_set(dependency, platform) set = find_cached_set(dependency, target_definition.platform)
set.required_by(dependent_specification) set.required_by(dependent_specification)
# 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)
...@@ -72,23 +72,22 @@ module Pod ...@@ -72,23 +72,22 @@ module Pod
spec = spec.subspec_by_name(dependency.name) spec = spec.subspec_by_name(dependency.name)
end end
validate_platform!(spec) validate_platform!(spec, target_definition)
@loaded_specs << spec.name @loaded_specs << spec.name
@specs[spec.name] = spec @specs[spec.name] = spec
# And recursively load the dependencies of the spec. # And recursively load the dependencies of the spec.
# TODO fix the need to return an empty arrayf if there are no deps for the given platform # TODO fix the need to return an empty arrayf if there are no deps for the given platform
find_dependency_sets(spec, (spec.dependencies[platform.to_sym] || []), platform) find_dependency_sets(spec, (spec.dependencies[target_definition.platform.to_sym] || []), target_definition)
end end
end end
@log_indent -= 1 @log_indent -= 1
end end
def validate_platform!(spec) def validate_platform!(spec, target)
plaform = @podfile.target_definitions[:default].platform unless target.platform.support?(spec.platform)
unless plaform.support?(spec.platform) raise Informative, "[!] The platform required by the target `#{target.name}' `#{target.platform}' does not match that of #{spec} `#{spec.platform}'".red
raise Informative, "The platform required by the Podfile `#{plaform}' does not match that of #{spec} `#{spec.platform}'"
end end
end end
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