Skip to content

Commit

Permalink
refactor testing environment for Win32
Browse files Browse the repository at this point in the history
  • Loading branch information
Gubaer committed Jan 12, 2024
1 parent 4310739 commit 7aca878
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions testing/windows/config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
$JDK_PARAMS = @{
jdk17 = @{
uri = "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-x64.zip"
directory = "jdk-17.0.7+7"
directory = "jdk-17"
}
jdk21 = @{
uri = "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-x64.zip"
directory = "jdk-21.0.1+12"
directory = "jdk-21"
}
}

Expand Down
2 changes: 1 addition & 1 deletion testing/windows/josm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If present, JOSM is started with the GraalVM. The GraalVM version is chosend dep
.PARAMETER graalJs
The GraalJS version to be loaded. Either 'latest' or a GraalJS version configured in 'config.ps1'.
If missing, no GraalJS version is loaded. GraalJS can't be used toghether with the GraalVM, only with a
If missing, no GraalJS version is loaded. GraalJS can't be used together with the GraalVM, only with a
stock JDK.
.PARAMETER help
Expand Down
14 changes: 11 additions & 3 deletions testing/windows/manage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,22 @@ function downloadJosm([string]$version) {
function downloadJDK([string]$version) {
$downloadUrl = $JDK_PARAMS[$version]["uri"]
Write-Information "Downloading jdk version '$version' from $downloadUrl' ..."
$jdkDirectory = Join-Path -Path $(Get-Location) -ChildPath $JDK_PARAMS[$version]["directory"]
$jdkDirectory = $JDK_PARAMS[$version]["directory"]
if (Test-Path $jdkDirectory) {
Write-Warning "JDK with version '$version' already available in '$jdkDirectory'. Skipping download."
return
}
Invoke-WebRequest -Uri $downloadUrl -OutFile "$version.zip"
Expand-Archive -Path $(Join-Path $(Get-Location) -ChildPath "$version.zip") -DestinationPath $(Get-Location)
Remove-Item -Path $(Join-Path $(Get-Location) -ChildPath "$version.zip")
Expand-Archive -Path "$version.zip" -DestinationPath "."
$candidates = Get-ChildItem "." -Filter "$jdkDirectory*"
if ($candidates.Length -eq 0) {
Write-Warning "Local download directory '$jdkDirectory*' doesn't exist. Aborting installation of JDK with version '$verison'."
return 1
} elseif ( $candidates.Length -gt 1) {
Write-Warning "Multiple download directory '$jdkDirectory*' exist. Aborting installation of JDK with version '$verison'."
}
Rename-Item -Path $candidates[0] -NewName $jdkDirectory
Remove-Item -Path "$version.zip"
}

function downloadGraalVM([string]$version) {
Expand Down

0 comments on commit 7aca878

Please sign in to comment.