[Validator] Allow skipping import validation

parent eef5ab33
...@@ -21,6 +21,7 @@ module Pod ...@@ -21,6 +21,7 @@ module Pod
'(defaults to https://github.com/CocoaPods/Specs.git). ' \ '(defaults to https://github.com/CocoaPods/Specs.git). ' \
'Multiple sources must be comma-delimited.'], 'Multiple sources must be comma-delimited.'],
['--private', 'Lint skips checks that apply only to public specs'], ['--private', 'Lint skips checks that apply only to public specs'],
['--skip-import-validation', 'Lint skips validating that the pod can be imported'],
].concat(super) ].concat(super)
end end
...@@ -34,6 +35,7 @@ module Pod ...@@ -34,6 +35,7 @@ module Pod
@use_frameworks = !argv.flag?('use-libraries') @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(',')
@private = argv.flag?('private', false) @private = argv.flag?('private', false)
@skip_import_validation = argv.flag?('skip-import-validation', false)
@podspecs_paths = argv.arguments! @podspecs_paths = argv.arguments!
super super
end end
...@@ -55,6 +57,7 @@ module Pod ...@@ -55,6 +57,7 @@ module Pod
validator.only_subspec = @only_subspec validator.only_subspec = @only_subspec
validator.use_frameworks = @use_frameworks validator.use_frameworks = @use_frameworks
validator.ignore_public_only_results = @private validator.ignore_public_only_results = @private
validator.skip_import_validation = @skip_import_validation
validator.validate validator.validate
unless @clean unless @clean
......
...@@ -29,6 +29,7 @@ module Pod ...@@ -29,6 +29,7 @@ module Pod
'Multiple sources must be comma-delimited.'], 'Multiple sources must be comma-delimited.'],
['--local-only', 'Does not perform the step of pushing REPO to its remote'], ['--local-only', 'Does not perform the step of pushing REPO to its remote'],
['--no-private', 'Lint includes checks that apply only to public repos'], ['--no-private', 'Lint includes checks that apply only to public repos'],
['--skip-import-validation', 'Lint skips validating that the pod can be imported'],
['--commit-message="Fix bug in pod"', 'Add custom commit message. ' \ ['--commit-message="Fix bug in pod"', 'Add custom commit message. ' \
'Opens default editor if no commit message is specified.'], 'Opens default editor if no commit message is specified.'],
['--use-json', 'Push JSON spec to repo'], ['--use-json', 'Push JSON spec to repo'],
...@@ -47,6 +48,7 @@ module Pod ...@@ -47,6 +48,7 @@ module Pod
@message = argv.option('commit-message') @message = argv.option('commit-message')
@commit_message = argv.flag?('commit-message', false) @commit_message = argv.flag?('commit-message', false)
@use_json = argv.flag?('use-json') @use_json = argv.flag?('use-json')
@skip_import_validation = argv.flag?('skip-import-validation', false)
super super
end end
...@@ -123,6 +125,7 @@ module Pod ...@@ -123,6 +125,7 @@ module Pod
validator.allow_warnings = @allow_warnings validator.allow_warnings = @allow_warnings
validator.use_frameworks = @use_frameworks validator.use_frameworks = @use_frameworks
validator.ignore_public_only_results = @private validator.ignore_public_only_results = @private
validator.skip_import_validation = @skip_import_validation
begin begin
validator.validate validator.validate
rescue => e rescue => e
......
...@@ -27,6 +27,7 @@ module Pod ...@@ -27,6 +27,7 @@ module Pod
'(defaults to https://github.com/CocoaPods/Specs.git). ' \ '(defaults to https://github.com/CocoaPods/Specs.git). ' \
'Multiple sources must be comma-delimited.'], 'Multiple sources must be comma-delimited.'],
['--private', 'Lint skips checks that apply only to public specs'], ['--private', 'Lint skips checks that apply only to public specs'],
['--skip-import-validation', 'Lint skips validating that the pod can be imported'],
].concat(super) ].concat(super)
end end
...@@ -40,6 +41,7 @@ module Pod ...@@ -40,6 +41,7 @@ module Pod
@use_frameworks = !argv.flag?('use-libraries') @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(',')
@private = argv.flag?('private', false) @private = argv.flag?('private', false)
@skip_import_validation = argv.flag?('skip-import-validation', false)
@podspecs_paths = argv.arguments! @podspecs_paths = argv.arguments!
super super
end end
...@@ -57,6 +59,7 @@ module Pod ...@@ -57,6 +59,7 @@ module Pod
validator.only_subspec = @only_subspec validator.only_subspec = @only_subspec
validator.use_frameworks = @use_frameworks validator.use_frameworks = @use_frameworks
validator.ignore_public_only_results = @private validator.ignore_public_only_results = @private
validator.skip_import_validation = @skip_import_validation
validator.validate validator.validate
failure_reasons << validator.failure_reason failure_reasons << validator.failure_reason
......
...@@ -194,6 +194,9 @@ module Pod ...@@ -194,6 +194,9 @@ module Pod
# #
attr_accessor :ignore_public_only_results attr_accessor :ignore_public_only_results
attr_accessor :skip_import_validation
alias_method :skip_import_validation?, :skip_import_validation
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
# !@group Lint results # !@group Lint results
...@@ -377,7 +380,6 @@ module Pod ...@@ -377,7 +380,6 @@ module Pod
app_project.new_target(:application, 'App', consumer.platform_name, deployment_target) app_project.new_target(:application, 'App', consumer.platform_name, deployment_target)
app_project.save app_project.save
app_project.recreate_user_schemes app_project.recreate_user_schemes
Xcodeproj::XCScheme.share_scheme(app_project.path, 'App')
end end
def add_app_project_import def add_app_project_import
...@@ -390,6 +392,8 @@ module Pod ...@@ -390,6 +392,8 @@ module Pod
app_target.add_file_references([source_file_ref]) app_target.add_file_references([source_file_ref])
add_xctest(app_target) if @installer.pod_targets.any? { |pt| pt.spec_consumers.any? { |c| c.frameworks.include?('XCTest') } } add_xctest(app_target) if @installer.pod_targets.any? { |pt| pt.spec_consumers.any? { |c| c.frameworks.include?('XCTest') } }
app_project.save app_project.save
Xcodeproj::XCScheme.share_scheme(app_project.path, 'App')
Xcodeproj::XCScheme.share_scheme(@installer.pods_project.path, pod_target.label)
end end
def add_xctest(app_target) def add_xctest(app_target)
...@@ -424,7 +428,7 @@ module Pod ...@@ -424,7 +428,7 @@ module Pod
f << "@import Foundation;\n" f << "@import Foundation;\n"
f << "@import UIKit;\n" if consumer.platform_name == :ios || consumer.platform_name == :tvos f << "@import UIKit;\n" if consumer.platform_name == :ios || consumer.platform_name == :tvos
f << "@import Cocoa;\n" if consumer.platform_name == :osx f << "@import Cocoa;\n" if consumer.platform_name == :osx
f << "#{import_statement}int main() {}\n" f << import_statement
end end
end end
source_file source_file
...@@ -718,7 +722,12 @@ module Pod ...@@ -718,7 +722,12 @@ module Pod
# #
def xcodebuild def xcodebuild
require 'fourflusher' require 'fourflusher'
command = %w(clean build -workspace App.xcworkspace -scheme App -configuration Release) scheme = if skip_import_validation?
@installer.pod_targets.find { |pt| pt.pod_name == spec.root.name }.label
else
'App'
end
command = %W(clean build -workspace App.xcworkspace -scheme #{scheme} -configuration Release)
case consumer.platform_name case consumer.platform_name
when :ios when :ios
command += %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator) command += %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator)
......
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