diff --git a/xcode/commonFastfile b/xcode/commonFastfile index 1930d50..607dfc3 100644 --- a/xcode/commonFastfile +++ b/xcode/commonFastfile @@ -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 @@ -150,17 +153,19 @@ private_lane :buildArchive do |options| xcodeproj_path = options[:xcodeproj_path] xcode_version = options[:xcodeVersion] - default_xcode_version = sh("system_profiler -json SPDeveloperToolsDataType | jq -r '.SPDeveloperToolsDataType # getting json with version data - |=sort_by(.spdevtools_version) # sort by increasing the version of xcode - |.SPDeveloperToolsDataType[-1].spdevtools_version'") # take the largest version in format: "13.0 (13A5212g)" - .split(" ")[0] # take version number + 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) + xcversion(version: default_xcode_version_number) else xcversion(version: xcode_version) end