From ed8aa97d3402b28e641ab74e3973a2bbfe5d6c8a Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 12 Oct 2024 11:28:58 +0200 Subject: [PATCH] GraalVM 23 (#1745) --- .circleci/script/gen_ci.clj | 2 +- .cirrus.yml | 2 +- .github/workflows/build.yml | 6 +++--- Dockerfile | 2 +- appveyor.yml | 6 +++--- doc/build.md | 2 +- doc/dev.md | 2 +- script/bump_graal_version.clj | 17 +++++------------ script/compile | 5 +++-- script/install-graalvm | 4 ++-- src/babashka/impl/clojure/core.clj | 2 +- 11 files changed, 22 insertions(+), 28 deletions(-) diff --git a/.circleci/script/gen_ci.clj b/.circleci/script/gen_ci.clj index 42fb9fed..6922d8fe 100644 --- a/.circleci/script/gen_ci.clj +++ b/.circleci/script/gen_ci.clj @@ -5,7 +5,7 @@ [clojure.string :as str] [flatland.ordered.map :refer [ordered-map]])) -(def graalvm-version "22") +(def graalvm-version "23") (defn run ([cmd-name cmd] diff --git a/.cirrus.yml b/.cirrus.yml index 270c6925..54d93672 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,7 +5,7 @@ task: skip: "changesIncludeOnly('logo/*', '**.md')" env: LEIN_ROOT: "true" - GRAALVM_VERSION: "22" + GRAALVM_VERSION: "23" GRAALVM_HOME: ${HOME}/graalvm-${GRAALVM_VERSION}/Contents/Home BABASHKA_PLATFORM: macos # used in release script BABASHKA_ARCH: aarch64 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0944667..fe133506 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,7 +102,7 @@ jobs: runs-on: ${{ matrix.os }} env: LEIN_ROOT: "true" - GRAALVM_VERSION: "22" + GRAALVM_VERSION: "23" BABASHKA_PLATFORM: ${{ matrix.name }} # used in release script BABASHKA_TEST_ENV: native BABASHKA_XMX: "-J-Xmx6500m" @@ -126,7 +126,7 @@ jobs: if: "matrix.static == false" uses: graalvm/setup-graalvm@v1 with: - java-version: '22' + java-version: '23' distribution: 'graalvm' components: 'native-image' github-token: ${{ secrets.GITHUB_TOKEN }} @@ -135,7 +135,7 @@ jobs: if: "matrix.static == true" uses: graalvm/setup-graalvm@v1 with: - version: '22' + version: '23' distribution: 'graalvm' components: 'native-image' native-image-musl: true diff --git a/Dockerfile b/Dockerfile index 1ec5d193..085b43e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ RUN apt update RUN apt install --no-install-recommends -yy build-essential zlib1g-dev WORKDIR "/opt" -ENV GRAALVM_VERSION="22" +ENV GRAALVM_VERSION="23" ARG TARGETARCH # Do not set those directly, use TARGETARCH instead ENV BABASHKA_ARCH= diff --git a/appveyor.yml b/appveyor.yml index 16dda71d..37817a29 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,8 +7,8 @@ image: Visual Studio 2022 clone_folder: C:\projects\babashka environment: - GRAALVM_HOME: C:\projects\babashka\graalvm\graalvm-jdk-22+36.1 - JAVA_HOME: C:\projects\babashka\graalvm\graalvm-jdk-22+36.1 + GRAALVM_HOME: C:\projects\babashka\graalvm\graalvm-jdk-23+37.1 + JAVA_HOME: C:\projects\babashka\graalvm\graalvm-jdk-23+37.1 BABASHKA_XMX: "-J-Xmx5g" skip_commits: @@ -44,7 +44,7 @@ clone_script: build_script: # TODO: Extract the zip by removing the top level folder to remove the hardcoded path for GRAALVM_HOME - cmd: >- - powershell -Command "if (Test-Path('graalvm')) { return } else { (New-Object Net.WebClient).DownloadFile('https://download.oracle.com/graalvm/22/archive/graalvm-jdk-22_windows-x64_bin.zip', 'graalvm.zip') }" + powershell -Command "if (Test-Path('graalvm')) { return } else { (New-Object Net.WebClient).DownloadFile('https://download.oracle.com/graalvm/23/archive/graalvm-jdk-23_windows-x64_bin.zip', 'graalvm.zip') }" powershell -Command "if (Test-Path('graalvm')) { return } else { Expand-Archive graalvm.zip graalvm }" diff --git a/doc/build.md b/doc/build.md index 6f81d189..71df3425 100644 --- a/doc/build.md +++ b/doc/build.md @@ -3,7 +3,7 @@ ## Prerequisites - Install [lein](https://leiningen.org/) for producing uberjars -- Download [GraalVM](https://www.graalvm.org/downloads/). Currently we use *jdk-22*. +- Download [GraalVM](https://www.graalvm.org/downloads/). Currently we use *Oracle GraalVM 23*. - For Windows, installing Visual Studio 2019 with the "Desktop development with C++" workload is recommended. - Set `$GRAALVM_HOME` to the GraalVM distribution directory. On macOS this can look like: diff --git a/doc/dev.md b/doc/dev.md index a7b27349..818722e2 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -37,7 +37,7 @@ reasons: ## Requirements -You need [lein](https://leiningen.org/) for running JVM tests and/or producing uberjars. For building binaries you need GraalVM. Currently we use jdk-21.0.0.1 +You need [lein](https://leiningen.org/) for running JVM tests and/or producing uberjars. For building binaries you need GraalVM. Currently we use Oracle GraalVM 23. ## Clone repository diff --git a/script/bump_graal_version.clj b/script/bump_graal_version.clj index 415d5896..e9a29fda 100755 --- a/script/bump_graal_version.clj +++ b/script/bump_graal_version.clj @@ -46,7 +46,8 @@ "project.clj" "script/bump_graal_version.clj" ".circleci/script/short_ci.clj" - ".cirrus.yml"]) + ".cirrus.yml" + "script/install-graalvm"]) ;; We might have to keep changing these from ;; time to time whenever the version is bumped @@ -54,8 +55,7 @@ ;; OR ;; ;; We could have them as environment variables -(def current-graal-version "22.3.1") -(def current-java-version "java19") +(def current-graal-version "23") (def cl-options [["-g" "--graal VERSION" "graal version"] @@ -91,19 +91,12 @@ [args] (when (empty? args) (display-help)) - (let [new-graal-version (:graal args) - new-java-version (:java args)] + (let [new-graal-version (:graal args)] (when (not (nil? new-graal-version)) (if (is-valid-bump? new-graal-version nil) (do (println "Performing Graal bump...") (bump-current current-graal-version new-graal-version)) - (show-error new-graal-version))) - (when (not (nil? new-java-version)) - (if (is-valid-bump? new-java-version nil) - (do - (println "Performing Java bump...") - (bump-current current-java-version new-java-version)) - (show-error new-java-version))))) + (show-error new-graal-version))))) (exec-script cl-args) diff --git a/script/compile b/script/compile index 04c3c1f7..d1f1cc57 100755 --- a/script/compile +++ b/script/compile @@ -39,7 +39,7 @@ args=("-jar" "$BABASHKA_JAR" # "-H:DashboardDump=reports/dump" # "-H:+DashboardPretty" # "-H:+DashboardJson" - "-H:ReportAnalysisForbiddenType=java.awt.Toolkit:InHeap,Allocated" + # "-H:ReportAnalysisForbiddenType=java.awt.Toolkit:Instantiated" "--verbose" "--no-fallback" "--native-image-info" @@ -54,13 +54,14 @@ BABASHKA_STATIC=${BABASHKA_STATIC:-} BABASHKA_MUSL=${BABASHKA_MUSL:-} if [ "$BABASHKA_STATIC" = "true" ]; then - args+=("--static") if [ "$BABASHKA_MUSL" = "true" ]; then + args+=("--static") args+=("--libc=musl" # see https://github.com/oracle/graal/issues/3398 "-H:CCompilerOption=-Wl,-z,stack-size=2097152") else # see https://github.com/oracle/graal/issues/3737 + args+=("-H:+UnlockExperimentalVMOptions") args+=("-H:+StaticExecutableWithDynamicLibC") fi fi diff --git a/script/install-graalvm b/script/install-graalvm index dd27675a..13631c63 100755 --- a/script/install-graalvm +++ b/script/install-graalvm @@ -4,7 +4,7 @@ set -euo pipefail INSTALL_DIR="${1:-$HOME}" -GRAALVM_VERSION="${GRAALVM_VERSION:-22}" +GRAALVM_VERSION="${GRAALVM_VERSION:-23}" GRAALVM_PLATFORM=$BABASHKA_PLATFORM @@ -19,7 +19,7 @@ esac GRAALVM_DIR_NAME="graalvm-$GRAALVM_VERSION" GRAALVM_FILENAME="graalvm-jdk-${GRAALVM_VERSION}_${GRAALVM_PLATFORM}-${GRAALVM_ARCH}_bin.tar.gz" -DOWNLOAD_URL="https://download.oracle.com/graalvm/22/archive/${GRAALVM_FILENAME}" +DOWNLOAD_URL="https://download.oracle.com/graalvm/23/archive/${GRAALVM_FILENAME}" pushd "$INSTALL_DIR" >/dev/null diff --git a/src/babashka/impl/clojure/core.clj b/src/babashka/impl/clojure/core.clj index 44a0800e..677b35be 100644 --- a/src/babashka/impl/clojure/core.clj +++ b/src/babashka/impl/clojure/core.clj @@ -122,7 +122,7 @@ :static true} ([aseq] (try (clojure.lang.RT/seqToTypedArray (seq aseq)) - (catch IllegalArgumentException _ + (catch Throwable _ (clojure.lang.RT/seqToTypedArray Object (seq aseq))))) ([type aseq] (clojure.lang.RT/seqToTypedArray type (seq aseq))))