@@ -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 jdk17 | jdk20
31+ download-jdk jdk11|jdk17
3232 downloads a portable OpenJDK and installs it in the current directory
33- download-graalvm jdk17 | jdk20
33+ download-graalvm jdk11|jdk17
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,19 +181,9 @@ function downloadJDK([string]$version) {
181181 Write-Warning " JDK with version '$version ' already available in '$jdkDirectory '. Skipping download."
182182 return
183183 }
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
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" )
197187}
198188
199189function downloadGraalVM ([string ]$version ) {
@@ -208,15 +198,7 @@ function downloadGraalVM([string]$version) {
208198 $localFile = " graalvm-for-$version .zip"
209199 Invoke-WebRequest - Uri $downloadUrl - OutFile $localFile
210200 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 ]
218201 Remove-Item - Path $ (Join-Path $ (Get-Location ) - ChildPath $localFile )
219- Rename-Item - Path $rootDirectory - NewName $graalVMDirectory
220202
221203 # initiallize the JavaScript language
222204 . $graalVMDirectory \bin\gu.cmd install js
@@ -297,10 +279,10 @@ switch($action) {
297279 }
298280
299281 " prepare" {
282+ downloadJDK(" jdk11" )
300283 downloadJDK(" jdk17" )
301- downloadJDK( " jdk20 " )
284+ downloadGraalVM( " jdk11 " )
302285 downloadGraalVM(" jdk17" )
303- downloadGraalVM(" jdk20" )
304286 downloadGraalJS($GRAALJS_PARAMS [" latest" ])
305287 downloadJosm(" latest" )
306288 downloadJosm(" tested" )
@@ -320,10 +302,11 @@ switch($action) {
320302 " download-jdk" {
321303 $version = $args [1 ]
322304 if (! $version ) {
323- Write-Information " Using default version 'jdk17'"
324- $version = " jdk17"
305+ Write-Error - Message " Missing command line argument for version" - Category InvalidArgument
306+ Usage
307+ Exit 1
325308 }
326- if (! ($version -eq " jdk17 " -or $version -eq " jdk20 " )) {
309+ if (! ($version -eq " jdk11 " -or $version -eq " jdk17 " )) {
327310 Write-Error - Message " Unsupported JDK version '$version '" - Category InvalidArgument
328311 Usage
329312 Exit 1
@@ -334,10 +317,10 @@ switch($action) {
334317 " download-graalvm" {
335318 $version = $args [1 ]
336319 if (! $version ) {
337- Write-Information " Using default version 'jdk17 '"
338- $version = " jdk17 "
320+ Write-Information " Using default version 'jdk11 '"
321+ $version = " jdk11 "
339322 }
340- if (! ($version -eq " jdk17 " -or $version -eq " jdk20 " )) {
323+ if (! ($version -eq " jdk11 " -or $version -eq " jdk17 " )) {
341324 Write-Error - Message " Unsupported JDK version '$version '" - Category InvalidArgument
342325 Usage
343326 Exit 1
0 commit comments