Do not crash when attempting to install pod with no supported targets

parent 8b02913f
......@@ -14,6 +14,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
* Do not crash when attempting to install pod with no supported targets.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6465](https://github.com/CocoaPods/CocoaPods/issues/6465)
* Correctly handle `OTHER_LDFLAGS` for targets with inherit search paths and source pods.
[Justin Martin](https://github.com/justinseanmartin)
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
......
......@@ -338,6 +338,8 @@ module Pod
end
end
raise Informative, "Could not install '#{pod_name}' pod. There is no target that supports it." if specs_by_platform.empty?
@pod_installers ||= []
pod_installer = PodSourceInstaller.new(sandbox, specs_by_platform, :can_cache => installation_options.clean?)
@pod_installers << pod_installer
......
......@@ -4,6 +4,8 @@ module Pod
class Installer
class Analyzer
class TargetInspector
PLATFORM_INFO_URL = 'https://guides.cocoapods.org/syntax/podfile.html#platform'.freeze
# @return [TargetDefinition] the target definition to inspect
#
attr_accessor :target_definition
......@@ -159,6 +161,10 @@ module Pod
"Unable to determine the platform for the `#{target_definition.name}` target."
end
UI.warn "Automatically assigning platform #{name} with version #{deployment_target} " \
"on target #{target_definition.name} because no platform was specified. " \
"Please specify a platform for this target in your Podfile. See `#{PLATFORM_INFO_URL}`."
target_definition.set_platform(name, deployment_target)
Platform.new(name, deployment_target)
end
......
Subproject commit e62f3157268e9d2fe634dfab2560c89013d89240
Subproject commit 29e64c27eff470779877e8ffc24fdaf707f261a8
......@@ -232,6 +232,9 @@ module Pod
target_inspector = TargetInspector.new(target_definition, config.installation_root)
platforms = target_inspector.send(:compute_platform, user_targets)
platforms.should == Platform.new(:ios, '4.0')
UI.warnings.should.include 'Automatically assigning platform ios with version 4.0 on target default because no ' \
'platform was specified. Please specify a platform for this target in your Podfile. ' \
'See `https://guides.cocoapods.org/syntax/podfile.html#platform`.'
end
it 'uses the lowest deployment target of the user targets if inferring the platform' do
......
......@@ -540,6 +540,16 @@ module Pod
UI.output.should.include 'was 1.0'
end
it 'raises when it attempts to install pod source with no target supporting it' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new([spec], [fixture_target_definition], config.sandbox)
pod_target.stubs(:platform).returns(:ios)
@installer.stubs(:pod_targets).returns([pod_target])
should.raise Informative do
@installer.send(:create_pod_installer, 'RandomPod')
end.message.should.include 'Could not install \'RandomPod\' pod. There is no target that supports it.'
end
#--------------------------------------#
describe '#clean' 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