From e975ff0ed0b7ca46f5d872567c29fd2bcf2ff989 Mon Sep 17 00:00:00 2001 From: Alexander Rutsman Date: Tue, 12 Oct 2021 15:49:26 +0300 Subject: [PATCH 1/5] Added setting xcode version --- xcode/commonFastfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xcode/commonFastfile b/xcode/commonFastfile index a3147d3..494465b 100644 --- a/xcode/commonFastfile +++ b/xcode/commonFastfile @@ -148,11 +148,16 @@ private_lane :buildArchive do |options| lane_name = options[:lane_name] configuration = options[:configuration] xcodeproj_path = options[:xcodeproj_path] + xcode_version = options[:xcodeVersion] 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? + ensure_xcode_version(version: xcode_version) + end + gym( clean: true, workspace: options[:workspace], From ecc34d227ad4b999e38caa87a68f30c2af425095 Mon Sep 17 00:00:00 2001 From: Alexander Rutsman Date: Tue, 12 Oct 2021 18:42:00 +0300 Subject: [PATCH 2/5] Added default xcode version --- xcode/commonFastfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xcode/commonFastfile b/xcode/commonFastfile index 494465b..4e36946 100644 --- a/xcode/commonFastfile +++ b/xcode/commonFastfile @@ -148,15 +148,16 @@ private_lane :buildArchive do |options| lane_name = options[:lane_name] configuration = options[:configuration] xcodeproj_path = options[:xcodeproj_path] - xcode_version = options[:xcodeVersion] + default_xcode_version = sh("xcodebuild -version") # Xcode Build version + .split(" ")[1] + + xcode_version = options[:xcodeVersion] || default_xcode_version 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? - ensure_xcode_version(version: xcode_version) - end + xcversion(version: xcode_version) gym( clean: true, From b319b97522fed94a2efe8c24b2309baa7207d422 Mon Sep 17 00:00:00 2001 From: Alexander Rutsman Date: Tue, 12 Oct 2021 19:09:36 +0300 Subject: [PATCH 3/5] Added default xcode version --- xcode/commonFastfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xcode/commonFastfile b/xcode/commonFastfile index 4e36946..c37d1ca 100644 --- a/xcode/commonFastfile +++ b/xcode/commonFastfile @@ -148,16 +148,19 @@ private_lane :buildArchive do |options| lane_name = options[:lane_name] configuration = options[:configuration] xcodeproj_path = options[:xcodeproj_path] + xcode_version = options[:xcodeVersion] default_xcode_version = sh("xcodebuild -version") # Xcode Build version .split(" ")[1] - xcode_version = options[:xcodeVersion] || default_xcode_version - if configuration != "AppStore" # AppStore uses xcconfig choosen in Xcode set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path) end - xcversion(version: xcode_version) + if xcode_version.nil? + xcversion(version: default_xcode_version) + else + xcversion(version: xcode_version) + end gym( clean: true, From 7061bad2ec94a725da5cf302b27928eaa89e29a9 Mon Sep 17 00:00:00 2001 From: Alexander Rutsman Date: Wed, 20 Oct 2021 16:01:13 +0300 Subject: [PATCH 4/5] Added search for the newest version --- xcode/commonFastfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xcode/commonFastfile b/xcode/commonFastfile index c37d1ca..1930d50 100644 --- a/xcode/commonFastfile +++ b/xcode/commonFastfile @@ -149,8 +149,11 @@ private_lane :buildArchive do |options| configuration = options[:configuration] xcodeproj_path = options[:xcodeproj_path] xcode_version = options[:xcodeVersion] - default_xcode_version = sh("xcodebuild -version") # Xcode Build version - .split(" ")[1] + + 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 if configuration != "AppStore" # AppStore uses xcconfig choosen in Xcode set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path) @@ -469,4 +472,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 \ No newline at end of file From e1e15d619e126483391ec1965075bb7447ebeb71 Mon Sep 17 00:00:00 2001 From: Alexander Rutsman Date: Wed, 27 Oct 2021 11:20:34 +0300 Subject: [PATCH 5/5] Added search for the newest version on ruby --- xcode/commonFastfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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