Commit 7b323678 authored by Boris Bügling's avatar Boris Bügling

Merge pull request #3207 from CocoaPods/prevent-dynamic-libs-on-ios-seven

[Validator] Lint dynamic libs for iOS > 7
parents 563225d1 11ec1224
...@@ -25,6 +25,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -25,6 +25,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Boris Bügling](https://github.com/neonichu) [Boris Bügling](https://github.com/neonichu)
[#3194](https://github.com/CocoaPods/CocoaPods/issues/3194) [#3194](https://github.com/CocoaPods/CocoaPods/issues/3194)
* Lint to prevent dynamic libraries and frameworks from passing with iOS 7.
[Boris Bügling](https://github.com/neonichu)
[#3193](https://github.com/CocoaPods/CocoaPods/issues/3193)
## 0.36.0.rc.1 ## 0.36.0.rc.1
......
...@@ -213,6 +213,7 @@ module Pod ...@@ -213,6 +213,7 @@ module Pod
@consumer = spec.consumer(platform) @consumer = spec.consumer(platform)
setup_validation_environment setup_validation_environment
install_pod install_pod
validate_vendored_dynamic_frameworks
build_pod build_pod
check_file_patterns check_file_patterns
tear_down_validation_environment tear_down_validation_environment
...@@ -322,6 +323,19 @@ module Pod ...@@ -322,6 +323,19 @@ module Pod
config.silent config.silent
end end
def validate_vendored_dynamic_frameworks
deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)
unless file_accessor.nil?
dynamic_frameworks = file_accessor.vendored_frameworks.select { |fw| `file #{fw + fw.basename('.framework')} 2>&1` =~ /dynamically linked/ }
dynamic_libraries = file_accessor.vendored_libraries.select { |lib| `file #{lib} 2>&1` =~ /dynamically linked/ }
if (dynamic_frameworks.count > 0 || dynamic_libraries.count > 0) && consumer.platform_name == :ios &&
(deployment_target.nil? || Version.new(deployment_target).major < 8)
error('dynamic', 'Dynamic frameworks and libraries are only supported on iOS 8.0 and onwards.')
end
end
end
# Performs platform specific analysis. It requires to download the source # Performs platform specific analysis. It requires to download the source
# at each iteration # at each iteration
# #
......
...@@ -485,6 +485,22 @@ module Pod ...@@ -485,6 +485,22 @@ module Pod
end end
end end
describe 'dynamic binaries validation' do
it 'fails with dynamic binaries on iOS < 8' do
podspec = stub_podspec(/.*license.*$/, '"license": "Public Domain",')
file = write_podspec(podspec)
Pod::Sandbox::FileAccessor.any_instance.stubs(:vendored_libraries).returns([fixture('empty.dylib')])
validator = Validator.new(file, SourcesManager.master.map(&:url))
validator.stubs(:build_pod)
validator.stubs(:validate_url)
validator.validate
validator.results.map(&:to_s).first.should.match /Dynamic frameworks.*iOS 8.0 and onwards/
validator.result_type.should == :error
end
end
describe 'swift validation' do describe 'swift validation' do
def test_swiftpod def test_swiftpod
podspec = stub_podspec(/.*source_files.*/, '"source_files": "*.swift",') podspec = stub_podspec(/.*source_files.*/, '"source_files": "*.swift",')
......
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