Commit 990cd0a9 authored by Boris Bügling's avatar Boris Bügling Committed by GitHub

Merge pull request #5733 from benasher44/basher_framework_dev_support

Improved messages when missing host targets in the Podfile. Improved framework-only dev support.
parents 8e4d8157 d2095166
......@@ -20,6 +20,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[benasher44](https://github.com/benasher44)
[#5726](https://github.com/CocoaPods/CocoaPods/pull/5726)
* Improved messaging when missing host targets for embedded targets.
Improved support for framework-only projects.
[benasher44](https://github.com/benasher44)
[#5733](https://github.com/CocoaPods/CocoaPods/pull/5733)
##### Bug Fixes
* Hash scope suffixes if they are over 50 characters to prevent file paths from being too long.
......
......@@ -284,7 +284,26 @@ module Pod
end
end
unless embedded_targets_missing_hosts.empty?
raise Informative, "Unable to find host target for #{embedded_targets_missing_hosts.map(&:name).join(', ')}. Please add the host targets for the embedded targets to the Podfile."
embedded_targets_missing_hosts_product_types = embedded_targets_missing_hosts.map(&:user_targets).flatten.map(&:symbol_type).uniq
# If the targets missing hosts are only frameworks, then this is likely
# a project for doing framework development. In that case, just warn that
# the frameworks that these targets depend on won't be integrated anywhere
if embedded_targets_missing_hosts_product_types == [:framework]
UI.warn 'The Podfile contains framework targets, for which the Podfile does not contain host targets (targets which embed the framework).' \
"\n" \
'If this project is for doing framework development, you can ignore this message. Otherwise, add a target to the Podfile that embeds these frameworks to make this message go away (e.g. a test target).'
else
target_names = embedded_targets_missing_hosts.map do |target|
target.name.sub('Pods-', '') # Make the target names more recognizable to the user
end.join ', '
raise Informative, "Unable to find host target(s) for #{target_names}. Please add the host targets for the embedded targets to the Podfile." \
"\n" \
'Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:' \
"\n- Framework" \
"\n- App Extension" \
"\n- Watch OS 1 Extension" \
"\n- Messages Extension (except when used with a Messages Application)"
end
end
end
......
......@@ -747,7 +747,22 @@ module Pod
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
should.raise Informative do
analyzer.analyze
end.message.should.match /Unable to find host target for Pods-Today Extension. Please add the host targets for the embedded targets to the Podfile/
end.message.should.match /Unable to find host target\(s\) for Today Extension. Please add the host targets for the embedded targets to the Podfile\./
end
it 'warns when using a Podfile for framework-only projects' do
podfile = Pod::Podfile.new do
source SpecHelper.test_repo_url
use_frameworks!
platform :ios, '8.0'
target 'Sample Framework' do
project 'SampleProject/Sample Lib/Sample Lib'
pod 'monkey'
end
end
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
analyzer.analyze
UI.warnings.should.match /The Podfile contains framework targets, for which the Podfile does not contain host targets \(targets which embed the framework\)\./
end
it 'raises when the extension calls use_frameworks!, but the host target does not' 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