From a7497e97a4f2104941d655f799d8e44bef8cb6b4 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 19 Mar 2024 19:33:56 +0100 Subject: [PATCH 1/3] Add GraalVM for JDK 22 casks. --- .github/workflows/main.yml | 2 +- Casks/graalvm-community-jdk22.rb | 48 ++++++++++++++++++++++++++++++++ Casks/graalvm-jdk22.rb | 48 ++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 Casks/graalvm-community-jdk22.rb create mode 100644 Casks/graalvm-jdk22.rb diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3a094cd..4d2fff6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }}' diff --git a/Casks/graalvm-community-jdk22.rb b/Casks/graalvm-community-jdk22.rb new file mode 100644 index 0000000..5fa1f1a --- /dev/null +++ b/Casks/graalvm-community-jdk22.rb @@ -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 diff --git a/Casks/graalvm-jdk22.rb b/Casks/graalvm-jdk22.rb new file mode 100644 index 0000000..8c86034 --- /dev/null +++ b/Casks/graalvm-jdk22.rb @@ -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 From 4497239d6fe41e7630f56010a0cad6e2159eb241 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 19 Mar 2024 19:36:15 +0100 Subject: [PATCH 2/3] Run tests on M1 and Intel. --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d2fff6..7e73bd1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,14 +4,15 @@ on: [push, pull_request] jobs: build: - runs-on: macos-latest + runs-on: ${{ matrix.os }} strategy: matrix: + 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 From ffc9bafbbac2d30ca9a2f6a562b6f4ebe8f82450 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 19 Mar 2024 19:38:08 +0100 Subject: [PATCH 3/3] Fix `graalvm-community-jdk22`. --- Casks/graalvm-community-jdk22.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Casks/graalvm-community-jdk22.rb b/Casks/graalvm-community-jdk22.rb index 5fa1f1a..4dbfaff 100644 --- a/Casks/graalvm-community-jdk22.rb +++ b/Casks/graalvm-community-jdk22.rb @@ -1,7 +1,7 @@ cask "graalvm-community-jdk22" do arch arm: "aarch64", intel: "x64" - version "22.0.0" + version "22" sha256 arm: "87b111900c5f78f919bb55103978d3b9ff44789140bb20be1c59abd23871cc86", intel: "691b71450bcfea19eb5a3564f7a159072f9bd51a7a901e3a4775127da24a10d1" @@ -10,7 +10,7 @@ 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" + 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/"