Skip to content

Commit

Permalink
Add GraalVM for JDK 22 casks.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Mar 19, 2024
1 parent 7b5c524 commit a7497e9
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
java-version: [17, 20, 21]
java-version: [17, 20, 21, 22]
distribution: ['', '-community']
env:
CASK_NAME: 'graalvm${{ matrix.distribution }}-jdk${{ matrix.java-version }}'
Expand Down
48 changes: 48 additions & 0 deletions Casks/graalvm-community-jdk22.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
cask "graalvm-community-jdk22" do
arch arm: "aarch64", intel: "x64"

version "22.0.0"
sha256 arm: "87b111900c5f78f919bb55103978d3b9ff44789140bb20be1c59abd23871cc86",
intel: "691b71450bcfea19eb5a3564f7a159072f9bd51a7a901e3a4775127da24a10d1"

installation_dir = "graalvm-community-openjdk-#{version}+36.1".freeze
jvms_dir = "/Library/Java/JavaVirtualMachines".freeze
target_dir = "#{jvms_dir}/graalvm-community-openjdk-#{version.split(".").first}".freeze

# github.com/graalvm/graalvm-ce-builds was verified as official when first introduced to the cask
url "https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-#{version}/graalvm-community-jdk-#{version}_macos-#{arch}_bin.tar.gz"
name "GraalVM Community Edition for JDK 22"
homepage "https://www.graalvm.org/"

artifact installation_dir, target: target_dir

postflight do
# Correct symlink
macos_dir = "#{target_dir}/Contents/MacOS"
libjli_filename = "libjli.dylib"
libjli_path = "#{target_dir}/Contents/Home/lib/#{libjli_filename}"
libjli_symlink_path = "#{macos_dir}/#{libjli_filename}"
system_command "/bin/mkdir", args: ["-p", macos_dir], sudo: true
system_command "/bin/ln", args: ["-s", "-f", libjli_path, libjli_symlink_path], sudo: true
end

caveats <<~EOS
Installing GraalVM CE for JDK 22 in #{jvms_dir} requires root permission.
You may be asked to enter your password to proceed.
On macOS Catalina or later, you may get a warning when you use the GraalVM
installation for the first time. This warning can be disabled by running the
following command:
xattr -r -d com.apple.quarantine "#{target_dir}"
To use GraalVM, you may want to change your $JAVA_HOME:
export JAVA_HOME="#{target_dir}/Contents/Home"
or you may want to add its `bin` directory to your $PATH:
export PATH="#{target_dir}/Contents/Home/bin:$PATH"
GraalVM CE is licensed under the GPL 2 with Classpath exception:
https://github.com/oracle/graal/blob/master/LICENSE
EOS
end
48 changes: 48 additions & 0 deletions Casks/graalvm-jdk22.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
cask "graalvm-jdk22" do
arch arm: "aarch64", intel: "x64"

version "22"
sha256 arm: "61632065cfcdc4e121362f1fd25a543955836bbacd6c1aadbcbe0d469d5ab8a3",
intel: "5b83f20dbc4c636ed41f19c3309f09839d4f5c6442dba986f460589c494a476c"

installation_dir = "graalvm-jdk-#{version}+36.1".freeze
jvms_dir = "/Library/Java/JavaVirtualMachines".freeze
target_dir = "#{jvms_dir}/graalvm-jdk-#{version.split(".").first}".freeze

# download.oracle.com was verified as official when first introduced to the cask
url "https://download.oracle.com/graalvm/22/archive/graalvm-jdk-#{version}_macos-#{arch}_bin.tar.gz"
name "Oracle GraalVM for JDK 22"
homepage "https://www.graalvm.org/"

artifact installation_dir, target: target_dir

postflight do
# Correct symlink
macos_dir = "#{target_dir}/Contents/MacOS"
libjli_filename = "libjli.dylib"
libjli_path = "#{target_dir}/Contents/Home/lib/#{libjli_filename}"
libjli_symlink_path = "#{macos_dir}/#{libjli_filename}"
system_command "/bin/mkdir", args: ["-p", macos_dir], sudo: true
system_command "/bin/ln", args: ["-s", "-f", libjli_path, libjli_symlink_path], sudo: true
end

caveats <<~EOS
Installing Oracle GraalVM for JDK 22 in #{jvms_dir} requires root permission.
You may be asked to enter your password to proceed.
On macOS Catalina or later, you may get a warning when you use the GraalVM
installation for the first time. This warning can be disabled by running the
following command:
xattr -r -d com.apple.quarantine "#{target_dir}"
To use GraalVM, you may want to change your $JAVA_HOME:
export JAVA_HOME="#{target_dir}/Contents/Home"
or you may want to add its `bin` directory to your $PATH:
export PATH="#{target_dir}/Contents/Home/bin:$PATH"
Oracle GraalVM is licensed under the GraalVM Free Terms and Conditions:
https://www.oracle.com/downloads/licenses/graal-free-license.html
EOS
end

0 comments on commit a7497e9

Please sign in to comment.