[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

@@ -6,8 +6,7 @@
Import-Module "~/image-generation/helpers/Common.Helpers.psm1" Import-Module "~/image-generation/helpers/Common.Helpers.psm1"
function Get-ToolsetToolFullPath function Get-ToolsetToolFullPath {
{
param param
( (
[Parameter(Mandatory)] [string] $ToolName, [Parameter(Mandatory)] [string] $ToolName,
@@ -23,25 +22,23 @@ function Get-ToolsetToolFullPath
} }
$arch = Get-Architecture $arch = Get-Architecture
$toolcache = Get-ToolsetValue "toolcache" $toolcache = (Get-ToolsetContent).toolcache
foreach ($tool in $toolcache) foreach ($tool in $toolcache) {
{
$toolName = $tool.name $toolName = $tool.name
$toolEnvironment = $tool.arch.$arch.variable_template $toolEnvironment = $tool.arch.$arch.variable_template
if (-not $toolEnvironment) if (-not $toolEnvironment) {
{
continue continue
} }
foreach ($toolVersion in $tool.arch.$arch.versions) foreach ($toolVersion in $tool.arch.$arch.versions) {
{
Write-Host "Set $toolName $toolVersion environment variable..." Write-Host "Set $toolName $toolVersion environment variable..."
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $arch $toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $arch
$envName = $toolEnvironment -f $toolVersion.split(".") $envName = $toolEnvironment -f $toolVersion.split(".")
# Add environment variable name=value # Add environment variable name=value
Add-EnvironmentVariable -Name $envName -Value $toolPath $envVar = "export {0}={1}" -f $envName, $toolPath
Add-Content -Path "${env:HOME}/.bashrc" -Value $envVar
} }
} }

View File

@@ -31,11 +31,11 @@ $arch = Get-Architecture
# Get toolcache content from toolset # Get toolcache content from toolset
$toolsToInstall = @("Python", "Node", "Go") $toolsToInstall = @("Python", "Node", "Go")
$tools = Get-ToolsetValue "toolcache" | Where-Object {$toolsToInstall -contains $_.Name} $tools = (Get-ToolsetContent).toolcache | Where-Object {$toolsToInstall -contains $_.Name}
foreach ($tool in $tools) { foreach ($tool in $tools) {
# Get versions manifest for current tool # Get versions manifest for current tool
$assets = Invoke-RestMethodWithRetry -Url $tool.url $assets = Invoke-RestMethod $tool.url -MaximumRetryCount 10 -RetryIntervalSec 30
# Get github release asset for each version # Get github release asset for each version
foreach ($version in $tool.arch.$arch.versions) { foreach ($version in $tool.arch.$arch.versions) {

View File

@@ -8,10 +8,10 @@ $ErrorActionPreference = "Stop"
Import-Module "$env:HOME/image-generation/helpers/Common.Helpers.psm1" Import-Module "$env:HOME/image-generation/helpers/Common.Helpers.psm1"
Import-Module "$env:HOME/image-generation/helpers/Xcode.Installer.psm1" -DisableNameChecking Import-Module "$env:HOME/image-generation/helpers/Xcode.Installer.psm1" -DisableNameChecking
$ARCH = Get-Architecture $arch = Get-Architecture
[Array]$xcodeVersions = Get-ToolsetValue "xcode.$ARCH.versions" [Array]$xcodeVersions = (Get-ToolsetContent).xcode.$arch.versions
write-host $xcodeVersions write-host $xcodeVersions
$defaultXcode = Get-ToolsetValue "xcode.default" $defaultXcode = (Get-ToolsetContent).xcode.default
[Array]::Reverse($xcodeVersions) [Array]::Reverse($xcodeVersions)
$threadCount = "5" $threadCount = "5"
@@ -61,7 +61,7 @@ $xcodeVersions | ForEach-Object {
Write-Host "Rebuilding Launch Services database ..." Write-Host "Rebuilding Launch Services database ..."
$xcodeVersions | ForEach-Object { $xcodeVersions | ForEach-Object {
Rebuild-XcodeLaunchServicesDb -Version $_.link Initialize-XcodeLaunchServicesDb -Version $_.link
} }
Write-Host "Setting default Xcode to $defaultXcode" Write-Host "Setting default Xcode to $defaultXcode"

View File

@@ -8,7 +8,7 @@ $ErrorActionPreference = "Stop"
Import-Module "$env:HOME/image-generation/helpers/Xcode.Helpers.psm1" -DisableNameChecking Import-Module "$env:HOME/image-generation/helpers/Xcode.Helpers.psm1" -DisableNameChecking
Import-Module "$env:HOME/image-generation/software-report/SoftwareReport.Xcode.psm1" -DisableNameChecking Import-Module "$env:HOME/image-generation/software-report/SoftwareReport.Xcode.psm1" -DisableNameChecking
function Ensure-SimulatorInstalled { function Test-SimulatorInstalled {
param( param(
[Parameter(Mandatory)] [Parameter(Mandatory)]
[string] $RuntimeId, [string] $RuntimeId,
@@ -52,5 +52,5 @@ Get-XcodeInfoList | Out-Null
Write-Host "Validating and fixing Xcode simulators..." Write-Host "Validating and fixing Xcode simulators..."
Get-BrokenXcodeSimulatorsList | ForEach-Object { Get-BrokenXcodeSimulatorsList | ForEach-Object {
Ensure-SimulatorInstalled -RuntimeId $_.RuntimeId -DeviceId $_.DeviceId -SimulatorName $_.SimulatorName -XcodeVersion $_.XcodeVersion Test-SimulatorInstalled -RuntimeId $_.RuntimeId -DeviceId $_.DeviceId -SimulatorName $_.SimulatorName -XcodeVersion $_.XcodeVersion
} }

View File

@@ -33,9 +33,9 @@ components=()
ANDROID_PLATFORM=$(get_toolset_value '.android.platform_min_version') ANDROID_PLATFORM=$(get_toolset_value '.android.platform_min_version')
ANDROID_BUILD_TOOL=$(get_toolset_value '.android.build_tools_min_version') ANDROID_BUILD_TOOL=$(get_toolset_value '.android.build_tools_min_version')
ANDROID_EXTRA_LIST=($(get_toolset_value '.android."extra-list"[]')) ANDROID_EXTRA_LIST=($(get_toolset_value '.android."extras"[]'))
ANDROID_ADDON_LIST=($(get_toolset_value '.android."addon-list"[]')) ANDROID_ADDON_LIST=($(get_toolset_value '.android."addons"[]'))
ANDROID_ADDITIONAL_TOOLS=($(get_toolset_value '.android."additional-tools"[]')) ANDROID_ADDITIONAL_TOOLS=($(get_toolset_value '.android."additional_tools"[]'))
ANDROID_NDK_MAJOR_VERSIONS=($(get_toolset_value '.android.ndk."versions"[]')) ANDROID_NDK_MAJOR_VERSIONS=($(get_toolset_value '.android.ndk."versions"[]'))
ANDROID_NDK_MAJOR_DEFAULT=$(get_toolset_value '.android.ndk.default') ANDROID_NDK_MAJOR_DEFAULT=$(get_toolset_value '.android.ndk.default')
ANDROID_NDK_MAJOR_LATEST=$(get_toolset_value '.android.ndk."versions"[-1]') ANDROID_NDK_MAJOR_LATEST=$(get_toolset_value '.android.ndk."versions"[-1]')

View File

@@ -7,12 +7,12 @@
source ~/utils/utils.sh source ~/utils/utils.sh
source ~/utils/xamarin-utils.sh source ~/utils/xamarin-utils.sh
MONO_VERSIONS=($(get_toolset_value '.xamarin."mono-versions" | reverse | .[]')) MONO_VERSIONS=($(get_toolset_value '.xamarin."mono_versions" | reverse | .[]'))
XAMARIN_IOS_VERSIONS=($(get_toolset_value '.xamarin."ios-versions" | reverse | .[]')) XAMARIN_IOS_VERSIONS=($(get_toolset_value '.xamarin."ios_versions" | reverse | .[]'))
XAMARIN_MAC_VERSIONS=($(get_toolset_value '.xamarin."mac-versions" | reverse | .[]')) XAMARIN_MAC_VERSIONS=($(get_toolset_value '.xamarin."mac_versions" | reverse | .[]'))
XAMARIN_ANDROID_VERSIONS=($(get_toolset_value '.xamarin."android-versions" | reverse | .[]')) XAMARIN_ANDROID_VERSIONS=($(get_toolset_value '.xamarin."android_versions" | reverse | .[]'))
LATEST_SDK_SYMLINK=$(get_toolset_value '.xamarin.bundles[0].symlink') LATEST_SDK_SYMLINK=$(get_toolset_value '.xamarin.bundles[0].symlink')
CURRENT_SDK_SYMLINK=$(get_toolset_value '.xamarin."bundle-default"') CURRENT_SDK_SYMLINK=$(get_toolset_value '.xamarin."bundle_default"')
DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default') DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default')
if [ "$CURRENT_SDK_SYMLINK" == "latest" ]; then if [ "$CURRENT_SDK_SYMLINK" == "latest" ]; then

View File

@@ -5,6 +5,7 @@ function Split-TableRowByColumns {
param ( param (
[string] $Row [string] $Row
) )
return $Row.Split("|") | ForEach-Object { $_.trim() } return $Row.Split("|") | ForEach-Object { $_.trim() }
} }
@@ -46,6 +47,7 @@ function Get-AndroidPackages {
function Build-AndroidTable { function Build-AndroidTable {
Write-Host "Build-AndroidTable" Write-Host "Build-AndroidTable"
$packageInfo = Get-AndroidInstalledPackages $packageInfo = Get-AndroidInstalledPackages
return @( return @(
@{ @{
"Package" = "Android Command Line Tools" "Package" = "Android Command Line Tools"
@@ -111,6 +113,7 @@ function Build-AndroidEnvironmentTable {
$androidVersions = Get-Item env:ANDROID_* $androidVersions = Get-Item env:ANDROID_*
$shoulddResolveLink = 'ANDROID_NDK', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME' $shoulddResolveLink = 'ANDROID_NDK', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME'
return $androidVersions | Sort-Object -Property Name | ForEach-Object { return $androidVersions | Sort-Object -Property Name | ForEach-Object {
[PSCustomObject] @{ [PSCustomObject] @{
"Name" = $_.Name "Name" = $_.Name
@@ -191,7 +194,7 @@ function Get-AndroidGoogleAPIsVersions {
function Get-AndroidNDKVersions { function Get-AndroidNDKVersions {
$ndkFolderPath = Join-Path (Get-AndroidSDKRoot) "ndk" $ndkFolderPath = Join-Path (Get-AndroidSDKRoot) "ndk"
$versions += Get-ChildItem -Path $ndkFolderPath -Name $versions += Get-ChildItem -Path $ndkFolderPath -Name
$ndkDefaultVersion = Get-ToolsetValue "android.ndk.default" $ndkDefaultVersion = (Get-ToolsetContent).android.ndk.default
$ndkDefaultFullVersion = Get-ChildItem "$env:ANDROID_HOME/ndk/$ndkDefaultVersion.*" -Name | Select-Object -Last 1 $ndkDefaultFullVersion = Get-ChildItem "$env:ANDROID_HOME/ndk/$ndkDefaultVersion.*" -Name | Select-Object -Last 1
return ($versions | ForEach-Object { return ($versions | ForEach-Object {

View File

@@ -1,7 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion
function Get-BashVersion { function Get-BashVersion {
$version = bash -c 'echo ${BASH_VERSION}' $version = bash -c 'echo ${BASH_VERSION}'
return $version return $version
@@ -83,7 +81,7 @@ function Get-VcpkgVersion {
} }
function Get-GccVersions { function Get-GccVersions {
$versionList = Get-ToolsetValue -KeyPath gcc.versions $versionList = (Get-ToolsetContent).gcc.versions
$versionList | Foreach-Object { $versionList | Foreach-Object {
$nameVersion = Run-Command "gcc-${_} --version" | Select-Object -First 1 $nameVersion = Run-Command "gcc-${_} --version" | Select-Object -First 1
$version = ($nameVersion -replace "^gcc-${_}").Trim() -replace '\).*$', ')' $version = ($nameVersion -replace "^gcc-${_}").Trim() -replace '\).*$', ')'
@@ -92,7 +90,7 @@ function Get-GccVersions {
} }
function Get-FortranVersions { function Get-FortranVersions {
$versionList = Get-ToolsetValue -KeyPath gcc.versions $versionList = (Get-ToolsetContent).gcc.versions
$versionList | Foreach-Object { $versionList | Foreach-Object {
$nameVersion = Run-Command "gfortran-${_} --version" | Select-Object -First 1 $nameVersion = Run-Command "gfortran-${_} --version" | Select-Object -First 1
$version = ($nameVersion -replace "^GNU Fortran").Trim() -replace '\).*$', ')' $version = ($nameVersion -replace "^GNU Fortran").Trim() -replace '\).*$', ')'
@@ -106,7 +104,7 @@ function Get-ClangLLVMVersions {
$defaultClangOutput = Run-Command "clang --version" | Out-String $defaultClangOutput = Run-Command "clang --version" | Out-String
$defaultClangVersion = $clangVersionRegex.Match($defaultClangOutput).Groups['version'].Value $defaultClangVersion = $clangVersionRegex.Match($defaultClangOutput).Groups['version'].Value
$homebrewClangPath = '$(brew --prefix llvm@{0})/bin/clang' -f (Get-ToolsetValue 'llvm.version') $homebrewClangPath = '$(brew --prefix llvm@{0})/bin/clang' -f ((Get-ToolsetContent).llvm.version)
$homebrewClangOutput = Run-Command "$homebrewClangPath --version" | Out-String $homebrewClangOutput = Run-Command "$homebrewClangPath --version" | Out-String
$homebrewClangVersion = $clangVersionRegex.Match($homebrewClangOutput).Groups['version'].Value $homebrewClangVersion = $clangVersionRegex.Match($homebrewClangOutput).Groups['version'].Value

View File

@@ -7,6 +7,7 @@ function Get-JavaVersions {
} else { } else {
$javaVersions = Get-Item env:JAVA_HOME_*_X64 $javaVersions = Get-Item env:JAVA_HOME_*_X64
} }
$sortRules = @{ $sortRules = @{
Expression = { [Int32]$_.Name.Split("_")[2] } Expression = { [Int32]$_.Name.Split("_")[2] }
Descending = $false Descending = $false

View File

@@ -54,7 +54,7 @@ function Build-ToolcacheSection {
} }
function Get-PowerShellModules { function Get-PowerShellModules {
$modules = (Get-ToolsetValue powershellModules).name $modules = ((Get-ToolsetContent).powershellModules).name
$modules | ForEach-Object { $modules | ForEach-Object {
$moduleName = $_ $moduleName = $_
$moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique $moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique

View File

@@ -1,8 +1,8 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
function Build-VSMacTable { function Build-VSMacTable {
$vsMacVersions = Get-ToolsetValue "xamarin.vsmac.versions" $vsMacVersions = (Get-ToolsetContent).xamarin.vsmac.versions
$defaultVSMacVersion = Get-ToolsetValue "xamarin.vsmac.default" $defaultVSMacVersion = (Get-ToolsetContent).xamarin.vsmac.default
return $vsMacVersions | ForEach-Object { return $vsMacVersions | ForEach-Object {
$isDefault = $_ -eq $defaultVSMacVersion $isDefault = $_ -eq $defaultVSMacVersion
@@ -29,8 +29,8 @@ function Get-NUnitVersion {
} }
function Build-XamarinTable { function Build-XamarinTable {
$xamarinBundles = Get-ToolsetValue "xamarin.bundles" $xamarinBundles = (Get-ToolsetContent).xamarin.bundles
$defaultSymlink = Get-ToolsetValue "xamarin.bundle-default" $defaultSymlink = (Get-ToolsetContent).xamarin.bundle_default
if ($defaultSymlink -eq "latest") { if ($defaultSymlink -eq "latest") {
$defaultSymlink = $xamarinBundles[0].symlink $defaultSymlink = $xamarinBundles[0].symlink
} }

View File

@@ -4,7 +4,7 @@ Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
function Get-XcodePaths { function Get-XcodePaths {
$xcodePaths = Get-ChildItemWithoutSymlinks "/Applications" -Filter "Xcode_*.app" $xcodePaths = Get-ChildItem -Path "/Applications" -Filter "Xcode_*.app" | Where-Object { !$_.LinkType }
return $xcodePaths | Select-Object -ExpandProperty Fullname return $xcodePaths | Select-Object -ExpandProperty Fullname
} }

View File

@@ -7,6 +7,7 @@ function Get-CommandResult {
# Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version") # Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version")
$stdout = & bash -c "$Command 2>&1" $stdout = & bash -c "$Command 2>&1"
$exitCode = $LASTEXITCODE $exitCode = $LASTEXITCODE
return @{ return @{
Output = If ($Multiline -eq $true) { $stdout } else { [string]$stdout } Output = If ($Multiline -eq $true) { $stdout } else { [string]$stdout }
ExitCode = $exitCode ExitCode = $exitCode
@@ -14,21 +15,16 @@ function Get-CommandResult {
} }
# Gets path to the tool, analogue of 'which tool' # Gets path to the tool, analogue of 'which tool'
function Get-WhichTool($tool) { function Get-ToolPath($tool) {
return (Get-Command $tool).Path return (Get-Command $tool).Path
} }
# Gets value of environment variable by the name
function Get-EnvironmentVariable($variable) {
return [System.Environment]::GetEnvironmentVariable($variable)
}
# Returns the object with information about current OS # Returns the object with information about current OS
# It can be used for OS-specific tests # It can be used for OS-specific tests
function Get-OSVersion { function Get-OSVersion {
$osVersion = [Environment]::OSVersion $osVersion = [Environment]::OSVersion
$osVersionMajorMinor = $osVersion.Version.ToString(2)
$processorArchitecture = arch $processorArchitecture = arch
return [PSCustomObject]@{ return [PSCustomObject]@{
Version = $osVersion.Version Version = $osVersion.Version
Platform = $osVersion.Platform Platform = $osVersion.Platform
@@ -44,85 +40,11 @@ function Get-OSVersion {
} }
} }
function Get-ChildItemWithoutSymlinks { # Get the value of the toolset
param ( function Get-ToolsetContent {
[Parameter(Mandatory)]
[string] $Path,
[string] $Filter
)
$files = Get-ChildItem -Path $Path -Filter $Filter
$files = $files | Where-Object { !$_.LinkType } # cut symlinks
return $files
}
# Get the value of specific toolset node
# Example, invoke `Get-ToolsetValue "xamarin.bundles"` to get value of `$toolsetJson.xamarin.bundles`
function Get-ToolsetValue {
param (
[Parameter(Mandatory = $true)]
[string] $KeyPath
)
$toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json" $toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json"
$jsonNode = Get-Content -Raw $toolsetPath | ConvertFrom-Json $toolsetJson = Get-Content -Path $toolsetPath -Raw
ConvertFrom-Json -InputObject $toolsetJson
$pathParts = $KeyPath.Split(".")
# try to walk through all arguments consequentially to resolve specific json node
$pathParts | ForEach-Object {
$jsonNode = $jsonNode.$_
}
return $jsonNode
}
function Get-ToolcachePackages {
$toolcachePath = Join-Path $env:HOME "image-generation" "toolcache.json"
return Get-Content -Raw $toolcachePath | ConvertFrom-Json
}
function Invoke-RestMethodWithRetry {
param (
[Parameter()]
[string]
$Url
)
Invoke-RestMethod $Url -MaximumRetryCount 10 -RetryIntervalSec 30
}
function Invoke-ValidateCommand {
param(
[Parameter(Mandatory)]
[string]$Command,
[Uint] $Timeout = 0
)
if ($Timeout -eq 0)
{
$output = Invoke-Expression -Command $Command
if ($LASTEXITCODE -ne 0) {
throw "Command '$Command' has finished with exit code $LASTEXITCODE"
}
return $output
}
else
{
$job = $command | Start-Job -ScriptBlock {
$output = Invoke-Expression -Command $input
if ($LASTEXITCODE -ne 0) {
throw 'Command failed'
}
return $output
}
$waitObject = $job | Wait-Job -Timeout $Timeout
if(-not $waitObject)
{
throw "Command '$Command' has timed out"
}
if($waitObject.State -eq 'Failed')
{
throw "Command '$Command' has failed"
}
Receive-Job -Job $job
}
} }
function Invoke-DownloadWithRetry { function Invoke-DownloadWithRetry {
@@ -174,37 +96,15 @@ function Invoke-DownloadWithRetry {
return $Path return $Path
} }
function Add-EnvironmentVariable {
param
(
[Parameter(Mandatory)] [string] $Name,
[Parameter(Mandatory)] [string] $Value,
[string] $FilePath = "${env:HOME}/.bashrc"
)
$envVar = "export {0}={1}" -f $Name, $Value
Add-Content -Path $FilePath -Value $envVar
}
function isVeertu { function isVeertu {
return (Test-Path -Path "/Library/Application Support/Veertu") return (Test-Path -Path "/Library/Application Support/Veertu")
} }
function Get-Architecture { function Get-Architecture {
$arch = arch $arch = arch
if ($arch -ne "arm64") if ($arch -ne "arm64") {
{
$arch = "x64" $arch = "x64"
} }
return $arch return $arch
} }
function Test-CommandExists {
param
(
[Parameter(Mandatory)] [string] $Command
)
[boolean] (Get-Command $Command -ErrorAction 'SilentlyContinue')
}

View File

@@ -36,6 +36,7 @@ function Get-XcodeVersionInfo {
$xcodebuildPath = Get-XcodeToolPath -XcodeRootPath $XcodeRootPath -ToolName "xcodebuild" $xcodebuildPath = Get-XcodeToolPath -XcodeRootPath $XcodeRootPath -ToolName "xcodebuild"
[string]$output = Invoke-Expression "$xcodebuildPath -version" [string]$output = Invoke-Expression "$xcodebuildPath -version"
$versionOutputParts = $output.Split(" ") $versionOutputParts = $output.Split(" ")
return @{ return @{
Version = [System.Version]::Parse($versionOutputParts[1]) Version = [System.Version]::Parse($versionOutputParts[1])
Build = $versionOutputParts[4] Build = $versionOutputParts[4]
@@ -72,6 +73,7 @@ function Test-XcodeStableRelease {
$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")
} }
@@ -106,6 +108,7 @@ function Get-XcodeDevicesList {
$result += "$runtimeName $deviceName" $result += "$runtimeName $deviceName"
} }
} }
return $result return $result
} }
@@ -120,6 +123,7 @@ function Get-XcodePairsList {
$phoneName = $_.Value.phone.name $phoneName = $_.Value.phone.name
$result += "$watchName $phoneName" $result += "$watchName $phoneName"
} }
return $result return $result
} }

View File

@@ -13,7 +13,6 @@ function Install-XcodeVersion {
$xcodeTargetPath = Get-XcodeRootPath -Version $LinkTo $xcodeTargetPath = Get-XcodeRootPath -Version $LinkTo
$xcodeXipDirectory = Invoke-DownloadXcodeArchive -DownloadDirectory $xcodeDownloadDirectory -Version $Version $xcodeXipDirectory = Invoke-DownloadXcodeArchive -DownloadDirectory $xcodeDownloadDirectory -Version $Version
Expand-XcodeXipArchive -DownloadDirectory $xcodeXipDirectory.FullName -TargetPath $xcodeTargetPath Expand-XcodeXipArchive -DownloadDirectory $xcodeXipDirectory.FullName -TargetPath $xcodeTargetPath
Remove-Item -Path $xcodeXipDirectory -Force -Recurse Remove-Item -Path $xcodeXipDirectory -Force -Recurse
} }
@@ -26,13 +25,11 @@ function Invoke-DownloadXcodeArchive {
) )
Write-Host "Downloading Xcode $Version" Write-Host "Downloading Xcode $Version"
$tempXipDirectory = New-Item -Path $DownloadDirectory -Name "Xcode$Version" -ItemType "Directory" $tempXipDirectory = New-Item -Path $DownloadDirectory -Name "Xcode$Version" -ItemType "Directory"
$xcodeFileName = 'Xcode-{0}.xip' -f $Version $xcodeFileName = 'Xcode-{0}.xip' -f $Version
$xcodeUri = '{0}{1}?{2}'-f ${env:XCODE_INSTALL_STORAGE_URL}, $xcodeFileName, ${env:XCODE_INSTALL_SAS} $xcodeUri = '{0}{1}?{2}'-f ${env:XCODE_INSTALL_STORAGE_URL}, $xcodeFileName, ${env:XCODE_INSTALL_SAS}
Invoke-DownloadWithRetry -Url $xcodeUri -Path (Join-Path $tempXipDirectory.FullName $xcodeFileName) | Out-Null Invoke-DownloadWithRetry -Url $xcodeUri -Path (Join-Path $tempXipDirectory.FullName $xcodeFileName) | Out-Null
return $tempXipDirectory return $tempXipDirectory
} }
@@ -50,6 +47,7 @@ function Resolve-ExactXcodeVersion {
$semverVersion = [SemVer]::Parse($Version) $semverVersion = [SemVer]::Parse($Version)
$availableVersions = Get-AvailableXcodeVersions $availableVersions = Get-AvailableXcodeVersions
$satisfiedVersions = $availableVersions | Where-Object { $semverVersion -eq $_.stableSemver } $satisfiedVersions = $availableVersions | Where-Object { $semverVersion -eq $_.stableSemver }
return $satisfiedVersions | Select-Object -Last 1 -ExpandProperty rawVersion return $satisfiedVersions | Select-Object -Last 1 -ExpandProperty rawVersion
} }
@@ -86,7 +84,7 @@ function Expand-XcodeXipArchive {
Write-Host "Extracting Xcode from '$xcodeXipPath'" Write-Host "Extracting Xcode from '$xcodeXipPath'"
Push-Location $DownloadDirectory Push-Location $DownloadDirectory
if(Test-CommandExists 'unxip') { if ([boolean] (Get-Command 'unxip' -ErrorAction 'SilentlyContinue')) {
Invoke-ValidateCommand "unxip $xcodeXipPath" Invoke-ValidateCommand "unxip $xcodeXipPath"
} else { } else {
Invoke-ValidateCommand "xip -x $xcodeXipPath" Invoke-ValidateCommand "xip -x $xcodeXipPath"
@@ -126,7 +124,6 @@ function Approve-XcodeLicense {
) )
$os = Get-OSVersion $os = Get-OSVersion
$XcodeRootPath = Get-XcodeRootPath -Version $Version $XcodeRootPath = Get-XcodeRootPath -Version $Version
Write-Host "Approving Xcode license for '$XcodeRootPath'..." Write-Host "Approving Xcode license for '$XcodeRootPath'..."
$xcodeBuildPath = Get-XcodeToolPath -XcodeRootPath $XcodeRootPath -ToolName "xcodebuild" $xcodeBuildPath = Get-XcodeToolPath -XcodeRootPath $XcodeRootPath -ToolName "xcodebuild"
@@ -193,7 +190,7 @@ function Build-XcodeSymlinks {
} }
} }
function Rebuild-XcodeLaunchServicesDb { function Initialize-XcodeLaunchServicesDb {
param ( param (
[Parameter(Mandatory)] [Parameter(Mandatory)]
[string] $Version [string] $Version
@@ -246,3 +243,37 @@ function Set-XcodeDeveloperDirEnvironmentVariables {
"export ${variableName}=${variableValue}" | Out-File "$env:HOME/.bashrc" -Append "export ${variableName}=${variableValue}" | Out-File "$env:HOME/.bashrc" -Append
} }
} }
function Invoke-ValidateCommand {
param (
[Parameter(Mandatory)]
[string] $Command,
[Uint] $Timeout = 0
)
if ($Timeout -eq 0) {
$output = Invoke-Expression -Command $Command
if ($LASTEXITCODE -ne 0) {
throw "Command '$Command' has finished with exit code $LASTEXITCODE"
}
return $output
} else {
$job = $command | Start-Job -ScriptBlock {
$output = Invoke-Expression -Command $input
if ($LASTEXITCODE -ne 0) {
throw 'Command failed'
}
return $output
}
$waitObject = $job | Wait-Job -Timeout $Timeout
if (-not $waitObject) {
throw "Command '$Command' has timed out"
}
if ($waitObject.State -eq 'Failed') {
throw "Command '$Command' has failed"
}
Receive-Job -Job $job
}
}

View File

@@ -6,9 +6,9 @@ $os = Get-OSVersion
Describe "Android" { Describe "Android" {
$androidSdkManagerPackages = Get-AndroidPackages $androidSdkManagerPackages = Get-AndroidPackages
[int]$platformMinVersion = Get-ToolsetValue "android.platform_min_version" [int]$platformMinVersion = (Get-ToolsetContent).android.platform_min_version
[version]$buildToolsMinVersion = Get-ToolsetValue "android.build_tools_min_version" [version]$buildToolsMinVersion = (Get-ToolsetContent).android.build_tools_min_version
[array]$ndkVersions = Get-ToolsetValue "android.ndk.versions" [array]$ndkVersions = (Get-ToolsetContent).android.ndk.versions
$ndkFullVersions = $ndkVersions | ForEach-Object { Get-ChildItem "$env:ANDROID_HOME/ndk/${_}.*" -Name | Select-Object -Last 1 } | ForEach-Object { "ndk/${_}" } $ndkFullVersions = $ndkVersions | ForEach-Object { Get-ChildItem "$env:ANDROID_HOME/ndk/${_}.*" -Name | Select-Object -Last 1 } | ForEach-Object { "ndk/${_}" }
# Platforms starting with a letter are the preview versions, which is not installed on the image # Platforms starting with a letter are the preview versions, which is not installed on the image
$platformVersionsList = ($androidSdkManagerPackages | Where-Object { "$_".StartsWith("platforms;") }) -replace 'platforms;android-', '' | Where-Object { $_ -match "^\d" } | Sort-Object -Unique $platformVersionsList = ($androidSdkManagerPackages | Where-Object { "$_".StartsWith("platforms;") }) -replace 'platforms;android-', '' | Where-Object { $_ -match "^\d" } | Sort-Object -Unique
@@ -25,9 +25,9 @@ Describe "Android" {
$platformsInstalled, $platformsInstalled,
$buildTools, $buildTools,
$ndkFullVersions, $ndkFullVersions,
(Get-ToolsetValue "android.extra-list" | ForEach-Object { "extras/${_}" }), ((Get-ToolsetContent).android.extras | ForEach-Object { "extras/${_}" }),
(Get-ToolsetValue "android.addon-list" | ForEach-Object { "add-ons/${_}" }), ((Get-ToolsetContent).android.addons | ForEach-Object { "add-ons/${_}" }),
(Get-ToolsetValue "android.additional-tools") ((Get-ToolsetContent).android.additional_tools)
) | ForEach-Object { $_ } ) | ForEach-Object { $_ }
# Remove empty strings from array to avoid possible issues # Remove empty strings from array to avoid possible issues
@@ -36,7 +36,7 @@ Describe "Android" {
BeforeAll { BeforeAll {
$ANDROID_SDK_DIR = Join-Path $env:HOME "Library" "Android" "sdk" $ANDROID_SDK_DIR = Join-Path $env:HOME "Library" "Android" "sdk"
function Validate-AndroidPackage { function Confirm-AndroidPackage {
param ( param (
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[string] $PackageName [string] $PackageName
@@ -76,7 +76,7 @@ Describe "Android" {
It "<PackageName>" -TestCases $testCases { It "<PackageName>" -TestCases $testCases {
param ([string] $PackageName) param ([string] $PackageName)
Validate-AndroidPackage $PackageName Confirm-AndroidPackage $PackageName
} }
} }
} }

View File

@@ -1,4 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
Describe "Azure CLI" { Describe "Azure CLI" {

View File

@@ -1,4 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
Describe "Chrome" { Describe "Chrome" {

View File

@@ -10,7 +10,7 @@ Describe ".NET" {
} }
Describe "GCC" { Describe "GCC" {
$testCases = Get-ToolsetValue -KeyPath gcc.versions | ForEach-Object { @{Version = $_ } } $testCases = (Get-ToolsetContent).gcc.versions | ForEach-Object { @{Version = $_ } }
It "GCC <Version>" -TestCases $testCases { It "GCC <Version>" -TestCases $testCases {
param ( param (
@@ -60,7 +60,7 @@ Describe "AzCopy" {
Describe "Miniconda" -Skip:($os.IsVentura -or $os.IsSonoma) { Describe "Miniconda" -Skip:($os.IsVentura -or $os.IsSonoma) {
It "Conda" { It "Conda" {
Get-EnvironmentVariable "CONDA" | Should -Not -BeNullOrEmpty [System.Environment]::GetEnvironmentVariable("CONDA") | Should -Not -BeNullOrEmpty
$condaBinPath = Join-Path $env:CONDA "bin" "conda" $condaBinPath = Join-Path $env:CONDA "bin" "conda"
"$condaBinPath --version" | Should -ReturnZeroExitCode "$condaBinPath --version" | Should -ReturnZeroExitCode
} }
@@ -79,8 +79,8 @@ Describe "CocoaPods" {
} }
Describe "VSMac" -Skip:($os.IsVentura -or $os.IsSonoma) { Describe "VSMac" -Skip:($os.IsVentura -or $os.IsSonoma) {
$vsMacVersions = Get-ToolsetValue "xamarin.vsmac.versions" $vsMacVersions = (Get-ToolsetContent).xamarin.vsmac.versions
$defaultVSMacVersion = Get-ToolsetValue "xamarin.vsmac.default" $defaultVSMacVersion = (Get-ToolsetContent).xamarin.vsmac.default
$testCases = $vsMacVersions | ForEach-Object { $testCases = $vsMacVersions | ForEach-Object {
$vsPath = "/Applications/Visual Studio $_.app" $vsPath = "/Applications/Visual Studio $_.app"

View File

@@ -7,14 +7,14 @@ Describe "MongoDB" -Skip:($os.IsVentura -or $os.IsSonoma) {
@{ ToolName = "mongo" } @{ ToolName = "mongo" }
@{ ToolName = "mongod" } @{ ToolName = "mongod" }
) { ) {
$toolsetVersion = Get-ToolsetValue 'mongodb.version' $toolsetVersion = (Get-ToolsetContent).mongodb.version
(&$ToolName --version)[2].Split('"')[-2] | Should -BeLike "$toolsetVersion*" (&$ToolName --version)[2].Split('"')[-2] | Should -BeLike "$toolsetVersion*"
} }
} }
Describe "PostgreSQL" -Skip:($os.IsVentura -or $os.IsSonoma) { Describe "PostgreSQL" -Skip:($os.IsVentura -or $os.IsSonoma) {
It "PostgreSQL version should correspond to the version in the toolset" { It "PostgreSQL version should correspond to the version in the toolset" {
$toolsetVersion = Get-ToolsetValue 'postgresql.version' $toolsetVersion = (Get-ToolsetContent).postgresql.version
# Client version # Client version
(psql --version).split()[-2] | Should -BeLike "$toolsetVersion*" (psql --version).split()[-2] | Should -BeLike "$toolsetVersion*"
# Server version # Server version

View File

@@ -1,5 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion
Describe "Git" { Describe "Git" {
It "git is installed" { It "git is installed" {
"git --version" | Should -ReturnZeroExitCode "git --version" | Should -ReturnZeroExitCode

View File

@@ -1,4 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
Describe "Haskell" -Skip:($os.IsVentura -or $os.IsSonoma) { Describe "Haskell" -Skip:($os.IsVentura -or $os.IsSonoma) {

View File

@@ -1,11 +1,6 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
# Validates that tool is installed and in PATH function Confirm-ArrayWithoutDuplicates {
function Validate-ToolExist($tool) {
Get-Command $tool -ErrorAction SilentlyContinue | Should -BeTrue
}
function Validate-ArrayWithoutDuplicates {
param ( param (
[AllowEmptyCollection()] [AllowEmptyCollection()]
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
@@ -19,7 +14,7 @@ function Validate-ArrayWithoutDuplicates {
} }
} }
function Validate-Url { function Confirm-UrlAvailability {
param ( param (
[Parameter(Mandatory)] [Parameter(Mandatory)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -37,7 +32,7 @@ function Validate-Url {
$result | Should -BeTrue -Because "'$Url' should be available, but it is not" $result | Should -BeTrue -Because "'$Url' should be available, but it is not"
} }
function Validate-IdenticalFileContent { function Confirm-IdenticalFileContent {
param ( param (
[Parameter(Mandatory)] [Parameter(Mandatory)]
[string] $File1, [string] $File1,
@@ -65,8 +60,7 @@ function ShouldReturnZeroExitCode {
[bool]$succeeded = $result.ExitCode -eq 0 [bool]$succeeded = $result.ExitCode -eq 0
if ($Negate) { $succeeded = -not $succeeded } if ($Negate) { $succeeded = -not $succeeded }
if (-not $succeeded) if (-not $succeeded) {
{
$commandOutputIndent = " " * 4 $commandOutputIndent = " " * 4
$commandOutput = ($result.Output | ForEach-Object { "${commandOutputIndent}${_}" }) -join "`n" $commandOutput = ($result.Output | ForEach-Object { "${commandOutputIndent}${_}" }) -join "`n"
$failureMessage = "Command '${ActualValue}' has finished with exit code ${actualExitCode}`n${commandOutput}" $failureMessage = "Command '${ActualValue}' has finished with exit code ${actualExitCode}`n${commandOutput}"

View File

@@ -14,7 +14,7 @@ function Get-NativeVersionFormat {
Describe "Java" { Describe "Java" {
BeforeAll { BeforeAll {
function Validate-JavaVersion { function Confirm-JavaVersion {
param($JavaCommand, $ExpectedVersion) param($JavaCommand, $ExpectedVersion)
$commandResult = Get-CommandResult $JavaCommand $commandResult = Get-CommandResult $JavaCommand
@@ -26,7 +26,7 @@ Describe "Java" {
} }
} }
$toolsetJava = Get-ToolsetValue "java" $toolsetJava = (Get-ToolsetContent).java
$defaultVersion = $toolsetJava.$arch.default $defaultVersion = $toolsetJava.$arch.default
$jdkVersions = $toolsetJava.$arch.versions $jdkVersions = $toolsetJava.$arch.versions
@@ -44,14 +44,14 @@ Describe "Java" {
} }
It "Java <Version>" -TestCases $_ { It "Java <Version>" -TestCases $_ {
$envVariablePath = Get-EnvironmentVariable $EnvVariable $envVariablePath = [System.Environment]::GetEnvironmentVariable($EnvVariable)
$javaBinPath = Join-Path $envVariablePath "/bin/java" $javaBinPath = Join-Path $envVariablePath "/bin/java"
Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version Confirm-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version
} }
if ($_.Title -eq "Default") { if ($_.Title -eq "Default") {
It "Version is default" -TestCases $_ { It "Version is default" -TestCases $_ {
Validate-JavaVersion -JavaCommand "java -version" -ExpectedVersion $Version Confirm-JavaVersion -JavaCommand "java -version" -ExpectedVersion $Version
} }
} }
} }

View File

@@ -2,7 +2,7 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Describe "Clang/LLVM" { Describe "Clang/LLVM" {
BeforeAll { BeforeAll {
$toolsetVersion = Get-ToolsetValue 'llvm.version' $toolsetVersion = (Get-ToolsetContent).llvm.version
} }
It "Clang/LLVM <toolsetVersion> is installed and version is correct" { It "Clang/LLVM <toolsetVersion> is installed and version is correct" {

View File

@@ -9,7 +9,7 @@ Describe "Node.js" {
} }
It "Node.js version should correspond to the version in the toolset" { It "Node.js version should correspond to the version in the toolset" {
node --version | Should -BeLike "v$(Get-ToolsetValue 'node.default')*" node --version | Should -BeLike "v$((Get-ToolsetContent).node.default)*"
} }
It "NPM is installed" { It "NPM is installed" {
@@ -33,7 +33,7 @@ Describe "nvm" -Skip:($os.IsVentura -or $os.IsSonoma) {
} }
Context "nvm versions" { Context "nvm versions" {
[array]$nvmVersions = Get-ToolsetValue 'node.nvm_versions' [array]$nvmVersions = (Get-ToolsetContent).node.nvm_versions
$testCases = $nvmVersions | ForEach-Object { @{NvmVersion = $_} } $testCases = $nvmVersions | ForEach-Object { @{NvmVersion = $_} }
It "<NvmVersion>" -TestCases $testCases { It "<NvmVersion>" -TestCases $testCases {
@@ -47,7 +47,7 @@ Describe "nvm" -Skip:($os.IsVentura -or $os.IsSonoma) {
} }
Describe "Global NPM Packages" { Describe "Global NPM Packages" {
$globalNpmPackages = Get-ToolsetValue "npm.global_packages" $globalNpmPackages = (Get-ToolsetContent).npm.global_packages
$globalNpmPackagesWithTests = $globalNpmPackages | Where-Object { $_.test } | ForEach-Object { @{ Name = $_.name; Test = $_.test } } $globalNpmPackagesWithTests = $globalNpmPackages | Where-Object { $_.test } | ForEach-Object { @{ Name = $_.name; Test = $_.test } }
It "<Name>" -TestCases $globalNpmPackagesWithTests { It "<Name>" -TestCases $globalNpmPackagesWithTests {

View File

@@ -1,13 +1,14 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
Describe "PHP" { Describe "PHP" {
Context "PHP" -Skip:($os.IsVenturaArm64 -or $os.IsSonomaArm64) { Context "PHP" -Skip:($os.IsVenturaArm64 -or $os.IsSonomaArm64) {
It "PHP Path" { It "PHP Path" {
Get-WhichTool "php" | Should -Not -BeLike "/usr/bin/php*" Get-ToolPath "php" | Should -Not -BeLike "/usr/bin/php*"
} }
It "PHP version" { It "PHP version" {
$phpVersionToolset = Get-ToolsetValue 'php.version' $phpVersionToolset = (Get-ToolsetContent).php.version
$phpInstalledVersion = php --version | Out-String | Select-String "${phpVersionToolset}" $phpInstalledVersion = php --version | Out-String | Select-String "${phpVersionToolset}"
$phpInstalledVersion | Should -BeLike "PHP ${phpVersionToolset}*" $phpInstalledVersion | Should -BeLike "PHP ${phpVersionToolset}*"
} }

View File

@@ -4,7 +4,7 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
Describe "PipxPackages" -Skip:($os.IsVentura -or $os.IsSonoma) { Describe "PipxPackages" -Skip:($os.IsVentura -or $os.IsSonoma) {
$pipxToolset = Get-ToolsetValue "pipx" $pipxToolset = (Get-ToolsetContent).pipx
$testCases = $pipxToolset | ForEach-Object { @{package = $_.package; cmd = $_.cmd} } $testCases = $pipxToolset | ForEach-Object { @{package = $_.package; cmd = $_.cmd} }
It "<package>" -TestCases $testCases { It "<package>" -TestCases $testCases {
"$cmd" | Should -ReturnZeroExitCode "$cmd" | Should -ReturnZeroExitCode

View File

@@ -9,7 +9,7 @@ Describe "Powershell" {
} }
Context "Powershell Modules" { Context "Powershell Modules" {
$modules = Get-ToolsetValue powershellModules $modules = (Get-ToolsetContent).powershellModules
$withoutVersionsModules = $modules | Where-Object {-not $_.versions} | ForEach-Object { $withoutVersionsModules = $modules | Where-Object {-not $_.versions} | ForEach-Object {
@{moduleName = $_.name} @{moduleName = $_.name}
} }

View File

@@ -9,7 +9,7 @@ Describe "Python3" -Skip:($os.IsVenturaArm64 -or $os.IsSonomaArm64) {
} }
It "Python 3 is installed under /usr/local/bin" { It "Python 3 is installed under /usr/local/bin" {
Get-WhichTool "python3" | Should -BeLike "/usr/local/bin*" Get-ToolPath "python3" | Should -BeLike "/usr/local/bin*"
} }
It "Pip 3 is available" { It "Pip 3 is available" {

View File

@@ -9,14 +9,14 @@ Describe "Ruby" -Skip:(-not $os.IsArm64) {
} }
It "Ruby is installed via HomeBrew" { It "Ruby is installed via HomeBrew" {
Get-WhichTool "ruby" | Should -Not -BeLike "/usr/bin/ruby*" Get-ToolPath "ruby" | Should -Not -BeLike "/usr/bin/ruby*"
} }
It "Ruby tools are consistent" { It "Ruby tools are consistent" {
$expectedPrefix = "/opt/homebrew" $expectedPrefix = "/opt/homebrew"
Get-WhichTool "ruby" | Should -Match "$($expectedPrefix)*" Get-ToolPath "ruby" | Should -Match "$($expectedPrefix)*"
Get-WhichTool "gem" | Should -Match "$($expectedPrefix)*" Get-ToolPath "gem" | Should -Match "$($expectedPrefix)*"
Get-WhichTool "bundler" | Should -Match "$($expectedPrefix)*" Get-ToolPath "bundler" | Should -Match "$($expectedPrefix)*"
} }
It "Ruby gems permissions are valid" { It "Ruby gems permissions are valid" {

View File

@@ -9,14 +9,14 @@ Describe "Ruby" -Skip:($os.IsArm64) {
} }
It "Ruby is installed via HomeBrew" { It "Ruby is installed via HomeBrew" {
Get-WhichTool "ruby" | Should -Not -BeLike "/usr/bin/ruby*" Get-ToolPath "ruby" | Should -Not -BeLike "/usr/bin/ruby*"
} }
It "Ruby tools are consistent" { It "Ruby tools are consistent" {
$expectedPrefix = "/usr/local" $expectedPrefix = "/usr/local"
Get-WhichTool "ruby" | Should -Match "$($expectedPrefix)*" Get-ToolPath "ruby" | Should -Match "$($expectedPrefix)*"
Get-WhichTool "gem" | Should -Match "$($expectedPrefix)*" Get-ToolPath "gem" | Should -Match "$($expectedPrefix)*"
Get-WhichTool "bundler" | Should -Match "$($expectedPrefix)*" Get-ToolPath "bundler" | Should -Match "$($expectedPrefix)*"
} }
It "Ruby gems permissions are valid" { It "Ruby gems permissions are valid" {

View File

@@ -1,13 +1,13 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
Describe "RubyGems" { Describe "RubyGems" {
$gemTestCases = Get-ToolsetValue -KeyPath "ruby.rubygems" | ForEach-Object { $gemTestCases = (Get-ToolsetContent).ruby.rubygems | ForEach-Object {
@{gemName = $_} @{gemName = $_}
} }
if ($gemTestCases) if ($gemTestCases) {
{
It "Gem <gemName> is installed" -TestCases $gemTestCases { It "Gem <gemName> is installed" -TestCases $gemTestCases {
"gem list -i '^$gemName$'" | Should -MatchCommandOutput "true" "gem list -i '^$gemName$'" | Should -MatchCommandOutput "true"
} }

View File

@@ -1,4 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
Describe "Rust" { Describe "Rust" {

View File

@@ -6,7 +6,7 @@ $os = Get-OSVersion
Describe "Toolcache" { Describe "Toolcache" {
$toolcacheDirectory = Join-Path $env:HOME "hostedtoolcache" $toolcacheDirectory = Join-Path $env:HOME "hostedtoolcache"
[array]$packages += Get-ToolsetValue -KeyPath "toolcache" | ForEach-Object { [array]$packages += (Get-ToolsetContent).toolcache | ForEach-Object {
return [PSCustomObject] @{ return [PSCustomObject] @{
ToolName = ($_.name).ToLower() ToolName = ($_.name).ToLower()
Arch = $arch Arch = $arch

View File

@@ -39,83 +39,82 @@ $toolsets | ForEach-Object {
It "Version '$vsmacVersion' is available and can be downloaded" { It "Version '$vsmacVersion' is available and can be downloaded" {
$vsmacUrl = Invoke-BashUtilsFunction("buildVSMacDownloadUrl", $vsmacVersion) $vsmacUrl = Invoke-BashUtilsFunction("buildVSMacDownloadUrl", $vsmacVersion)
Validate-Url $vsmacUrl Confirm-UrlAvailability $vsmacUrl
} }
} }
Context "Mono" { Context "Mono" {
$sdkVersions = $toolset.xamarin."mono-versions" $sdkVersions = $toolset.xamarin.mono_versions
$sdkVersions | ForEach-Object { $sdkVersions | ForEach-Object {
It "Version '$_' is available and can be downloaded" { It "Version '$_' is available and can be downloaded" {
$sdkUrl = Invoke-BashUtilsFunction("buildMonoDownloadUrl", $_) $sdkUrl = Invoke-BashUtilsFunction("buildMonoDownloadUrl", $_)
Validate-Url $sdkUrl Confirm-UrlAvailability $sdkUrl
} }
} }
It "Version list doesn't contain versions with the same major/minor version" { It "Version list doesn't contain versions with the same major/minor version" {
$versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ } $versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ }
Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor" Confirm-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor"
} }
} }
Context "Xamarin.iOS" { Context "Xamarin.iOS" {
$sdkVersions = $toolset.xamarin."ios-versions" $sdkVersions = $toolset.xamarin.ios_versions
$sdkVersions | ForEach-Object { $sdkVersions | ForEach-Object {
It "Version '$_' is available and can be downloaded" { It "Version '$_' is available and can be downloaded" {
$sdkUrl = Invoke-BashUtilsFunction("buildXamariniIOSDownloadUrl", $_) $sdkUrl = Invoke-BashUtilsFunction("buildXamariniIOSDownloadUrl", $_)
Validate-Url $sdkUrl Confirm-UrlAvailability $sdkUrl
} }
} }
It "Version list doesn't contain versions with the same major/minor version" { It "Version list doesn't contain versions with the same major/minor version" {
$versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ } $versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ }
Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor" Confirm-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor"
} }
} }
Context "Xamarin.Mac" { Context "Xamarin.Mac" {
$sdkVersions = $toolset.xamarin."mac-versions" $sdkVersions = $toolset.xamarin.mac_versions
$sdkVersions | ForEach-Object { $sdkVersions | ForEach-Object {
It "Version '$_' is available and can be downloaded" { It "Version '$_' is available and can be downloaded" {
$sdkUrl = Invoke-BashUtilsFunction("buildXamarinMacDownloadUrl", $_) $sdkUrl = Invoke-BashUtilsFunction("buildXamarinMacDownloadUrl", $_)
Validate-Url $sdkUrl Confirm-UrlAvailability $sdkUrl
} }
} }
It "Version list doesn't contain versions with the same major/minor version" { It "Version list doesn't contain versions with the same major/minor version" {
$versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ } $versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ }
Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor" Confirm-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor"
} }
} }
Context "Xamarin.Android" { Context "Xamarin.Android" {
$sdkVersions = $toolset.xamarin."android-versions" $sdkVersions = $toolset.xamarin.android_versions
$sdkVersions | ForEach-Object { $sdkVersions | ForEach-Object {
It "Version '$_' is available and can be downloaded" { It "Version '$_' is available and can be downloaded" {
$sdkUrl = Invoke-BashUtilsFunction("buildXamarinAndroidDownloadUrl", $_) $sdkUrl = Invoke-BashUtilsFunction("buildXamarinAndroidDownloadUrl", $_)
Validate-Url $sdkUrl Confirm-UrlAvailability $sdkUrl
} }
} }
It "Version list doesn't contain versions with the same major/minor version" { It "Version list doesn't contain versions with the same major/minor version" {
$versions = $sdkVersions | ForEach-Object { $_.Replace("-", ".") } | ForEach-Object { Get-ShortVersion $_ } $versions = $sdkVersions | ForEach-Object { $_.Replace("-", ".") } | ForEach-Object { Get-ShortVersion $_ }
Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor" Confirm-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor"
} }
} }
Context "Xamarin bundles" { Context "Xamarin bundles" {
$monoVersions = $toolset.xamarin."mono-versions" | ForEach-Object { Get-ShortVersion $_ } $monoVersions = $toolset.xamarin.mono_versions | ForEach-Object { Get-ShortVersion $_ }
$iOSVersions = $toolset.xamarin."ios-versions" | ForEach-Object { Get-ShortVersion $_ } $iOSVersions = $toolset.xamarin.ios_versions | ForEach-Object { Get-ShortVersion $_ }
$macVersions = $toolset.xamarin."mac-versions" | ForEach-Object { Get-ShortVersion $_ } $macVersions = $toolset.xamarin.mac_versions | ForEach-Object { Get-ShortVersion $_ }
# Old Xamarin.Android version looks like "9.0.0-18" that doesn't support by System.Version # Old Xamarin.Android version looks like "9.0.0-18" that doesn't support by System.Version
$androidVersions = $toolset.xamarin."android-versions" | ForEach-Object { Get-ShortVersion $_.Replace("-", ".") } $androidVersions = $toolset.xamarin.android_versions | ForEach-Object { Get-ShortVersion $_.Replace("-", ".") }
$bundles = $toolset.xamarin.bundles $bundles = $toolset.xamarin.bundles
$bundles | ForEach-Object { $bundles | ForEach-Object {
It "'$($_.symlink)' is valid" { It "'$($_.symlink)' is valid" {
$monoVersions | Should -Contain $_.mono $monoVersions | Should -Contain $_.mono
@@ -127,18 +126,16 @@ $toolsets | ForEach-Object {
It "Each bundle has unique symlink" { It "Each bundle has unique symlink" {
$symlinks = $bundles | ForEach-Object { $_.symlink } $symlinks = $bundles | ForEach-Object { $_.symlink }
Validate-ArrayWithoutDuplicates $symlinks -Because "Bundle symlinks should be unique" Confirm-ArrayWithoutDuplicates $symlinks -Because "Bundle symlinks should be unique"
} }
It "Current bundle is valid" { It "Current bundle is valid" {
$currentBundleSymlink = $toolset.xamarin."bundle-default" $currentBundleSymlink = $toolset.xamarin.bundle_default
if ($currentBundleSymlink -ne "latest") { if ($currentBundleSymlink -ne "latest") {
$bundleSymlinks = $bundles | ForEach-Object { $_.symlink } $bundleSymlinks = $bundles | ForEach-Object { $_.symlink }
$bundleSymlinks | Should -Contain $currentBundleSymlink -Because "Current bundle should be installed" $bundleSymlinks | Should -Contain $currentBundleSymlink -Because "Current bundle should be installed"
} }
}
}
} }
} }
} }

View File

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

View File

@@ -2,14 +2,20 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1"
Import-Module "$PSScriptRoot/Helpers.psm1" -DisableNameChecking Import-Module "$PSScriptRoot/Helpers.psm1" -DisableNameChecking
$ARCH = Get-Architecture $arch = Get-Architecture
$xcodeVersions = Get-ToolsetValue "xcode.$ARCH.versions" $xcodeVersions = (Get-ToolsetContent).xcode.${arch}.versions
$defaultXcode = Get-ToolsetValue "xcode.default" $defaultXcode = (Get-ToolsetContent).xcode.default
$latestXcodeVersion = $xcodeVersions | Select-Object -First 1 $latestXcodeVersion = $xcodeVersions | Select-Object -First 1
$os = Get-OSVersion $os = Get-OSVersion
Describe "Xcode" { Describe "Xcode" {
$testCases = $xcodeVersions | ForEach-Object { @{ XcodeVersion = $_.link; LatestXcodeVersion = $xcodeVersions[0].link; Symlinks = $_.symlinks } } $testCases = $xcodeVersions | ForEach-Object {
@{
XcodeVersion = $_.link;
LatestXcodeVersion = $xcodeVersions[0].link;
Symlinks = $_.symlinks
}
}
Context "Versions" { Context "Versions" {
It "<XcodeVersion>" -TestCases $testCases { It "<XcodeVersion>" -TestCases $testCases {
@@ -82,7 +88,7 @@ Describe "XCODE_DEVELOPER_DIR variables" {
It "XCODE_<MajorVersion>_DEVELOPER_DIR" -TestCases $testCases { It "XCODE_<MajorVersion>_DEVELOPER_DIR" -TestCases $testCases {
$variableName = "XCODE_${MajorVersion}_DEVELOPER_DIR" $variableName = "XCODE_${MajorVersion}_DEVELOPER_DIR"
$actualPath = Get-EnvironmentVariable $variableName $actualPath = [System.Environment]::GetEnvironmentVariable($variableName)
$expectedVersion = $VersionsList | Where-Object { $_.Version.Major -eq $MajorVersion } | Select-Object -First 1 $expectedVersion = $VersionsList | Where-Object { $_.Version.Major -eq $MajorVersion } | Select-Object -First 1
$expectedPath = "$($expectedVersion.RootPath)/Contents/Developer" $expectedPath = "$($expectedVersion.RootPath)/Contents/Developer"
$actualPath | Should -Exist $actualPath | Should -Exist
@@ -99,21 +105,13 @@ Describe "Xcode simulators" {
[array]$devicesList = @(Get-XcodeDevicesList | Where-Object { $_ }) [array]$devicesList = @(Get-XcodeDevicesList | Where-Object { $_ })
Write-Host "Devices for $XcodeVersion" Write-Host "Devices for $XcodeVersion"
Write-Host ($devicesList -join "`n") Write-Host ($devicesList -join "`n")
Validate-ArrayWithoutDuplicates $devicesList -Because "Found duplicate device simulators" Confirm-ArrayWithoutDuplicates $devicesList -Because "Found duplicate device simulators"
} }
# It "No duplicates in pairs" -TestCases $testCase {
# Switch-Xcode -Version $XcodeVersion
# [array]$pairsList = @(Get-XcodePairsList | Where-Object { $_ })
# Write-Host "Pairs for $XcodeVersion"
# Write-Host ($pairsList -join "`n")
# Validate-ArrayWithoutDuplicates $pairsList -Because "Found duplicate pairs simulators"
# }
} }
} }
AfterEach { AfterEach {
$defaultXcode = Get-ToolsetValue "xcode.default" $defaultXcode = (Get-ToolsetContent).xcode.default
Switch-Xcode -Version $defaultXcode Switch-Xcode -Version $defaultXcode
} }
} }

View File

@@ -1,5 +1,7 @@
# Toolset JSON structure # Toolset JSON structure
## Xcode ## Xcode
- `versions` - the array of objects that will present installed Xcode versions - `versions` - the array of objects that will present installed Xcode versions
- `link` property points to the place where Xcode will be located on image. `/Applications/Xcode_<link>.app` - `link` property points to the place where Xcode will be located on image. `/Applications/Xcode_<link>.app`
- `version` points to Xcode version that will be downloaded and installed - `version` points to Xcode version that will be downloaded and installed
@@ -8,6 +10,7 @@
**Example:** `"11.2"` **Example:** `"11.2"`
**Note:** **Note:**
- If `version` is specified with spaces, it is considered as exact Xcode name like `12.1.1 Release Candidate`. - If `version` is specified with spaces, it is considered as exact Xcode name like `12.1.1 Release Candidate`.
- If `version` doesn't contain spaces, the latest version will be resolved with the following priority: - If `version` doesn't contain spaces, the latest version will be resolved with the following priority:
- stable version like `12.1` - stable version like `12.1`
@@ -16,7 +19,8 @@
- beta version like `12.1 beta N` (the latest N will be chosen) - beta version like `12.1 beta N` (the latest N will be chosen)
**Example:** **Example:**
```
```json
"versions": [ "versions": [
{ "link": "12.2", "version": "12.2.0" }, { "link": "12.2", "version": "12.2.0" },
{ "link": "11.7", "version": "11.7.0", "symlinks": ["11.7_beta"] } { "link": "11.7", "version": "11.7.0", "symlinks": ["11.7_beta"] }
@@ -24,27 +28,26 @@
``` ```
## Xamarin ## Xamarin
- `vsmac` - version of Visual Studio For Mac to install. - `vsmac` - version of Visual Studio For Mac to install.
**Example:** `"8.3.11.1"` **Example:** `"8.3.11.1"`
- `mono-versions` - the array of Mono versions to install. - `mono_versions` - the array of Mono versions to install.
**Example:** `[ "6.4.0.208", "6.0.0.334" ]` **Example:** `[ "6.4.0.208", "6.0.0.334" ]`
- `ios-versions` - the array of Xamarin iOS versions to install. - `ios_versions` - the array of Xamarin iOS versions to install.
**Example:** `[ "13.6.0.12", "13.4.0.2", "13.2.0.47" ]` **Example:** `[ "13.6.0.12", "13.4.0.2", "13.2.0.47" ]`
- `mac-versions` - the array of Xamarin iOS versions to install. - `mac_versions` - the array of Xamarin iOS versions to install.
**Example:** `[ "6.6.0.12", "6.4.0.2", "6.2.0.47" ]` **Example:** `[ "6.6.0.12", "6.4.0.2", "6.2.0.47" ]`
- `android-versions` - the array of Xamarin iOS versions to install. - `android_versions` - the array of Xamarin iOS versions to install.
**Example:** `[ "10.0.6.2", "9.4.1.0" ]` **Example:** `[ "10.0.6.2", "9.4.1.0" ]`
**Note:** More than one version of SDK with the same major.minor version should not be installed. It applies to `mono-versions`, `ios-versions`, `mac-versions`, `android-versions` fields. **Note:** More than one version of SDK with the same major.minor version should not be installed. It applies to `mono_versions`, `ios_versions`, `mac_versions`, `android_versions` fields.
For example, if Mono `6.4.0.100` is installed and Mono `6.4.1.2` was released recently, we should not install both, just update `6.4.0.100` -> `6.4.1.2`. Only major and minor version changes can break backward compatibility so it is safe. For example, if Mono `6.4.0.100` is installed and Mono `6.4.1.2` was released recently, we should not install both, just update `6.4.0.100` -> `6.4.1.2`. Only major and minor version changes can break backward compatibility so it is safe.
<br> - `bundle_default` - the symlink of the bundle that will be set as default on the image.
- `bundle-default` - the symlink of the bundle that will be set as default on the image.
This bundle will be set as `Current`. This bundle will be set as `Current`.
**Example:** `"5_12_0"` (set bundle with symlink `5_12_0` as default) **Example:** `"5_12_0"` (set bundle with symlink `5_12_0` as default)
**Example:** `"latest"` (set latest bundle as default) **Example:** `"latest"` (set latest bundle as default)
@@ -59,9 +62,9 @@ The first bundle in the list will be as `Latest`.
- `mac` - version of Xamarin.Mac that will be set in this bundle. Only two numbers (`major.minor`) should be specified. - `mac` - version of Xamarin.Mac that will be set in this bundle. Only two numbers (`major.minor`) should be specified.
- `android` - version of Xamarin.Android that will be set in this bundle. Only two numbers (`major.minor`) should be specified. - `android` - version of Xamarin.Android that will be set in this bundle. Only two numbers (`major.minor`) should be specified.
**Example:** **Example:**
```
```json
[ [
{ {
"symlink": "6_4_2", "symlink": "6_4_2",
@@ -81,19 +84,20 @@ The first bundle in the list will be as `Latest`.
``` ```
## Android ## Android
- `platform-list` - the array of android platforms to install. - `platform-list` - the array of android platforms to install.
**Example:** `[ "android-29", "android-28", "android-27" ]` **Example:** `[ "android-29", "android-28", "android-27" ]`
- `build-tools` - the array of android build tools to install. - `build-tools` - the array of android build tools to install.
**Example:** `[ "29.0.2", "29.0.1", "29.0.0", "28.0.3" ]` **Example:** `[ "29.0.2", "29.0.1", "29.0.0", "28.0.3" ]`
- `extra-list` - the array of android extra items to install. - `extras` - the array of android extra items to install.
**Example:** `[ "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager" ]` **Example:** `[ "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager" ]`
- `addon-list` - the array of android addons to install. - `addons` - the array of android addons to install.
**Example:** `[ "addon-google_apis-google-24", "addon-google_apis-google-23" ]` **Example:** `[ "addon-google_apis-google-24", "addon-google_apis-google-23" ]`
## Toolset JSON validation
# Toolset JSON validation
File `Toolset.Tests.ps1` contains PowerShell [Pester](https://github.com/Pester/Pester) tests that validate JSON toolset files. File `Toolset.Tests.ps1` contains PowerShell [Pester](https://github.com/Pester/Pester) tests that validate JSON toolset files.
Type `Invoke-Pester` in the current folder in PowerShell to run tests. Type `Invoke-Pester` in the current folder in PowerShell to run tests.

View File

@@ -17,19 +17,19 @@
"default": "2022", "default": "2022",
"versions": [ "2019", "2022" ] "versions": [ "2019", "2022" ]
}, },
"mono-versions": [ "mono_versions": [
"6.12.0.188" "6.12.0.188"
], ],
"ios-versions": [ "ios_versions": [
"15.8.0.3", "15.6.0.3", "15.4.0.0", "15.2.0.17", "15.0.0.6", "14.20.0.24", "14.16.0.5", "14.14.2.5", "14.10.0.4", "14.8.0.3", "14.6.0.15", "14.4.1.3", "14.2.0.12", "14.0.0.0", "13.20.2.2" "15.8.0.3", "15.6.0.3", "15.4.0.0", "15.2.0.17", "15.0.0.6", "14.20.0.24", "14.16.0.5", "14.14.2.5", "14.10.0.4", "14.8.0.3", "14.6.0.15", "14.4.1.3", "14.2.0.12", "14.0.0.0", "13.20.2.2"
], ],
"mac-versions": [ "mac_versions": [
"8.8.0.3", "8.6.0.3", "8.4.0.0", "8.2.0.17", "7.14.0.27", "7.10.0.5", "7.8.2.5", "7.4.0.10", "7.2.0.3", "7.0.0.15", "6.22.1.26", "6.20.2.2" "8.8.0.3", "8.6.0.3", "8.4.0.0", "8.2.0.17", "7.14.0.27", "7.10.0.5", "7.8.2.5", "7.4.0.10", "7.2.0.3", "7.0.0.15", "6.22.1.26", "6.20.2.2"
], ],
"android-versions": [ "android_versions": [
"12.2.8.3", "12.1.0.2", "12.0.0.3", "11.3.0.4", "11.2.2.1", "11.1.0.26", "11.0.2.0" "12.2.8.3", "12.1.0.2", "12.0.0.3", "11.3.0.4", "11.2.2.1", "11.1.0.26", "11.0.2.0"
], ],
"bundle-default": "6_12_12", "bundle_default": "6_12_12",
"bundles": [ "bundles": [
{ {
"symlink": "6_12_16", "symlink": "6_12_16",
@@ -162,11 +162,11 @@
"cmdline-tools": "commandlinetools-mac-9123335_latest.zip", "cmdline-tools": "commandlinetools-mac-9123335_latest.zip",
"platform_min_version": "27", "platform_min_version": "27",
"build_tools_min_version": "27.0.0", "build_tools_min_version": "27.0.0",
"extra-list": [ "extras": [
"android;m2repository", "google;m2repository", "google;google_play_services" "android;m2repository", "google;m2repository", "google;google_play_services"
], ],
"addon-list": [], "addons": [],
"additional-tools": [ "additional_tools": [
"cmake;3.10.2.4988404", "cmake;3.10.2.4988404",
"cmake;3.18.1", "cmake;3.18.1",
"cmake;3.22.1" "cmake;3.22.1"

View File

@@ -18,19 +18,19 @@
"default": "2022", "default": "2022",
"versions": [ "2019", "2022" ] "versions": [ "2019", "2022" ]
}, },
"mono-versions": [ "mono_versions": [
"6.12.0.188" "6.12.0.188"
], ],
"ios-versions": [ "ios_versions": [
"16.2.0.5", "16.1.1.27", "16.0.0.72", "15.12.0.2", "15.10.0.5", "15.8.0.3", "15.6.0.3", "15.4.0.0", "15.2.0.17", "15.0.0.6" "16.2.0.5", "16.1.1.27", "16.0.0.72", "15.12.0.2", "15.10.0.5", "15.8.0.3", "15.6.0.3", "15.4.0.0", "15.2.0.17", "15.0.0.6"
], ],
"mac-versions": [ "mac_versions": [
"9.1.0.5", "9.0.0.27", "8.12.0.2", "8.10.0.5", "8.8.0.3", "8.6.0.3", "8.4.0.0", "8.2.0.17", "7.14.0.27" "9.1.0.5", "9.0.0.27", "8.12.0.2", "8.10.0.5", "8.8.0.3", "8.6.0.3", "8.4.0.0", "8.2.0.17", "7.14.0.27"
], ],
"android-versions": [ "android_versions": [
"13.2.1.2", "13.1.0.1", "13.0.0.0", "12.3.3.3", "12.2.8.3", "12.1.0.2", "12.0.0.3", "11.3.0.4" "13.2.1.2", "13.1.0.1", "13.0.0.0", "12.3.3.3", "12.2.8.3", "12.1.0.2", "12.0.0.3", "11.3.0.4"
], ],
"bundle-default": "6_12_21", "bundle_default": "6_12_21",
"bundles": [ "bundles": [
{ {
"symlink": "6_12_24", "symlink": "6_12_24",
@@ -149,11 +149,11 @@
"cmdline-tools": "commandlinetools-mac-9123335_latest.zip", "cmdline-tools": "commandlinetools-mac-9123335_latest.zip",
"platform_min_version": "27", "platform_min_version": "27",
"build_tools_min_version": "27.0.0", "build_tools_min_version": "27.0.0",
"extra-list": [ "extras": [
"android;m2repository", "google;m2repository", "google;google_play_services" "android;m2repository", "google;m2repository", "google;google_play_services"
], ],
"addon-list": [], "addons": [],
"additional-tools": [ "additional_tools": [
"cmake;3.18.1", "cmake;3.18.1",
"cmake;3.22.1" "cmake;3.22.1"
], ],

View File

@@ -33,11 +33,11 @@
"sdk-tools": "sdk-tools-darwin-4333796.zip", "sdk-tools": "sdk-tools-darwin-4333796.zip",
"platform_min_version": "33", "platform_min_version": "33",
"build_tools_min_version": "33.0.2", "build_tools_min_version": "33.0.2",
"extra-list": [ "extras": [
"android;m2repository", "google;m2repository", "google;google_play_services" "android;m2repository", "google;m2repository", "google;google_play_services"
], ],
"addon-list": [], "addons": [],
"additional-tools": [ "additional_tools": [
"cmake;3.22.1" "cmake;3.22.1"
], ],
"ndk": { "ndk": {

View File

@@ -29,11 +29,11 @@
"sdk-tools": "sdk-tools-darwin-4333796.zip", "sdk-tools": "sdk-tools-darwin-4333796.zip",
"platform_min_version": "33", "platform_min_version": "33",
"build_tools_min_version": "33.0.2", "build_tools_min_version": "33.0.2",
"extra-list": [ "extras": [
"android;m2repository", "google;m2repository", "google;google_play_services" "android;m2repository", "google;m2repository", "google;google_play_services"
], ],
"addon-list": [], "addons": [],
"additional-tools": [ "additional_tools": [
"cmake;3.22.1" "cmake;3.22.1"
], ],
"ndk": { "ndk": {