Merge pull request #282 from TouchInstinct/feature/fastlane_xcode_version

Added setting xcode version
This commit is contained in:
svshkv 2021-10-27 12:47:52 +03:00 committed by GitHub
commit b9b7dfe3f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -141,6 +141,9 @@ private_lane :buildConfiguration do |options|
end
private_lane :buildArchive do |options|
require 'json'
icloudEnvironment = options[:iCloudContainerEnvironment] || ""
exportOptions = icloudEnvironment.to_s.empty? ? {} : {iCloudContainerEnvironment: icloudEnvironment}
exportOptions[:compileBitcode] = options[:compileBitcode] || false
@ -148,11 +151,25 @@ private_lane :buildArchive do |options|
lane_name = options[:lane_name]
configuration = options[:configuration]
xcodeproj_path = options[:xcodeproj_path]
xcode_version = options[:xcodeVersion]
cmd = 'system_profiler -json SPDeveloperToolsDataType'
cmd_result = `#{cmd}`
spdeveloperToolsDataType = JSON.parse(cmd_result)['SPDeveloperToolsDataType']
sortedSPDeveloperToolsDataType = spdeveloperToolsDataType.sort_by { |hash| hash['spdevtools_version'].split(' ').first.to_i } # sort by increasing the version of xcode
default_xcode_version = sortedSPDeveloperToolsDataType.last['spdevtools_version'] # take the largest version in format: "13.0 (13A5212g)"
default_xcode_version_number = default_xcode_version.split(' ').first # take version number
if configuration != "AppStore" # AppStore uses xcconfig choosen in Xcode
set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path)
end
if xcode_version.nil?
xcversion(version: default_xcode_version_number)
else
xcversion(version: xcode_version)
end
gym(
clean: true,
workspace: options[:workspace],
@ -460,4 +477,4 @@ def run_code_generation_phase_if_needed(options)
if File.exists? code_generation_script_path
sh(code_generation_script_path, options[:workspace])
end
end
end