-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ajshastri
committed
Feb 1, 2024
1 parent
0776d1f
commit dacac0e
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
|