Skip to content

Commit

Permalink
Graalvm update to 21
Browse files Browse the repository at this point in the history
  • Loading branch information
ajshastri committed Feb 1, 2024
1 parent 0776d1f commit dacac0e
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
20 changes: 20 additions & 0 deletions GraalVM/graalvm.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</id>
<version>22.3.3</version>
<packageSourceUrl>https://github.com/johanjanssen/ChocolateyPackages/tree/master/GraalVM</packageSourceUrl>
<title>GraalVM Latest Stable Java Version Now 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>
17 changes: 17 additions & 0 deletions GraalVM/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$ErrorActionPreference = 'Stop'
$programFiles = (${env:ProgramFiles}, ${env:ProgramFiles(x86)} -ne $null)[0]
$installDir = "$programFiles\GraalVM"
$version = "21.0.2+13.1"

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

Install-ChocolateyZipPackage @packageArgs
Install-ChocolateyEnvironmentVariable 'JAVA_HOME' $targetDir\graalvm-ce-java17-$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-ce-java17-$version\bin -PathType 'Machine'
30 changes: 30 additions & 0 deletions GraalVM/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$programFiles = (${env:ProgramFiles}, ${env:ProgramFiles(x86)} -ne $null)[0]
$installDir = "$programFiles\GraalVM"
$version = "21.0.2+13.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 dacac0e

Please sign in to comment.