mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 12:48:18 +00:00
[Windows] Add JAVA section to docs. (#2467)
* [macOS] Fail Pester tests on error * return it back * git pus * added fix for java docs * changed java place
This commit is contained in:
@@ -6,6 +6,7 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Common.psm1") -DisableNam
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Databases.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.VisualStudio.psm1") -DisableNameChecking
|
||||
|
||||
$markdown = ""
|
||||
@@ -32,7 +33,6 @@ $markdown += New-MDHeader "Language and Runtime" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines (@(
|
||||
(Get-BashVersion),
|
||||
(Get-GoVersion),
|
||||
(Get-JavaVersionsList -DefaultVersion "1.8.0")
|
||||
(Get-JuliaVersion),
|
||||
(Get-NodeVersion),
|
||||
(Get-PerlVersion),
|
||||
@@ -148,6 +148,10 @@ $markdown += New-MDList -Style Unordered -Lines @(
|
||||
(Get-SeleniumWebDriverVersion -Driver "iexplorer")
|
||||
)
|
||||
|
||||
$markdown += New-MDHeader "Java" -Level 3
|
||||
$markdown += Get-JavaVersions | New-MDTable
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
$markdown += New-MDHeader "Shells" -Level 3
|
||||
$markdown += Get-ShellTarget
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
30
images/win/scripts/SoftwareReport/SoftwareReport.Java.psm1
Normal file
30
images/win/scripts/SoftwareReport/SoftwareReport.Java.psm1
Normal file
@@ -0,0 +1,30 @@
|
||||
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 = $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
|
||||
$version = Get-JavaFullVersion "$javaPath"
|
||||
$vendor = $version.StartsWith("1.7") ? "Zulu" : "AdoptOpenJDK"
|
||||
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
|
||||
|
||||
[PSCustomObject] @{
|
||||
"Version" = $version + $defaultPostfix
|
||||
"Vendor" = $vendor
|
||||
"Environment Variable" = $_.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user