Skip to content

Commit

Permalink
Added GraalVM-17
Browse files Browse the repository at this point in the history
  • Loading branch information
ajshastri committed Feb 9, 2024
1 parent dacac0e commit da06075
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
20 changes: 20 additions & 0 deletions GraalVM-17/graalvm-java17.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-java17</id>
<version>22.3.3</version>
<packageSourceUrl>https://github.com/johanjanssen/ChocolateyPackages/tree/master/GraalVM-Java17</packageSourceUrl>
<title>GraalVM Java 17</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-17/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 = "17.0.9+9.1"

$packageArgs = @{
PackageName = $env:ChocolateyPackageName
UnzipLocation = $targetDir = $installDir
Url64bit = 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.9/graalvm-community-jdk-17.0.9_windows-x64_bin.zip'
Checksum64 = '285e045bfc0b87d2b61958fea97444c3c6c7e68fba3fdbbe146622328b52ec38'
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-17/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 = "17.0.9+9.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 da06075

Please sign in to comment.