Commit c64bd68b authored by Kyle Fuller's avatar Kyle Fuller

Merge pull request #3168 from CocoaPods/lint-as-framework

Lint as framework automatically
parents 16e5b431 2f76d351
...@@ -60,6 +60,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -60,6 +60,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Boris Bügling](https://github.com/neonichu) [Boris Bügling](https://github.com/neonichu)
[#3029](https://github.com/CocoaPods/CocoaPods/issues/3029) [#3029](https://github.com/CocoaPods/CocoaPods/issues/3029)
* Lint as framework automatically. If needed, `--use-libraries` option
allows linting as a static library.
[Boris Bügling](https://github.com/neonichu)
[#2912](https://github.com/CocoaPods/CocoaPods/issues/2912)
##### 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
......
...@@ -113,7 +113,7 @@ module Pod ...@@ -113,7 +113,7 @@ module Pod
['--subspec=NAME', 'Lint validates only the given subspec'], ['--subspec=NAME', 'Lint validates only the given subspec'],
['--no-subspecs', 'Lint skips validation of subspecs'], ['--no-subspecs', 'Lint skips validation of subspecs'],
['--no-clean', 'Lint leaves the build directory intact for inspection'], ['--no-clean', 'Lint leaves the build directory intact for inspection'],
['--use-frameworks', 'Lint uses frameworks to install the spec'], ['--use-libraries', 'Lint uses static libraries to install the spec'],
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependant pods ' \ ['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependant pods ' \
'(defaults to https://github.com/CocoaPods/Specs.git). '\ '(defaults to https://github.com/CocoaPods/Specs.git). '\
'Multiple sources must be comma-delimited.']].concat(super) 'Multiple sources must be comma-delimited.']].concat(super)
...@@ -125,7 +125,7 @@ module Pod ...@@ -125,7 +125,7 @@ module Pod
@clean = argv.flag?('clean', true) @clean = argv.flag?('clean', true)
@subspecs = argv.flag?('subspecs', true) @subspecs = argv.flag?('subspecs', true)
@only_subspec = argv.option('subspec') @only_subspec = argv.option('subspec')
@use_frameworks = argv.flag?('use-frameworks') @use_frameworks = !argv.flag?('use-libraries')
@source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',') @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
@podspecs_paths = argv.arguments! @podspecs_paths = argv.arguments!
super super
......
...@@ -20,7 +20,7 @@ module Pod ...@@ -20,7 +20,7 @@ module Pod
['--subspec=NAME', 'Lint validates only the given subspec'], ['--subspec=NAME', 'Lint validates only the given subspec'],
['--no-subspecs', 'Lint skips validation of subspecs'], ['--no-subspecs', 'Lint skips validation of subspecs'],
['--no-clean', 'Lint leaves the build directory intact for inspection'], ['--no-clean', 'Lint leaves the build directory intact for inspection'],
['--use-frameworks', 'Lint uses frameworks to install the spec'], ['--use-libraries', 'Lint uses static libraries to install the spec'],
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependant pods ' \ ['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependant pods ' \
'(defaults to https://github.com/CocoaPods/Specs.git). '\ '(defaults to https://github.com/CocoaPods/Specs.git). '\
'Multiple sources must be comma-delimited.']].concat(super) 'Multiple sources must be comma-delimited.']].concat(super)
...@@ -32,7 +32,7 @@ module Pod ...@@ -32,7 +32,7 @@ module Pod
@clean = argv.flag?('clean', true) @clean = argv.flag?('clean', true)
@subspecs = argv.flag?('subspecs', true) @subspecs = argv.flag?('subspecs', true)
@only_subspec = argv.option('subspec') @only_subspec = argv.option('subspec')
@use_frameworks = argv.flag?('use-frameworks') @use_frameworks = !argv.flag?('use-libraries')
@source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',') @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
@podspecs_paths = argv.arguments! @podspecs_paths = argv.arguments!
super super
......
...@@ -478,14 +478,14 @@ module Pod ...@@ -478,14 +478,14 @@ module Pod
# @note The generated podfile takes into account whether the linter is # @note The generated podfile takes into account whether the linter is
# in local mode. # in local mode.
# #
def podfile_from_spec(platform_name, deployment_target, use_frameworks = nil) def podfile_from_spec(platform_name, deployment_target, use_frameworks = true)
name = subspec_name ? subspec_name : spec.name name = subspec_name ? subspec_name : spec.name
podspec = file.realpath podspec = file.realpath
local = local? local = local?
urls = source_urls urls = source_urls
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
urls.each { |u| source(u) } urls.each { |u| source(u) }
use_frameworks!(use_frameworks) unless use_frameworks.nil? use_frameworks!(use_frameworks)
platform(platform_name, deployment_target) platform(platform_name, deployment_target)
if local if local
pod name, :path => podspec.dirname.to_s pod name, :path => podspec.dirname.to_s
......
...@@ -442,6 +442,40 @@ module Pod ...@@ -442,6 +442,40 @@ module Pod
end end
end end
describe 'frameworks' do
before do
@validator = Validator.new(podspec_path, SourcesManager.master.map(&:url))
end
def setup_validator
@validator.stubs(:validate_url)
@validator.stubs(:validate_screenshots)
@validator.stubs(:check_file_patterns)
Installer.any_instance.stubs(:install!)
Installer.any_instance.stubs(:aggregate_targets).returns([])
end
it 'lints as a framework if specified' do
@validator.use_frameworks = true
setup_validator
@validator.expects(:podfile_from_spec).with(:osx, nil, true).once
@validator.expects(:podfile_from_spec).with(:ios, nil, true).once
@validator.send(:perform_extensive_analysis, @validator.spec)
end
it 'lint as a static library if specified' do
@validator.use_frameworks = false
setup_validator
@validator.expects(:podfile_from_spec).with(:osx, nil, false).once
@validator.expects(:podfile_from_spec).with(:ios, nil, false).once
@validator.send(:perform_extensive_analysis, @validator.spec)
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