mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 04:37:09 +00:00
* Move installation to toolcache folder * Change Set-JavaPath function * remove old java report function * Change report function to output full semver * small improvments * nitpicks + remove java root path * Adoptium -> Adopt
21 lines
687 B
PowerShell
21 lines
687 B
PowerShell
function Get-JavaVersions {
|
|
$defaultJavaPath = $env:JAVA_HOME
|
|
$javaVersions = Get-Item env:JAVA_HOME_*_X64
|
|
$sortRules = @{
|
|
Expression = { [Int32]$_.Name.Split("_")[2] }
|
|
Descending = $false
|
|
}
|
|
|
|
return $javaVersions | Sort-Object $sortRules | ForEach-Object {
|
|
$javaPath = $_.Value
|
|
# Take semver from the java path
|
|
$version = (Split-Path $javaPath) -replace "\w:\\.*\\"
|
|
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
|
|
|
|
[PSCustomObject] @{
|
|
"Version" = $version + $defaultPostfix
|
|
"Vendor" = "AdoptOpenJDK"
|
|
"Environment Variable" = $_.Name
|
|
}
|
|
}
|
|
} |