mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 12:06:59 +00:00
Deprecate Java 7 (#2629)
This commit is contained in:
committed by
GitHub
parent
9480083149
commit
01cd7ca628
@@ -10,11 +10,7 @@ function Set-JavaPath {
|
|||||||
[switch] $Default
|
[switch] $Default
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($Version -eq 7) {
|
|
||||||
$matchedString = "azure-jdk_7"
|
|
||||||
} else {
|
|
||||||
$matchedString = "jdk-?$Version"
|
$matchedString = "jdk-?$Version"
|
||||||
}
|
|
||||||
$javaPath = (Get-ChildItem -Path $JavaRootPath | Where-Object { $_ -match $matchedString}).FullName
|
$javaPath = (Get-ChildItem -Path $JavaRootPath | Where-Object { $_ -match $matchedString}).FullName
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($javaPath)) {
|
if ([string]::IsNullOrEmpty($javaPath)) {
|
||||||
@@ -51,15 +47,6 @@ function Set-JavaPath {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Install-Java7FromAzul {
|
|
||||||
param(
|
|
||||||
[string] $DestinationPath
|
|
||||||
)
|
|
||||||
$azulJDK7URL = 'https://repos.azul.com/azure-only/zulu/packages/zulu-7/7u232/zulu-7-azure-jdk_7.31.0.5-7.0.232-win_x64.zip'
|
|
||||||
$archivePath = Start-DownloadWithRetry -Url $azulJDK7URL -Name $([IO.Path]::GetFileName($azulJDK7URL))
|
|
||||||
Extract-7Zip -Path $archivePath -DestinationPath $DestinationPath
|
|
||||||
}
|
|
||||||
|
|
||||||
function Install-JavaFromAdoptOpenJDK {
|
function Install-JavaFromAdoptOpenJDK {
|
||||||
param(
|
param(
|
||||||
[string] $JDKVersion,
|
[string] $JDKVersion,
|
||||||
@@ -82,11 +69,7 @@ $defaultVersion = (Get-ToolsetContent).java.default
|
|||||||
$javaRootPath = "C:\Program Files\Java\"
|
$javaRootPath = "C:\Program Files\Java\"
|
||||||
|
|
||||||
foreach ($jdkVersion in $jdkVersions) {
|
foreach ($jdkVersion in $jdkVersions) {
|
||||||
if ($jdkVersion -eq 7) {
|
|
||||||
Install-Java7FromAzul -DestinationPath $javaRootPath
|
|
||||||
} else {
|
|
||||||
Install-JavaFromAdoptOpenJDK -JDKVersion $jdkVersion -DestinationPath $javaRootPath
|
Install-JavaFromAdoptOpenJDK -JDKVersion $jdkVersion -DestinationPath $javaRootPath
|
||||||
}
|
|
||||||
|
|
||||||
if ($jdkVersion -eq $defaultVersion) {
|
if ($jdkVersion -eq $defaultVersion) {
|
||||||
Set-JavaPath -Version $jdkVersion -JavaRootPath $javaRootPath -Default
|
Set-JavaPath -Version $jdkVersion -JavaRootPath $javaRootPath -Default
|
||||||
|
|||||||
@@ -18,12 +18,11 @@ function Get-JavaVersions {
|
|||||||
return $javaVersions | Sort-Object $sortRules | ForEach-Object {
|
return $javaVersions | Sort-Object $sortRules | ForEach-Object {
|
||||||
$javaPath = $_.Value
|
$javaPath = $_.Value
|
||||||
$version = Get-JavaFullVersion "$javaPath"
|
$version = Get-JavaFullVersion "$javaPath"
|
||||||
$vendor = $version.StartsWith("1.7") ? "Zulu" : "AdoptOpenJDK"
|
|
||||||
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
|
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
|
||||||
|
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Version" = $version + $defaultPostfix
|
"Version" = $version + $defaultPostfix
|
||||||
"Vendor" = $vendor
|
"Vendor" = "AdoptOpenJDK"
|
||||||
"Environment Variable" = $_.Name
|
"Environment Variable" = $_.Name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Describe "Java" {
|
|||||||
$result = Get-CommandResult "`"$javaPath`" -version"
|
$result = Get-CommandResult "`"$javaPath`" -version"
|
||||||
$result.ExitCode | Should -Be 0
|
$result.ExitCode | Should -Be 0
|
||||||
|
|
||||||
if ($Version -eq 7 -or $Version -eq 8) {
|
if ($Version -eq 8) {
|
||||||
$Version = "1.${Version}"
|
$Version = "1.${Version}"
|
||||||
}
|
}
|
||||||
$result.Output[0] | Should -Match ([regex]::Escape("openjdk version `"${Version}."))
|
$result.Output[0] | Should -Match ([regex]::Escape("openjdk version `"${Version}."))
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
"java": {
|
"java": {
|
||||||
"default": "8",
|
"default": "8",
|
||||||
"versions": [
|
"versions": [
|
||||||
"7", "8", "11", "13"
|
"8", "11", "13"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
"java": {
|
"java": {
|
||||||
"default": "8",
|
"default": "8",
|
||||||
"versions": [
|
"versions": [
|
||||||
"7", "8", "11", "13"
|
"8", "11", "13"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
|
|||||||
Reference in New Issue
Block a user