Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GraalVM for JDK 22 casks #54

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ on: [push, pull_request]

jobs:
build:
runs-on: macos-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
java-version: [17, 20, 21]
os: [macos-14, macos-12] # M1 and Intel
java-version: [17, 20, 21, 22]
distribution: ['', '-community']
env:
CASK_NAME: 'graalvm${{ matrix.distribution }}-jdk${{ matrix.java-version }}'
name: Test graalvm${{ matrix.distribution }}-jdk${{ matrix.java-version }}.rb
name: Test graalvm${{ matrix.distribution }}-jdk${{ matrix.java-version }}.rb on ${{ matrix.os }}
steps:
- name: Clone repository
uses: actions/checkout@v4
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"
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}.0.0/graalvm-community-jdk-#{version}.0.0_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
Loading