@@ -28,9 +28,9 @@ Usage: manage.ps1 action <args>
2828 create-josm-home
2929 download-josm latest|tested|<version>
3030 download a JOSM version
31- download-jdk jdk11| jdk17
31+ download-jdk jdk17 | jdk20
3232 downloads a portable OpenJDK and installs it in the current directory
33- download-graalvm jdk11| jdk17
33+ download-graalvm jdk17 | jdk20
3434 downloads a GraalVM for Windows and installs it in the current directory
3535 download-graaljs
3636 downloads a GraalJS for Windows and installs it in the current directory
@@ -181,9 +181,19 @@ function downloadJDK([string]$version) {
181181 Write-Warning " JDK with version '$version ' already available in '$jdkDirectory '. Skipping download."
182182 return
183183 }
184- 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" )
184+ $localZipFile = $ (Join-Path $ (Get-Location ) - ChildPath " $version .zip" )
185+ Invoke-WebRequest - Uri $downloadUrl - OutFile $localZipFile
186+ Expand-Archive - Path $localZipFile - DestinationPath $ (Get-Location )
187+
188+ Add-Type - assembly " system.io.compression.filesystem"
189+ $zipFile = [io.compression.zipfile ]::OpenRead($localZipFile )
190+ $firstEntryName = $zipFile.Entries.FullName `
191+ | Select-Object - first 1
192+ $zipFile.Dispose ()
193+ $rootDirectory = $firstEntryName.Split (" /" )[0 ]
194+ Rename-Item - Path $rootDirectory - NewName $jdkDirectory
195+
196+ Remove-Item - Path $localZipFile
187197}
188198
189199function downloadGraalVM ([string ]$version ) {
@@ -198,7 +208,15 @@ function downloadGraalVM([string]$version) {
198208 $localFile = " graalvm-for-$version .zip"
199209 Invoke-WebRequest - Uri $downloadUrl - OutFile $localFile
200210 Expand-Archive - Path $ (Join-Path $ (Get-Location ) - ChildPath $localFile ) - DestinationPath $ (Get-Location )
211+
212+ Add-Type - assembly " system.io.compression.filesystem"
213+ $zipFile = [io.compression.zipfile ]::OpenRead($ (Join-Path $ (Get-Location ) - ChildPath $localFile ))
214+ $firstEntryName = $zipFile.Entries.FullName `
215+ | Select-Object - first 1
216+ $zipFile.Dispose ()
217+ $rootDirectory = $firstEntryName.Split (" /" )[0 ]
201218 Remove-Item - Path $ (Join-Path $ (Get-Location ) - ChildPath $localFile )
219+ Rename-Item - Path $rootDirectory - NewName $graalVMDirectory
202220
203221 # initiallize the JavaScript language
204222 . $graalVMDirectory \bin\gu.cmd install js
@@ -279,10 +297,10 @@ switch($action) {
279297 }
280298
281299 " prepare" {
282- downloadJDK(" jdk11" )
283300 downloadJDK(" jdk17" )
284- downloadGraalVM( " jdk11 " )
301+ downloadJDK( " jdk20 " )
285302 downloadGraalVM(" jdk17" )
303+ downloadGraalVM(" jdk20" )
286304 downloadGraalJS($GRAALJS_PARAMS [" latest" ])
287305 downloadJosm(" latest" )
288306 downloadJosm(" tested" )
@@ -302,11 +320,10 @@ switch($action) {
302320 " download-jdk" {
303321 $version = $args [1 ]
304322 if (! $version ) {
305- Write-Error - Message " Missing command line argument for version" - Category InvalidArgument
306- Usage
307- Exit 1
323+ Write-Information " Using default version 'jdk17'"
324+ $version = " jdk17"
308325 }
309- if (! ($version -eq " jdk11 " -or $version -eq " jdk17 " )) {
326+ if (! ($version -eq " jdk17 " -or $version -eq " jdk20 " )) {
310327 Write-Error - Message " Unsupported JDK version '$version '" - Category InvalidArgument
311328 Usage
312329 Exit 1
@@ -317,10 +334,10 @@ switch($action) {
317334 " download-graalvm" {
318335 $version = $args [1 ]
319336 if (! $version ) {
320- Write-Information " Using default version 'jdk11 '"
321- $version = " jdk11 "
337+ Write-Information " Using default version 'jdk17 '"
338+ $version = " jdk17 "
322339 }
323- if (! ($version -eq " jdk11 " -or $version -eq " jdk17 " )) {
340+ if (! ($version -eq " jdk17 " -or $version -eq " jdk20 " )) {
324341 Write-Error - Message " Unsupported JDK version '$version '" - Category InvalidArgument
325342 Usage
326343 Exit 1
0 commit comments