Commit d341177f authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Analyzer] Only warn when there is a minimum deployment target mismatch

parent 6a456add
......@@ -17,6 +17,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
`pod repo list`.
[Kyle Fuller](https://github.com/kylef)
* Only show a warning when there is a minimum deployment target mismatch
between target and spec, instead of throwing a hard error.
[Samuel Giddins](https://github.com/segiddins)
[#1241](https://github.com/CocoaPods/CocoaPods/issues/1241)
##### Bug Fixes
* Do not pass code-sign arguments to xcodebuild when linting OS X targets.
......
......@@ -55,7 +55,7 @@ module Pod
store_existing_checkout_options
fetch_external_sources if allow_fetches
@result.specs_by_target = resolve_dependencies
@result.specs_by_target = validate_platforms(resolve_dependencies)
@result.specifications = generate_specifications
@result.targets = generate_targets
@result.sandbox_state = generate_sandbox_state
......@@ -431,6 +431,26 @@ module Pod
specs_by_target
end
# Warns for any specification that is incompatible with its target.
#
# @param [Hash{TargetDefinition => Array<Spec>}] specs_by_target
# the specifications grouped by target.
#
# @return [Hash{TargetDefinition => Array<Spec>}] the specifications
# grouped by target.
#
def validate_platforms(specs_by_target)
specs_by_target.each do |target, specs|
specs.each do |spec|
unless spec.available_platforms.any? { |p| target.platform.supports?(p) }
UI.warn "The platform of the target `#{target.name}` " \
"(#{target.platform}) may not be compatible with `#{spec}` which has " \
"a minimum requirement of #{spec.available_platforms.join(' - ')}."
end
end
end
end
# Returns the list of all the resolved the resolved specifications.
#
# @return [Array<Specification>] the list of the specifications.
......
......@@ -355,16 +355,13 @@ module Pod
#
# @raise If the specification is not supported by the target.
#
# @todo This step is not specific to the resolution process and should be
# performed later in the analysis.
#
# @return [void]
#
def validate_platform(spec, target)
unless spec.available_platforms.any? { |p| target.platform.supports?(p) }
unless spec.available_platforms.any? { |p| target.platform.to_sym == p.to_sym }
raise Informative, "The platform of the target `#{target.name}` " \
"(#{target.platform}) is not compatible with `#{spec}` which has " \
"a minimum requirement of #{spec.available_platforms.join(' - ')}."
"(#{target.platform}) is not compatible with `#{spec}`, which does " \
"not support `#{target.platform.name}`."
end
end
......
......@@ -271,6 +271,12 @@ module Pod
]
end
it 'warns once any of the dependencies does not match the platform of its podfile target' do
Specification.any_instance.stubs(:available_platforms).returns([Platform.new(:ios, '999')])
@analyzer.analyze
UI.warnings.should.match(/platform .* may not be compatible/)
end
xit 'removes the specifications of the changed pods to prevent confusion in the resolution process' do
@analyzer.allow_pre_downloads = true
podspec = @analyzer.sandbox.root + 'Local Podspecs/JSONKit.podspec'
......
......@@ -169,12 +169,6 @@ module Pod
].sort_by(&:name)
end
it 'raises once any of the dependencies does not match the platform of its podfile target' do
Specification.any_instance.stubs(:available_platforms).returns([Platform.new(:ios, '999')])
e = lambda { @resolver.resolve }.should.raise Informative
e.message.should.match(/platform .* not compatible/)
end
it 'raises when a resolved dependency has a platform incompatibility' do
@podfile = Podfile.new do
platform :osx, '10.7'
......
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