mirror of
https://github.com/actions/runner-images.git
synced 2025-12-18 15:57:17 +00:00
Implement logic to check if xcode is beta
This commit is contained in:
@@ -45,6 +45,14 @@ function Switch-Xcode {
|
|||||||
Invoke-Expression "sudo xcode-select --switch ${XcodeRootPath}"
|
Invoke-Expression "sudo xcode-select --switch ${XcodeRootPath}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Test-XcodeStableRelease {
|
||||||
|
param([string] $XcodeRootPath)
|
||||||
|
|
||||||
|
$licenseInfoPlistPath = Join-Path $XcodeRootPath "Contents" "Resources" "LicenseInfo.plist"
|
||||||
|
$releaseType = & defaults read $licenseInfoPlistPath "licenseType"
|
||||||
|
return -not ($releaseType -match "beta")
|
||||||
|
}
|
||||||
|
|
||||||
function Get-XcodeSimulatorsInfo {
|
function Get-XcodeSimulatorsInfo {
|
||||||
param(
|
param(
|
||||||
[string] $Filter
|
[string] $Filter
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ function Get-XcodeInfoList {
|
|||||||
$versionInfo = Get-XcodeVersionInfo
|
$versionInfo = Get-XcodeVersionInfo
|
||||||
$versionInfo.Path = $xcodeRootPath
|
$versionInfo.Path = $xcodeRootPath
|
||||||
$versionInfo.IsDefault = ($xcodeRootPath -eq $defaultXcodeRootPath)
|
$versionInfo.IsDefault = ($xcodeRootPath -eq $defaultXcodeRootPath)
|
||||||
|
$versionInfo.IsStable = Test-XcodeStableRelease -XcodeRootPath $xcodeRootPath
|
||||||
|
|
||||||
$xcodeInfo.Add($xcodeRootPath, [PSCustomObject] @{
|
$xcodeInfo.Add($xcodeRootPath, [PSCustomObject] @{
|
||||||
VersionInfo = $versionInfo
|
VersionInfo = $versionInfo
|
||||||
@@ -91,6 +92,7 @@ function Build-XcodeTable {
|
|||||||
$xcodeList = $xcodeInfo.Values | ForEach-Object { $_.VersionInfo } | Sort-Object $sortRules
|
$xcodeList = $xcodeInfo.Values | ForEach-Object { $_.VersionInfo } | Sort-Object $sortRules
|
||||||
return $xcodeList | ForEach-Object {
|
return $xcodeList | ForEach-Object {
|
||||||
$defaultPostfix = If ($_.IsDefault) { " (default)" } else { "" }
|
$defaultPostfix = If ($_.IsDefault) { " (default)" } else { "" }
|
||||||
|
$betaPostfix = If ($_.IsStable) { "" } else { " (beta)" }
|
||||||
return [PSCustomObject] @{
|
return [PSCustomObject] @{
|
||||||
"Version" = $_.Version.ToString() + $betaPostfix + $defaultPostfix
|
"Version" = $_.Version.ToString() + $betaPostfix + $defaultPostfix
|
||||||
"Build" = $_.Build
|
"Build" = $_.Build
|
||||||
|
|||||||
Reference in New Issue
Block a user