Commit 0bea380a authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #5012 from CocoaPods/seg-target-inspector-no-platform

[TargetInspector] Raise a friendly error when unable to determine
parents c6a4867f b65cef37
...@@ -26,6 +26,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -26,6 +26,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
instead must be done via `pod setup`. instead must be done via `pod setup`.
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
* Print a friendly error message when the platform for a target cannot be
inferred.
[Samuel Giddins](https://github.com/segiddins)
[#4790](https://github.com/CocoaPods/CocoaPods/issues/4790)
## 1.0.0.beta.5 (2016-03-08) ## 1.0.0.beta.5 (2016-03-08)
......
...@@ -153,6 +153,11 @@ module Pod ...@@ -153,6 +153,11 @@ module Pod
end end
end end
unless name
raise Informative,
"Unable to determine the platform for the `#{target_definition.name}` target."
end
target_definition.set_platform(name, deployment_target) target_definition.set_platform(name, deployment_target)
Platform.new(name, deployment_target) Platform.new(name, deployment_target)
end end
......
...@@ -270,6 +270,19 @@ module Pod ...@@ -270,6 +270,19 @@ module Pod
e = lambda { target_inspector.send(:compute_platform, user_targets) }.should.raise Informative e = lambda { target_inspector.send(:compute_platform, user_targets) }.should.raise Informative
e.message.should.match /Targets with different platforms/ e.message.should.match /Targets with different platforms/
end end
it 'raises if the platform cannot be inferred' do
user_project = Xcodeproj::Project.new('path')
target = user_project.new_target(:application, 'Target', :ios)
target.build_configuration_list.set_setting('SDKROOT', nil)
target_definition = Podfile::TargetDefinition.new(:default, nil)
user_targets = [target]
target_inspector = TargetInspector.new(target_definition, config.installation_root)
should.raise(Informative) { target_inspector.send(:compute_platform, user_targets) }.
message.should.include('Unable to determine the platform for the `default` target.')
end
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