Skip to content

Commit 494f3c4

Browse files
committed
use Pod::Validator#add_swift_version
1 parent 90e662e commit 494f3c4

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.3

CocoaPodsTests/test_running_validator.rb

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,26 @@ def initialize(spec_or_path, source_urls)
1717
end
1818

1919
def create_app_project
20-
super.tap do
21-
project = Xcodeproj::Project.open(validation_dir + "#{APP_TARGET}.xcodeproj")
22-
create_test_target(project)
23-
set_swift_version(project, '2.3')
24-
project.save
25-
end
20+
super
21+
project = Xcodeproj::Project.open(validation_dir + "#{APP_TARGET}.xcodeproj")
22+
create_test_target(project)
23+
project.save
24+
end
25+
26+
def add_app_project_import
27+
super
28+
project = Xcodeproj::Project.open(validation_dir + 'App.xcodeproj')
29+
group = project.new_group(TEST_TARGET)
30+
test_target = project.targets.last
31+
test_target.add_file_references(test_files.map { |file| group.new_file(file) })
32+
add_swift_version(test_target)
33+
project.save
2634
end
2735

2836
def install_pod
29-
super.tap do
30-
if local?
31-
FileUtils.ln_s file.dirname, validation_dir + "Pods/#{spec.name}"
32-
end
37+
super
38+
if local?
39+
FileUtils.ln_s file.dirname, validation_dir + "Pods/#{spec.name}"
3340
end
3441
end
3542

@@ -47,21 +54,9 @@ def build_pod
4754
end
4855

4956
private
50-
def set_swift_version(project, version)
51-
project.targets.each do |target|
52-
target.build_configuration_list.build_configurations.each do |configuration|
53-
configuration.build_settings['SWIFT_VERSION'] = version
54-
end
55-
end
56-
end
57-
5857
def create_test_target(project)
5958
test_target = project.new_target(:unit_test_bundle, TEST_TARGET, consumer.platform_name, deployment_target)
60-
group = project.new_group(TEST_TARGET)
61-
test_target.add_file_references(test_files.map { |file| group.new_file(file) })
62-
project.save
6359
create_test_scheme(project, test_target)
64-
test_target
6560
end
6661

6762
def create_test_scheme(project, test_target)

0 commit comments

Comments
 (0)