[macOS] Refactor Common.Helpers (#8924)

* [macOS] Refactor Common.Helpers

* Update readme file

* Remove unnecessary double quotes

---------

Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
This commit is contained in:
Alexey-Ayupov
2023-12-04 12:13:08 +01:00
committed by GitHub
parent ff1dc02cbc
commit 69db5c6c63
46 changed files with 292 additions and 359 deletions

View File

@@ -2,16 +2,17 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/Helpers.psm1" -DisableNameChecking
$os = Get-OSVersion
if ($os.IsVentura -or $os.IsSonoma) {
$MONO_VERSIONS = @(Get-ToolsetValue "mono.framework.version")
$MONO_VERSIONS = @((Get-ToolsetContent).mono.framework.version)
$XAMARIN_IOS_VERSIONS = @()
$XAMARIN_MAC_VERSIONS = @()
$XAMARIN_ANDROID_VERSIONS = @()
} elseif ($os.IsBigSur -or $os.IsMonterey) {
$MONO_VERSIONS = Get-ToolsetValue "xamarin.mono-versions"
$XAMARIN_IOS_VERSIONS = Get-ToolsetValue "xamarin.ios-versions"
$XAMARIN_MAC_VERSIONS = Get-ToolsetValue "xamarin.mac-versions"
$XAMARIN_ANDROID_VERSIONS = Get-ToolsetValue "xamarin.android-versions"
$MONO_VERSIONS = (Get-ToolsetContent).xamarin.mono_versions
$XAMARIN_IOS_VERSIONS = (Get-ToolsetContent).xamarin.ios_versions
$XAMARIN_MAC_VERSIONS = (Get-ToolsetContent).xamarin.mac_versions
$XAMARIN_ANDROID_VERSIONS = (Get-ToolsetContent).xamarin.android_versions
}
BeforeAll {
@@ -53,7 +54,7 @@ Describe "Mono" {
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
Confirm-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
}
It "NUnit console is installed" -TestCases $testCase {
@@ -116,7 +117,7 @@ Describe "Xamarin.iOS" -Skip:($os.IsVentura -or $os.IsSonoma) {
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
Confirm-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
}
}
}
@@ -149,7 +150,7 @@ Describe "Xamarin.Mac" -Skip:($os.IsVentura -or $os.IsSonoma) {
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
Confirm-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
}
}
}
@@ -181,7 +182,7 @@ Describe "Xamarin.Android" -Skip:($os.IsVentura -or $os.IsSonoma) {
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
Confirm-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
}
It "has correct symlinks" -TestCases $testCase {
@@ -205,8 +206,8 @@ Describe "Xamarin Bundles" -Skip:($os.IsVentura -or $os.IsSonoma) {
If ($XAMARIN_BUNDLES.Count -eq 0) { return } # Skip this test if there are no bundles
[array]$XAMARIN_BUNDLES = Get-ToolsetValue "xamarin.bundles"
$XAMARIN_DEFAULT_BUNDLE = Get-ToolsetValue "xamarin.bundle-default"
[array]$XAMARIN_BUNDLES = (Get-ToolsetContent).xamarin.bundles
$XAMARIN_DEFAULT_BUNDLE = (Get-ToolsetContent).xamarin.bundle_default
If ($XAMARIN_DEFAULT_BUNDLE -eq "latest") { $XAMARIN_DEFAULT_BUNDLE = $XAMARIN_BUNDLES[0].symlink }
$currentBundle = [PSCustomObject] @{
@@ -244,7 +245,7 @@ Describe "Xamarin Bundles" -Skip:($os.IsVentura -or $os.IsSonoma) {
$sourceVersionPath = Join-Path $MONO_VERSIONS_PATH $BundleMono "VERSION"
$targetVersionPath = Join-Path $MONO_VERSIONS_PATH $BundleSymlink "VERSION"
Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
Confirm-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
}
It "iOS symlink <BundleSymlink> exists" -TestCases $allBundles {
@@ -262,7 +263,7 @@ Describe "Xamarin Bundles" -Skip:($os.IsVentura -or $os.IsSonoma) {
$sourceVersionPath = Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleIos "VERSION"
$targetVersionPath = Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleSymlink "VERSION"
Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
Confirm-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
}
It "Mac symlink <BundleSymlink> exists" -TestCases $allBundles {
@@ -280,7 +281,7 @@ Describe "Xamarin Bundles" -Skip:($os.IsVentura -or $os.IsSonoma) {
$sourceVersionPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleMac "VERSION"
$targetVersionPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleSymlink "VERSION"
Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
Confirm-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
}
It "Xamarin.Android symlink <BundleSymlink> exists" -TestCases $allBundles {
@@ -298,7 +299,7 @@ Describe "Xamarin Bundles" -Skip:($os.IsVentura -or $os.IsSonoma) {
$sourceVersionPath = Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleAndroid "VERSION"
$targetVersionPath = Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleSymlink "VERSION"
Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
Confirm-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
}
}