Fix Java_Adopt_Jdk permissions (#3605)

This commit is contained in:
Aleksandr Chebotov
2021-06-18 10:26:34 +03:00
committed by GitHub
parent 82fa8f2880
commit 0b6b04be64

View File

@@ -60,16 +60,13 @@ function Install-JavaFromAdoptOpenJDK {
-and $_.binary.architecture -eq $Architecture `
-and $_.binary.image_type -eq "jdk"
}
$downloadUrl = $asset.binary.package.link
# We have to replace '+' sign in the version to '-' due to the issue with incorrect path in Android builds https://github.com/actions/virtual-environments/issues/3014
$fullJavaVersion = $asset.version.semver -replace '\+', '-'
# Download and extract java binaries to temporary folder
$downloadUrl = $asset.binary.package.link
$archivePath = Start-DownloadWithRetry -Url $downloadUrl -Name $([IO.Path]::GetFileName($downloadUrl))
$javaTempPath = Join-Path -Path $env:TEMP -ChildPath "Java_$fullJavaVersion"
Extract-7Zip -Path $archivePath -DestinationPath $javaTempPath
$javaTempBinariesPath = Join-Path -Path $javaTempPath -ChildPath "\jdk*\"
# We have to replace '+' sign in the version to '-' due to the issue with incorrect path in Android builds https://github.com/actions/virtual-environments/issues/3014
$fullJavaVersion = $asset.version.semver -replace '\+', '-'
# Create directories in toolcache path
$javaToolcachePath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "Java_Adopt_jdk"
$javaVersionPath = Join-Path -Path $javaToolcachePath -ChildPath $fullJavaVersion
@@ -84,8 +81,9 @@ function Install-JavaFromAdoptOpenJDK {
Write-Host "Creating Java '${fullJavaVersion}' folder in '${javaVersionPath}'"
New-Item -ItemType Directory -Path $javaVersionPath -Force | Out-Null
# Complete the installation by moving Java binaries from temporary directory to toolcache and creating the complete file
Move-Item -Path $javaTempBinariesPath -Destination $javaArchPath
# Complete the installation by extarcting Java binaries to toolcache and creating the complete file
Extract-7Zip -Path $archivePath -DestinationPath $javaVersionPath
Get-ChildItem -Path $javaVersionPath | Rename-Item -NewName $javaArchPath
New-Item -ItemType File -Path $javaVersionPath -Name "$Architecture.complete" | Out-Null
}