Commit 20c47761 authored by Kyle Fuller's avatar Kyle Fuller

Merge pull request #3167 from CocoaPods/swift-lint

[Frameworks] Fail lint for Swift on iOS < 8.
parents 2d457005 38c5c631
...@@ -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,11 @@ module Pod ...@@ -310,6 +310,11 @@ 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?) && consumer.platform_name == :ios &&
(deployment_target.nil? || Version.new(deployment_target).major < 8)
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
...@@ -504,7 +509,7 @@ module Pod ...@@ -504,7 +509,7 @@ module Pod
def parse_xcodebuild_output(output) def parse_xcodebuild_output(output)
lines = output.split("\n") lines = output.split("\n")
selected_lines = lines.select do |l| selected_lines = lines.select do |l|
l.include?('error: ') && l.include?('error: ') && (l !~ /frameworks only run on iOS 8/) &&
(l !~ /errors? generated\./) && (l !~ /error: \(null\)/) || (l !~ /errors? generated\./) && (l !~ /error: \(null\)/) ||
l.include?('warning: ') && (l !~ /warnings? generated\./) || l.include?('warning: ') && (l !~ /warnings? generated\./) ||
l.include?('note: ') && (l !~ /expanded from macro/) l.include?('note: ') && (l !~ /expanded from macro/)
......
...@@ -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