[Validator] Support linting pods that link against XCTest

parent ed9722e0
......@@ -314,7 +314,6 @@ module Pod
search_paths << search_path
end
end
search_paths
end
end
......
......@@ -388,10 +388,19 @@ module Pod
source_file = write_app_import_source_file(pod_target)
source_file_ref = app_project.new_group('App', 'App').new_file(source_file)
app_project.targets.first.add_file_references([source_file_ref])
app_target = app_project.targets.first
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') } }
app_project.save
end
def add_xctest(app_target)
app_target.build_configurations.each do |configuration|
search_paths = configuration.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= '$(inherited)'
search_paths << ' "$(PLATFORM_DIR)/Developer/Library/Frameworks"'
end
end
def write_app_import_source_file(pod_target)
language = pod_target.uses_swift? ? :swift : :objc
......
......@@ -568,7 +568,8 @@ module Pod
it 'adds the importing file to the app target' do
@validator.stubs(:use_frameworks).returns(true)
@validator.send(:create_app_project)
pod_target = stub(:uses_swift? => true, :should_build? => true, :pod_name => 'JSONKit', :product_module_name => 'ModuleName')
pod_target = fixture_pod_target('banana-lib/BananaLib.podspec')
pod_target.stubs(:uses_swift? => true, :pod_name => 'JSONKit')
installer = stub(:pod_targets => [pod_target])
@validator.instance_variable_set(:@installer, installer)
@validator.send(:add_app_project_import)
......@@ -580,6 +581,21 @@ module Pod
target = project.native_targets.find { |t| t.name == 'App' }
target.source_build_phase.files_references.should.include(file)
end
it 'adds developer framework paths when the pod depends on XCTest' do
@validator.send(:create_app_project)
pod_target = fixture_pod_target('banana-lib/BananaLib.podspec')
pod_target.stubs(:uses_swift? => true, :pod_name => 'JSONKit')
pod_target.spec_consumers.first.stubs(:frameworks).returns(%w(XCTest))
installer = stub(:pod_targets => [pod_target])
@validator.instance_variable_set(:@installer, installer)
@validator.send(:add_app_project_import)
project = Xcodeproj::Project.open(@validator.validation_dir + 'App.xcodeproj')
project.native_targets.first.build_configurations.map do |bc|
bc.build_settings['FRAMEWORK_SEARCH_PATHS']
end.uniq.should == [%w($(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks")]
end
end
describe 'file pattern validation' do
......
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