Commit bd3455c0 authored by Boris Bügling's avatar Boris Bügling

Require explicit use of `use_frameworks!`

parent e21e24c1
......@@ -92,6 +92,7 @@ module Pod
determine_dependency_product_types
verify_no_duplicate_framework_names
verify_no_static_framework_transitive_dependencies
verify_framework_usage
generate_pods_project
integrate_user_project if config.integrate_targets?
perform_post_install_actions
......@@ -369,6 +370,22 @@ module Pod
end
end
def verify_framework_usage
aggregate_targets.each do |aggregate_target|
next if aggregate_target.requires_frameworks?
aggregate_target.user_build_configurations.keys.each do |config|
pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
if pod_targets.any?(&:uses_swift?)
raise Informative, 'Pods written in Swift can only be integrated as frameworks; this ' \
'feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt ' \
'in to using it.'
end
end
end
end
# Performs any post-installation actions
#
# @return [void]
......
......@@ -91,13 +91,8 @@ module Pod
# @return [Boolean] whether the generated target needs to be implemented
# as a framework
#
# @note This applies either if Swift was used by the host, which was checked
# eagerly by the analyzer before, or in the given target or its
# dependents, which can only be checked after the specs were been
# fetched.
#
def requires_frameworks?
host_requires_frameworks? || uses_swift?
host_requires_frameworks? || false
end
#-------------------------------------------------------------------------#
......
......@@ -123,6 +123,10 @@ module Pod
fixture_spec('orange-framework/OrangeFramework.podspec')
end
before do
Target.any_instance.stubs(:requires_frameworks?).returns(true)
end
behaves_like 'AggregateXCConfig'
it 'sets the PODS_FRAMEWORK_BUILD_PATH build variable' do
......
......@@ -51,6 +51,7 @@ module Pod
@installer.stubs(:determine_dependency_product_types)
@installer.stubs(:verify_no_duplicate_framework_names)
@installer.stubs(:verify_no_static_framework_transitive_dependencies)
@installer.stubs(:verify_framework_usage)
@installer.stubs(:generate_pods_project)
@installer.stubs(:integrate_user_project)
@installer.stubs(:run_plugins_post_install_hooks)
......@@ -125,6 +126,7 @@ module Pod
podfile = Pod::Podfile.new do
platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject'
use_frameworks!
pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s
......@@ -177,6 +179,7 @@ module Pod
podfile = Pod::Podfile.new do
platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject'
use_frameworks!
pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s
......
......@@ -202,6 +202,7 @@ module Pod
before do
@pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec', :ios, Podfile::TargetDefinition.new('iOS Example', nil))
@target = AggregateTarget.new(@pod_target.target_definition, config.sandbox)
@target.stubs(:requires_frameworks?).returns(true)
@target.pod_targets = [@pod_target]
end
......
......@@ -178,6 +178,7 @@ module Pod
describe 'With frameworks' do
before do
@pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec')
@pod_target.host_requires_frameworks = true
end
it 'returns that it uses swift' do
......
......@@ -448,6 +448,7 @@ module Pod
podspec.gsub!(/.*license.*$/, '"license": "Public Domain",')
file = write_podspec(podspec)
Podfile::TargetDefinition.any_instance.stubs(:uses_frameworks?).returns(true)
Pod::Sandbox::FileAccessor.any_instance.stubs(:source_files).returns([Pathname.new('/Foo.swift')])
validator = Validator.new(file, SourcesManager.master.map(&:url))
validator.stubs(:build_pod)
......
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