From 0b6b04be6450cd679c4e6132b2e935fa7426df69 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Fri, 18 Jun 2021 10:26:34 +0300 Subject: [PATCH] Fix Java_Adopt_Jdk permissions (#3605) --- .../win/scripts/Installers/Install-JavaTools.ps1 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/images/win/scripts/Installers/Install-JavaTools.ps1 b/images/win/scripts/Installers/Install-JavaTools.ps1 index f0f6f1b89..bab2f13bc 100644 --- a/images/win/scripts/Installers/Install-JavaTools.ps1 +++ b/images/win/scripts/Installers/Install-JavaTools.ps1 @@ -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 }