mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 22:26:56 +00:00
[MacOS] Move preinstalled java distributions to the toolcache directory (#2883)
* Move java to the toolcache * resolved comments * added sudo for ln command * fixed versions and added symlink * fixed openjdk.sh * fixed typo * updated SoftwareReport * fixed SoftwareReport * fixed SoftwareReport * fixed tool name Co-authored-by: Nikita Bykov <v-nibyko@microsoft.com>
This commit is contained in:
@@ -1,12 +1,3 @@
|
||||
function Get-JavaFullVersion {
|
||||
param($JavaRootPath)
|
||||
|
||||
$javaBinPath = Join-Path $javaRootPath "/bin/java"
|
||||
$javaVersionOutput = (Get-CommandResult "$javaBinPath -version").Output
|
||||
$matchResult = $javaVersionOutput | Select-String '^openjdk version \"([\d\._]+)\"'
|
||||
return $matchResult.Matches.Groups[1].Value
|
||||
}
|
||||
|
||||
function Get-JavaVersions {
|
||||
$defaultJavaPath = Get-Item env:JAVA_HOME
|
||||
$javaVersions = Get-Item env:JAVA_HOME_*_X64
|
||||
@@ -17,12 +8,13 @@ function Get-JavaVersions {
|
||||
|
||||
return $javaVersions | Sort-Object $sortRules | ForEach-Object {
|
||||
$javaPath = $_.Value
|
||||
$version = Get-JavaFullVersion $javaPath
|
||||
# Take semver from the java path
|
||||
$version = $javaPath.split('/')[5]
|
||||
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
|
||||
|
||||
[PSCustomObject] @{
|
||||
"Version" = $version + $defaultPostfix
|
||||
"Vendor" = "AdoptOpenJDK"
|
||||
"Vendor" = "Adopt OpenJDK"
|
||||
"Environment Variable" = $_.Name
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user