Commit 978e77b3 authored by Boris Bügling's avatar Boris Bügling

[Frameworks] Fail lint for Swift on iOS < 8.

Have to use dynamic frameworks for Swift and they are unsupported on iOS
7.
parent 2d457005
...@@ -27,6 +27,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -27,6 +27,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
`/tmp`. `/tmp`.
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
* Let lint fail for Swift pods supporting deployment targets below iOS 8.0.
[Boris Bügling](https://github.com/neonichu)
[#2963](https://github.com/CocoaPods/CocoaPods/issues/2963)
##### Bug Fixes ##### Bug Fixes
* Added support for .tpp C++ header files in specs (previously were getting * Added support for .tpp C++ header files in specs (previously were getting
......
...@@ -310,6 +310,10 @@ module Pod ...@@ -310,6 +310,10 @@ module Pod
installer.install! installer.install!
file_accessors = installer.aggregate_targets.map do |target| file_accessors = installer.aggregate_targets.map do |target|
if target.pod_targets.any?(&:uses_swift?) && deployment_target.to_f < 8.0
error('swift', 'Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.')
end
target.pod_targets.map(&:file_accessors) target.pod_targets.map(&:file_accessors)
end.flatten end.flatten
......
...@@ -440,6 +440,36 @@ module Pod ...@@ -440,6 +440,36 @@ module Pod
validator.validated?.should.be.true validator.validated?.should.be.true
end end
end end
describe 'swift validation' do
def test_swiftpod
podspec = stub_podspec(/.*source_files.*/, '"source_files": "*.swift",')
podspec.gsub!(/.*license.*$/, '"license": "Public Domain",')
file = write_podspec(podspec)
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)
validator.stubs(:validate_url)
validator.validate
validator
end
it 'fails on deployment target < iOS 8 for Swift Pods' do
validator = test_swiftpod
validator.results.map(&:to_s).first.should.match /dynamic frameworks.*iOS > 8/
validator.result_type.should == :error
end
it 'succeeds on deployment targets >= iOS 8 for Swift Pods' do
Specification.any_instance.stubs(:deployment_target).returns('9.0')
validator = test_swiftpod
validator.results.count.should == 0
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