From b56d115a16dfba8744c63f514efc3d67087bb5c9 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Sat, 27 Mar 2021 10:50:50 +0300 Subject: [PATCH] [Windows] Replace '+' to '-' in java path (#3028) * Replace + to - in Java path * Fix comment * fix vendor name in software report --- images/win/scripts/Installers/Install-JavaTools.ps1 | 3 ++- images/win/scripts/SoftwareReport/SoftwareReport.Java.psm1 | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/images/win/scripts/Installers/Install-JavaTools.ps1 b/images/win/scripts/Installers/Install-JavaTools.ps1 index c571d34fc..085be394c 100644 --- a/images/win/scripts/Installers/Install-JavaTools.ps1 +++ b/images/win/scripts/Installers/Install-JavaTools.ps1 @@ -61,7 +61,8 @@ function Install-JavaFromAdoptOpenJDK { -and $_.binary.image_type -eq "jdk" } $downloadUrl = $asset.binary.package.link - $fullJavaVersion = $asset.version.semver + # 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 $archivePath = Start-DownloadWithRetry -Url $downloadUrl -Name $([IO.Path]::GetFileName($downloadUrl)) diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Java.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Java.psm1 index 5998b33ef..3e9d7ada3 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Java.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Java.psm1 @@ -9,12 +9,14 @@ function Get-JavaVersions { return $javaVersions | Sort-Object $sortRules | ForEach-Object { $javaPath = $_.Value # Take semver from the java path - $version = (Split-Path $javaPath) -replace "\w:\\.*\\" + # The path contains '-' sign in the version number instead of '+' due to the following issue, need to substitute it back https://github.com/actions/virtual-environments/issues/3014 + $versionInPath = (Split-Path $javaPath) -replace "\w:\\.*\\" + $version = $versionInPath -replace '-', '+' $defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : "" [PSCustomObject] @{ "Version" = $version + $defaultPostfix - "Vendor" = "AdoptOpenJDK" + "Vendor" = "Adopt OpenJDK" "Environment Variable" = $_.Name } }