Skip to content

Commit

Permalink
Added GraalVM for Java 21.
Browse files Browse the repository at this point in the history
  • Loading branch information
johanjanssen committed Sep 19, 2023
1 parent 90dd6ac commit f263afa
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
20 changes: 20 additions & 0 deletions GraalVM-Java21/graalvmjava21.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>graalvm-java21</id>
<version>21.0.0</version>
<packageSourceUrl>https://github.com/johanjanssen/ChocolateyPackages/tree/master/GraalVM-Java21</packageSourceUrl>
<title>GraalVM Java 21</title>
<authors>Oracle</authors>
<owners>JohanJanssen</owners>
<licenseUrl>https://github.com/oracle/graal/blob/master/LICENSE</licenseUrl>
<projectUrl>https://www.graalvm.org/</projectUrl>
<docsUrl>https://www.graalvm.org/docs/introduction/</docsUrl>
<mailingListUrl>http://mail.openjdk.java.net/mailman/listinfo/graal-dev</mailingListUrl>
<bugTrackerUrl>https://github.com/oracle/graal/issues</bugTrackerUrl>
<projectSourceUrl>https://github.com/oracle/graal</projectSourceUrl>
<tags>openjdk java jvm</tags>
<summary>GraalVM is a virtual machine to run applications in different programming languages such as Java, Scala, Kotlin, JavaScript, Python, C, C++ and many more</summary>
<description>GraalVM is a virtual machine to run applications in different programming languages such as Java, Scala, Kotlin, JavaScript, Python, C, C++ and many more</description>
</metadata>
</package>
16 changes: 16 additions & 0 deletions GraalVM-Java21/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$programFiles = (${env:ProgramFiles}, ${env:ProgramFiles(x86)} -ne $null)[0]
$installDir = "$programFiles\GraalVM"
$version = "21+35.1"

$packageArgs = @{
PackageName = $env:ChocolateyPackageName
UnzipLocation = $targetDir = $installDir
Url64bit = 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.0/graalvm-community-jdk-21.0.0_windows-x64_bin.zip'
Checksum64 = '808b65fae4ab03a2f52b5850852d7c7e098608aa8bbab918d40e8aeec870ae5f'
ChecksumType64 = 'sha256'
}

Install-ChocolateyZipPackage @packageArgs
Install-ChocolateyEnvironmentVariable 'JAVA_HOME' $targetDir\graalvm-community-openjdk-$version 'Machine'
# The full path instead of the %JAVA_HOME% is needed so it can be removed with the Chocolatey Uninstall
Install-ChocolateyPath $targetDir\graalvm-community-openjdk-$version\bin -PathType 'Machine'
29 changes: 29 additions & 0 deletions GraalVM-Java21/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$programFiles = (${env:ProgramFiles}, ${env:ProgramFiles(x86)} -ne $null)[0]
$installDir = "$programFiles\GraalVM"
$version = "21+35.1"

Uninstall-ChocolateyEnvironmentVariable 'JAVA_HOME' 'Machine'
rm -r "$installDir\graalvm-community-openjdk-$version"

$pathToUnInstall = "$installDir\graalvm-community-openjdk-$version\bin"
$pathType = 'Machine'

$statementTerminator = ";"

$actualPath = [System.Collections.ArrayList](Get-EnvironmentVariable -Name 'Path' -Scope 'Machine' -PreserveVariables).split($statementTerminator)

if ($actualPath -contains $pathToUnInstall)
{
Write-Host "PATH environment variable contains $pathToUnInstall. Removing..."

$actualPath.Remove($pathToUnInstall)
$newPath = $actualPath -Join $statementTerminator

$cmd = "Set-EnvironmentVariable -Name 'Path' -Value `'$newPath`' -Scope 'Machine'"

if (Test-ProcessAdminRights) {
Invoke-Expression $cmd
} else {
Start-ChocolateyProcessAsAdmin "$cmd"
}
}

0 comments on commit f263afa

Please sign in to comment.