Skip to content

Commit 7aca878

Browse files
committed
refactor testing environment for Win32
1 parent 4310739 commit 7aca878

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

testing/windows/config.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
$JDK_PARAMS = @{
66
jdk17 = @{
77
uri = "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-x64.zip"
8-
directory = "jdk-17.0.7+7"
8+
directory = "jdk-17"
99
}
1010
jdk21 = @{
1111
uri = "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-x64.zip"
12-
directory = "jdk-21.0.1+12"
12+
directory = "jdk-21"
1313
}
1414
}
1515

testing/windows/josm.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If present, JOSM is started with the GraalVM. The GraalVM version is chosend dep
1313
1414
.PARAMETER graalJs
1515
The GraalJS version to be loaded. Either 'latest' or a GraalJS version configured in 'config.ps1'.
16-
If missing, no GraalJS version is loaded. GraalJS can't be used toghether with the GraalVM, only with a
16+
If missing, no GraalJS version is loaded. GraalJS can't be used together with the GraalVM, only with a
1717
stock JDK.
1818
1919
.PARAMETER help

testing/windows/manage.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,22 @@ function downloadJosm([string]$version) {
176176
function downloadJDK([string]$version) {
177177
$downloadUrl = $JDK_PARAMS[$version]["uri"]
178178
Write-Information "Downloading jdk version '$version' from $downloadUrl' ..."
179-
$jdkDirectory = Join-Path -Path $(Get-Location) -ChildPath $JDK_PARAMS[$version]["directory"]
179+
$jdkDirectory = $JDK_PARAMS[$version]["directory"]
180180
if (Test-Path $jdkDirectory) {
181181
Write-Warning "JDK with version '$version' already available in '$jdkDirectory'. Skipping download."
182182
return
183183
}
184184
Invoke-WebRequest -Uri $downloadUrl -OutFile "$version.zip"
185-
Expand-Archive -Path $(Join-Path $(Get-Location) -ChildPath "$version.zip") -DestinationPath $(Get-Location)
186-
Remove-Item -Path $(Join-Path $(Get-Location) -ChildPath "$version.zip")
185+
Expand-Archive -Path "$version.zip" -DestinationPath "."
186+
$candidates = Get-ChildItem "." -Filter "$jdkDirectory*"
187+
if ($candidates.Length -eq 0) {
188+
Write-Warning "Local download directory '$jdkDirectory*' doesn't exist. Aborting installation of JDK with version '$verison'."
189+
return 1
190+
} elseif ( $candidates.Length -gt 1) {
191+
Write-Warning "Multiple download directory '$jdkDirectory*' exist. Aborting installation of JDK with version '$verison'."
192+
}
193+
Rename-Item -Path $candidates[0] -NewName $jdkDirectory
194+
Remove-Item -Path "$version.zip"
187195
}
188196

189197
function downloadGraalVM([string]$version) {

0 commit comments

Comments
 (0)