mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
reuse function
This commit is contained in:
@@ -46,11 +46,17 @@ function Switch-Xcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Test-XcodeStableRelease {
|
function Test-XcodeStableRelease {
|
||||||
param(
|
param (
|
||||||
[Parameter(Mandatory)]
|
[Parameter(ParameterSetName = 'Version')]
|
||||||
|
[string] $Version,
|
||||||
|
[Parameter(ParameterSetName = 'Path')]
|
||||||
[string] $XcodeRootPath
|
[string] $XcodeRootPath
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if ($PSCmdlet.ParameterSetName -eq "Version") {
|
||||||
|
$XcodeRootPath = Get-XcodeRootPath $Version
|
||||||
|
}
|
||||||
|
|
||||||
$licenseInfoPlistPath = Join-Path $XcodeRootPath "Contents" "Resources" "LicenseInfo.plist"
|
$licenseInfoPlistPath = Join-Path $XcodeRootPath "Contents" "Resources" "LicenseInfo.plist"
|
||||||
$releaseType = & defaults read $licenseInfoPlistPath "licenseType"
|
$releaseType = & defaults read $licenseInfoPlistPath "licenseType"
|
||||||
return -not ($releaseType -match "beta")
|
return -not ($releaseType -match "beta")
|
||||||
@@ -102,17 +108,4 @@ function Get-XcodePairsList {
|
|||||||
$result += "$watchName $phoneName"
|
$result += "$watchName $phoneName"
|
||||||
}
|
}
|
||||||
return $result
|
return $result
|
||||||
}
|
|
||||||
|
|
||||||
function Test-XcodeStableVersion {
|
|
||||||
param([Parameter(Mandatory)][string]$Version)
|
|
||||||
|
|
||||||
if ($Version -match "beta") {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
if ($Version -match "GM") {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
|
|
||||||
return $true
|
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ Describe "Xcode" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Context "XCODE_DEVELOPER_DIR" {
|
Context "XCODE_DEVELOPER_DIR" {
|
||||||
$stableXcodeVersions = $XCODE_VERSIONS | Where-Object { Test-XcodeStableVersion $_ }
|
$stableXcodeVersions = $XCODE_VERSIONS | Where-Object { Test-XcodeStableRelease -Version $_ }
|
||||||
$majorXcodeVersions = $stableXcodeVersions | ForEach-Object { $_.Split(".")[0] } | Select-Object -Unique
|
$majorXcodeVersions = $stableXcodeVersions | ForEach-Object { $_.Split(".")[0] } | Select-Object -Unique
|
||||||
$testCases = $majorXcodeVersions | ForEach-Object {
|
$testCases = $majorXcodeVersions | ForEach-Object {
|
||||||
$majorXcodeVersion = $_
|
$majorXcodeVersion = $_
|
||||||
@@ -84,7 +84,7 @@ Describe "Xcode" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Describe "Xcode simulators" {
|
Describe "Xcode simulators" {
|
||||||
$XCODE_VERSIONS | Where-Object { Test-XcodeStableVersion $_ } | ForEach-Object {
|
$XCODE_VERSIONS | Where-Object { Test-XcodeStableRelease -Version $_ } | ForEach-Object {
|
||||||
Switch-Xcode -Version $_
|
Switch-Xcode -Version $_
|
||||||
|
|
||||||
Context "$_" {
|
Context "$_" {
|
||||||
|
|||||||
Reference in New Issue
Block a user