From 0f9a0fe622d5dccce025d1eb1239788c4549f281 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 11 Oct 2024 14:50:35 +0200 Subject: [PATCH 01/16] v1.12.193 --- CHANGELOG.md | 2 +- resources/BABASHKA_VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e94bc972..7ffdabe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ A preview of the next release can be installed from [Babashka](https://github.com/babashka/babashka): Native, fast starting Clojure interpreter for scripting -## Unreleased +## 1.12.193 (2024-10-11) - Clojure 1.12 interop: method thunks, FI coercion, array notation - Upgrade SCI reflector based on clojure 1.12 and remove specific workaround for diff --git a/resources/BABASHKA_VERSION b/resources/BABASHKA_VERSION index 0b8ca51e..da2e9c16 100644 --- a/resources/BABASHKA_VERSION +++ b/resources/BABASHKA_VERSION @@ -1 +1 @@ -1.4.193-SNAPSHOT \ No newline at end of file +1.12.193 \ No newline at end of file From 2519a284f41a4fb5132185351ac89639d0b5e7c3 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 11 Oct 2024 15:17:00 +0200 Subject: [PATCH 02/16] changelog --- CHANGELOG.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ffdabe6..2eb0bb03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,33 @@ A preview of the next release can be installed from ## 1.12.193 (2024-10-11) -- Clojure 1.12 interop: method thunks, FI coercion, array notation +- Clojure 1.12 interop: method thunks, FI coercion, array notation (see below) - Upgrade SCI reflector based on clojure 1.12 and remove specific workaround for `Thread/sleep` interop - Add `tools.reader.edn/read` - Fix [#1741](https://github.com/babashka/babashka/issues/1741): `(taoensso.timbre/spy)` now relies on macros from `taoensso.encore` previously not available in bb +Examples of the new Clojure interop: + +``` clojure +;; Qualified methods in call position: +(String/.length "123") ;;=> 3 +(String/new "123") ;;=> "123" + +;; Qualified methods in value position, as functions: +(map Integer/parseInt ["1" "22" "333"]) ;;=> (1 22 333) +(map String/.length ["1" "22" "333"]) ;;=> (1 2 3) +(map String/new ["1" "22" "333"]) ;;=> ("1" "22" "333") + +;; Typed multi-dimensional array class notation: +long/1 ;;=> 1-dimensional long array class +String/2 ;;=> 2-dimensional String array class + +;; Pass Clojure IFn to Java where `java.util.function.Predicate`, etc. is expected: +(into [] (doto (java.util.ArrayList. [1 2 3]) (.removeIf even?))) ;;=> [1 3] +(.computeIfAbsent (java.util.HashMap.) "abc" #(str % %)) ;;=> "abcabc" +``` + ## 1.4.192 (2024-09-12) - Upgrade Clojure to `1.12.0` From 1d5a777b810e1b6edb389f2e37e08f31fc96979f Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 11 Oct 2024 15:17:09 +0200 Subject: [PATCH 03/16] Version bump --- resources/BABASHKA_RELEASED_VERSION | 2 +- resources/BABASHKA_VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/BABASHKA_RELEASED_VERSION b/resources/BABASHKA_RELEASED_VERSION index 2671f6bc..da2e9c16 100644 --- a/resources/BABASHKA_RELEASED_VERSION +++ b/resources/BABASHKA_RELEASED_VERSION @@ -1 +1 @@ -1.4.192 \ No newline at end of file +1.12.193 \ No newline at end of file diff --git a/resources/BABASHKA_VERSION b/resources/BABASHKA_VERSION index da2e9c16..b91dfaae 100644 --- a/resources/BABASHKA_VERSION +++ b/resources/BABASHKA_VERSION @@ -1 +1 @@ -1.12.193 \ No newline at end of file +1.12.194-SNAPSHOT \ No newline at end of file From 34b5e71465b8970e91f7f729465ff1d5f0698356 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 12 Oct 2024 10:41:45 +0200 Subject: [PATCH 04/16] Fix #1743: fix fully qualified instance method in call pos. with GraalVM 22 (#1744) --- CHANGELOG.md | 4 ++++ resources/META-INF/babashka/deps.edn | 2 +- sci | 2 +- test/babashka/interop_test.clj | 13 +++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb0bb03..5403c822 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ A preview of the next release can be installed from [Babashka](https://github.com/babashka/babashka): Native, fast starting Clojure interpreter for scripting +## Unreleased + +- [#1743](https://github.com/babashka/babashka/issues/1743): fix new fully qualified instance method in call position with GraalVM 22 + ## 1.12.193 (2024-10-11) - Clojure 1.12 interop: method thunks, FI coercion, array notation (see below) diff --git a/resources/META-INF/babashka/deps.edn b/resources/META-INF/babashka/deps.edn index 698182eb..257ca0e3 100644 --- a/resources/META-INF/babashka/deps.edn +++ b/resources/META-INF/babashka/deps.edn @@ -20,7 +20,7 @@ "impl-java/src"], :deps {org.clojure/clojure {:mvn/version "1.12.0"}, org.babashka/sci {:local/root "sci"} - org.babashka/babashka.impl.java {:mvn/version "0.1.8"} + org.babashka/babashka.impl.java {:mvn/version "0.1.10"} org.babashka/sci.impl.types {:mvn/version "0.0.2"} babashka/babashka.curl {:local/root "babashka.curl"} babashka/fs {:local/root "fs"} diff --git a/sci b/sci index 09589dd3..55a76e54 160000 --- a/sci +++ b/sci @@ -1 +1 @@ -Subproject commit 09589dd37aa762ba1a416582a4d020deb9c612a4 +Subproject commit 55a76e540c5ce65d8a61982b2f942fcf63776850 diff --git a/test/babashka/interop_test.clj b/test/babashka/interop_test.clj index 645dac01..b643a824 100644 --- a/test/babashka/interop_test.clj +++ b/test/babashka/interop_test.clj @@ -75,3 +75,16 @@ (= '(100 100 100 100 100) (->> (Stream/generate (constantly 100)) stream-seq! (take 5)))"))) (is (true? (bb nil "(import [java.util Collection] [java.util.stream Stream] [java.util.function Predicate]) (= '(1 2 3 4 5 6 7 8 9 10) (->> (Stream/iterate 1 inc) stream-seq! (take 10)))")))) + +(deftest regression-test + (is (true? (bb nil "(let [x \"f\"] (String/.startsWith \"foo\" x))")))) + +(deftest clojure-1_12-interop-test + (is (= [1 2 3] (bb nil "(map Integer/parseInt [\"1\" \"2\" \"3\"])"))) + (is (= [1 2 3] (bb nil "(map String/.length [\"1\" \"22\" \"333\"])"))) + (is (= ["1" "22" "333"] (bb nil "(map String/new [\"1\" \"22\" \"333\"])"))) + (is (= 3 (bb nil "(String/.length \"123\")"))) + (is (= "123" (bb nil "(String/new \"123\")")))) + +(deftest clojure-1_12-array-test + (is (true? (bb nil "(instance? Class long/1)")))) From ed8aa97d3402b28e641ab74e3973a2bbfe5d6c8a Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 12 Oct 2024 11:28:58 +0200 Subject: [PATCH 05/16] 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)))) From 89eed2ed44033dea76509bad3770cc20f3c3667c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 12 Oct 2024 11:30:21 +0200 Subject: [PATCH 06/16] v1.12.194 --- CHANGELOG.md | 5 +++-- resources/BABASHKA_VERSION | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5403c822..f348da88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,10 @@ A preview of the next release can be installed from [Babashka](https://github.com/babashka/babashka): Native, fast starting Clojure interpreter for scripting -## Unreleased +## 1.12.194 (2024-10-12) -- [#1743](https://github.com/babashka/babashka/issues/1743): fix new fully qualified instance method in call position with GraalVM 22 +- Upgrade to GraalVM 23 +- [#1743](https://github.com/babashka/babashka/issues/1743): fix new fully qualified instance method in call position with GraalVM 23 ## 1.12.193 (2024-10-11) diff --git a/resources/BABASHKA_VERSION b/resources/BABASHKA_VERSION index b91dfaae..9c319f56 100644 --- a/resources/BABASHKA_VERSION +++ b/resources/BABASHKA_VERSION @@ -1 +1 @@ -1.12.194-SNAPSHOT \ No newline at end of file +1.12.194 \ No newline at end of file From 7ff62d91a2df9e81ad0abf841887008a42d916a4 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 12 Oct 2024 11:49:26 +0200 Subject: [PATCH 07/16] Version bump --- resources/BABASHKA_RELEASED_VERSION | 2 +- resources/BABASHKA_VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/BABASHKA_RELEASED_VERSION b/resources/BABASHKA_RELEASED_VERSION index da2e9c16..9c319f56 100644 --- a/resources/BABASHKA_RELEASED_VERSION +++ b/resources/BABASHKA_RELEASED_VERSION @@ -1 +1 @@ -1.12.193 \ No newline at end of file +1.12.194 \ No newline at end of file diff --git a/resources/BABASHKA_VERSION b/resources/BABASHKA_VERSION index 9c319f56..9ff66859 100644 --- a/resources/BABASHKA_VERSION +++ b/resources/BABASHKA_VERSION @@ -1 +1 @@ -1.12.194 \ No newline at end of file +1.12.195-SNAPSHOT \ No newline at end of file From 01cb6112f9f83dd3d619722326c4585ab49acbb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 12 Oct 2024 13:05:43 +0200 Subject: [PATCH 08/16] Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows (#1717) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v2...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe133506..d90c5d83 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -217,13 +217,13 @@ jobs: run: mkdir -p /tmp/release - name: Download linux binary - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 with: name: babashka-${{ steps.babashka-version.outputs.version }}-linux-amd64.zip path: /tmp/release - name: Download static linux binary - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.7 with: name: babashka-${{ steps.babashka-version.outputs.version }}-linux-static-amd64.zip path: /tmp/release-static From 24c644d9f0deb8cf22696360cb15fc8b9f59fdbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rahu=CE=BB=20D=C3=A9?= Date: Sun, 13 Oct 2024 19:07:04 +0100 Subject: [PATCH 09/16] [describe] add commit SHA to describe (#1747) --- .circleci/script/gen_ci.clj | 6 ++++-- .cirrus.yml | 2 ++ .github/workflows/build.yml | 2 ++ appveyor.yml | 2 ++ .../babashka/babashka/native-image.properties | 3 ++- script/compile | 10 ++++++++++ script/compile.bat | 8 ++++++++ src/babashka/main.clj | 4 ++++ 8 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.circleci/script/gen_ci.clj b/.circleci/script/gen_ci.clj index 6922d8fe..ae0b9675 100644 --- a/.circleci/script/gen_ci.clj +++ b/.circleci/script/gen_ci.clj @@ -84,7 +84,8 @@ :BABASHKA_PLATFORM "linux" :GRAALVM_VERSION graalvm-version :GRAALVM_HOME graalvm-home - :BABASHKA_TEST_ENV "jvm"} + :BABASHKA_TEST_ENV "jvm" + :BABASHKA_SHA (System/getenv "CIRCLE_SHA1")} :resource_class "large" :steps (gen-steps @@ -128,7 +129,8 @@ java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$refl "macos" platform) :BABASHKA_TEST_ENV "native" - :BABASHKA_XMX "-J-Xmx6500m"} + :BABASHKA_XMX "-J-Xmx6500m" + :BABASHKA_SHA (System/getenv "CIRCLE_SHA1")} env (if (= "aarch64" arch) (assoc env :BABASHKA_ARCH arch) env) diff --git a/.cirrus.yml b/.cirrus.yml index 54d93672..3e36b348 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -24,6 +24,8 @@ task: sudo /usr/sbin/softwareupdate --install-rosetta --agree-to-license java -version + export BABASHKA_SHA=$(git rev-parse HEAD) + script/uberjar # curl -sLO 'https://github.com/babashka/pgo-profiles/releases/download/2023.10.11/default.iprof' script/compile # --pgo=default.iprof diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d90c5d83..a836a934 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,7 @@ jobs: LEIN_ROOT: "true" BABASHKA_PLATFORM: linux # could be used in jar name GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BABASHKA_SHA: ${{ github.sha }} steps: - name: Git checkout uses: actions/checkout@v2 @@ -107,6 +108,7 @@ jobs: BABASHKA_TEST_ENV: native BABASHKA_XMX: "-J-Xmx6500m" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BABASHKA_SHA: ${{ github.sha }} steps: - name: Git checkout uses: actions/checkout@v2 diff --git a/appveyor.yml b/appveyor.yml index 37817a29..59c901ce 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -61,6 +61,8 @@ build_script: # see https://github.com/quarkusio/quarkus/pull/7663 - cmd: >- + set BABASHKA_SHA=%APPVEYOR_REPO_COMMIT% + call script/uberjar.bat call script/compile.bat diff --git a/resources/META-INF/native-image/babashka/babashka/native-image.properties b/resources/META-INF/native-image/babashka/babashka/native-image.properties index ea2ccd7e..f6db946b 100644 --- a/resources/META-INF/native-image/babashka/babashka/native-image.properties +++ b/resources/META-INF/native-image/babashka/babashka/native-image.properties @@ -53,4 +53,5 @@ Args=-H:+ReportExceptionStackTraces \ -EBABASHKA_FEATURE_LANTERNA \ -EBABASHKA_FEATURE_SPEC_ALPHA \ -EBABASHKA_FEATURE_RRB_VECTOR \ - -EBABASHKA_REQUIRE_SCAN + -EBABASHKA_REQUIRE_SCAN \ + -EBABASHKA_SHA diff --git a/script/compile b/script/compile index d1f1cc57..05dc65dc 100755 --- a/script/compile +++ b/script/compile @@ -107,4 +107,14 @@ then export BABASHKA_FEATURE_PRIORITY_MAP="${BABASHKA_FEATURE_PRIORITY_MAP:-false}" fi +if [[ -z "$BABASHKA_SHA" ]] +then + sha=$(git rev-parse HEAD) + if [[ $? -eq 0 ]]; then + export BABASHKA_SHA=$sha + fi +fi + "$GRAALVM_HOME/bin/native-image" "${args[@]}" "$@" + +./"$BABASHKA_BINARY" describe diff --git a/script/compile.bat b/script/compile.bat index 51abbc72..a78af136 100644 --- a/script/compile.bat +++ b/script/compile.bat @@ -23,6 +23,13 @@ Rem -H:EnableURLProtocols=jar,http,https is also not supported. call %GRAALVM_HOME%\bin\gu.cmd install native-image +if "%BABASHKA_SHA%"=="" ( + for /f %%i in ('git rev-parse HEAD') do set sha=%%i + if not errorlevel 1 ( + set BABASHKA_SHA=%sha% + ) +) + call %GRAALVM_HOME%\bin\native-image.cmd ^ "-jar" "target/babashka-%BABASHKA_VERSION%-standalone.jar" ^ "-H:Name=bb" ^ @@ -39,3 +46,4 @@ call %GRAALVM_HOME%\bin\native-image.cmd ^ if %errorlevel% neq 0 exit /b %errorlevel% call bb "(+ 1 2 3)" +call bb describe diff --git a/src/babashka/main.clj b/src/babashka/main.clj index d4d012e0..831f562c 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -110,6 +110,8 @@ (def version common/version) +(def build-commit-sha (or (System/getenv "BABASHKA_SHA") "")) + (defn parse-version [version] (mapv #(Integer/parseInt %) (-> version @@ -261,6 +263,7 @@ Use bb run --help to show this help output. (format (str/trim " {:babashka/version \"%s\" + :git/sha \"%s\" :feature/csv %s :feature/java-nio %s :feature/java-time %s @@ -281,6 +284,7 @@ Use bb run --help to show this help output. :feature/logging %s :feature/priority-map %s}") version + build-commit-sha features/csv? features/java-nio? features/java-time? From 5902852ff9bc77cbfeb5084708d5058044b50fbf Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 15 Oct 2024 15:08:47 +0200 Subject: [PATCH 10/16] Fix #1748: add clojure.core/ensure (#1749) --- CHANGELOG.md | 4 ++++ src/babashka/impl/clojure/core.clj | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f348da88..a837b9a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ A preview of the next release can be installed from [Babashka](https://github.com/babashka/babashka): Native, fast starting Clojure interpreter for scripting +## Unreleased + +- [#1748](https://github.com/babashka/babashka/issues/1748): add `clojure.core/ensure` + ## 1.12.194 (2024-10-12) - Upgrade to GraalVM 23 diff --git a/src/babashka/impl/clojure/core.clj b/src/babashka/impl/clojure/core.clj index 677b35be..917b8f01 100644 --- a/src/babashka/impl/clojure/core.clj +++ b/src/babashka/impl/clojure/core.clj @@ -179,6 +179,8 @@ 'sync (sci/copy-var sync clojure-core-ns) 'ref (sci/copy-var ref clojure-core-ns) 'ref-set (sci/copy-var ref-set clojure-core-ns) + 'ensure (sci/copy-var ensure clojure-core-ns) + ;; end STM 'update-vals (sci/copy-var update-vals clojure-core-ns) 'update-keys (sci/copy-var update-keys clojure-core-ns) 'parse-boolean (sci/copy-var parse-boolean clojure-core-ns) From b19d5f9bff5d0dc87056d2a0d612c62752c147ef Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 15 Oct 2024 19:00:12 +0200 Subject: [PATCH 11/16] Fix compile script, fixex #1750 --- script/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/compile b/script/compile index 05dc65dc..3b7097c2 100755 --- a/script/compile +++ b/script/compile @@ -107,7 +107,7 @@ then export BABASHKA_FEATURE_PRIORITY_MAP="${BABASHKA_FEATURE_PRIORITY_MAP:-false}" fi -if [[ -z "$BABASHKA_SHA" ]] +if [[ -z "${BABASHKA_SHA:-}" ]] then sha=$(git rev-parse HEAD) if [[ $? -eq 0 ]]; then From ec6a6a5cdb599abcec5fa60ff659ed8afe270e1c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 17 Oct 2024 12:37:54 +0200 Subject: [PATCH 12/16] Bump SCI --- sci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sci b/sci index 55a76e54..c6be0224 160000 --- a/sci +++ b/sci @@ -1 +1 @@ -Subproject commit 55a76e540c5ce65d8a61982b2f942fcf63776850 +Subproject commit c6be02242f455271ce24bcc25a431455b4de2cb4 From aabd35eeaa2aac3e8984ca019538e5b140d75c3f Mon Sep 17 00:00:00 2001 From: lvh <_@lvh.io> Date: Wed, 23 Oct 2024 11:07:14 -0500 Subject: [PATCH 13/16] Document that tests should prefer to hit public APIs (#1751) --- doc/dev.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/dev.md b/doc/dev.md index 818722e2..b3a22bde 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -22,6 +22,9 @@ agreement, the PR will be merged. Each bug fix, change or new feature should be tested well to prevent future regressions. +If possible, tests should use public APIs. If the bug is in private/internal +code, try to trigger it from a public API. + ### Force-push Please do not use `git push --force` on your PR branch for the following From 5acf04dcf1e1a05eb028af83e8ed3948c981a364 Mon Sep 17 00:00:00 2001 From: Michael Glaesemann Date: Thu, 24 Oct 2024 10:25:55 -0400 Subject: [PATCH 14/16] Include java.lang.SecurityException (#1753) * Include java.lang.SecurityException java.net.http.HttpClient, included in Babashak, can throw java.lang.SecurityException https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html * Update Changelog for https://github.com/babashka/babashka/issues/1752 --- CHANGELOG.md | 2 ++ src/babashka/impl/classes.clj | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a837b9a6..8273e9a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ A preview of the next release can be installed from ## Unreleased +- [#1752](https://github.com/babashka/babashka/issues/1752): include java.lang.SecurityException for java.net.http.HttpClient support + - [#1748](https://github.com/babashka/babashka/issues/1748): add `clojure.core/ensure` ## 1.12.194 (2024-10-12) diff --git a/src/babashka/impl/classes.clj b/src/babashka/impl/classes.clj index 03adfbd1..4c5e5bdc 100644 --- a/src/babashka/impl/classes.clj +++ b/src/babashka/impl/classes.clj @@ -328,6 +328,7 @@ java.lang.ProcessBuilder$Redirect java.lang.Runtime java.lang.RuntimeException + java.lang.SecurityException java.lang.Short java.lang.StackTraceElement java.lang.String @@ -831,6 +832,7 @@ RuntimeException java.lang.RuntimeException Process java.lang.Process ProcessBuilder java.lang.ProcessBuilder + SecurityException java.lang.SecurityException Short java.lang.Short StackTraceElement java.lang.StackTraceElement String java.lang.String From 01389901393d5624aeb6639fb1b01a2c38b5f0e8 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 30 Oct 2024 11:07:12 +0100 Subject: [PATCH 15/16] sync sci --- sci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sci b/sci index c6be0224..6d9380f5 160000 --- a/sci +++ b/sci @@ -1 +1 @@ -Subproject commit c6be02242f455271ce24bcc25a431455b4de2cb4 +Subproject commit 6d9380f55b3038769d5856fc67e7d7939ac981ef From b59bfcb7e64dd8dad142379b0f8cfddb04c84e90 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 30 Oct 2024 14:41:46 +0100 Subject: [PATCH 16/16] Upgrade timbre (#1755) --- CHANGELOG.md | 4 ++-- deps.edn | 2 +- feature-logging/babashka/impl/logging.clj | 4 +++- project.clj | 2 +- resources/META-INF/babashka/deps.edn | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8273e9a5..29cddb95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,9 @@ A preview of the next release can be installed from ## Unreleased -- [#1752](https://github.com/babashka/babashka/issues/1752): include java.lang.SecurityException for java.net.http.HttpClient support - +- [#1752](https://github.com/babashka/babashka/issues/1752): include `java.lang.SecurityException` for `java.net.http.HttpClient` support - [#1748](https://github.com/babashka/babashka/issues/1748): add `clojure.core/ensure` +- Upgrade to `taoensso/timbre` `v6.6.0` ## 1.12.194 (2024-10-12) diff --git a/deps.edn b/deps.edn index 257ca0e3..7eb7fa66 100644 --- a/deps.edn +++ b/deps.edn @@ -45,7 +45,7 @@ hiccup/hiccup {:mvn/version "2.0.0-RC1"} rewrite-clj/rewrite-clj {:mvn/version "1.1.48"} selmer/selmer {:mvn/version "1.12.59"} - com.taoensso/timbre {:mvn/version "6.5.0"} + com.taoensso/timbre {:mvn/version "6.6.0"} org.clojure/tools.logging {:mvn/version "1.1.0"} org.clojure/data.priority-map {:mvn/version "1.1.0"} insn/insn {:mvn/version "0.5.2"} diff --git a/feature-logging/babashka/impl/logging.clj b/feature-logging/babashka/impl/logging.clj index 9aa51e83..096a7b1a 100644 --- a/feature-logging/babashka/impl/logging.clj +++ b/feature-logging/babashka/impl/logging.clj @@ -59,7 +59,9 @@ ;; Note pre-resolved expansion `(taoensso.timbre/-log! ~config ~level ~ns ~file ~line ~column ~msg-type ~?err - (delay ~vargs-form) ~?base-data ~callsite-id ~spying?))))) + (delay ~vargs-form) ~?base-data ~callsite-id ~spying? + ~(get opts :instant) + ~(get opts :may-log?)))))) ([level msg-type args & [opts]] (let [{:keys [line column]} (merge (meta &form)) diff --git a/project.clj b/project.clj index d57cf278..8b93769c 100644 --- a/project.clj +++ b/project.clj @@ -73,7 +73,7 @@ :feature/selmer {:source-paths ["feature-selmer"] :dependencies [[selmer/selmer "1.12.59"]]} :feature/logging {:source-paths ["feature-logging"] - :dependencies [[com.taoensso/timbre "6.5.0"] + :dependencies [[com.taoensso/timbre "6.6.0"] [org.clojure/tools.logging "1.1.0"]]} :feature/priority-map {:source-paths ["feature-priority-map"] :dependencies [[org.clojure/data.priority-map "1.1.0"]]} diff --git a/resources/META-INF/babashka/deps.edn b/resources/META-INF/babashka/deps.edn index 257ca0e3..7eb7fa66 100644 --- a/resources/META-INF/babashka/deps.edn +++ b/resources/META-INF/babashka/deps.edn @@ -45,7 +45,7 @@ hiccup/hiccup {:mvn/version "2.0.0-RC1"} rewrite-clj/rewrite-clj {:mvn/version "1.1.48"} selmer/selmer {:mvn/version "1.12.59"} - com.taoensso/timbre {:mvn/version "6.5.0"} + com.taoensso/timbre {:mvn/version "6.6.0"} org.clojure/tools.logging {:mvn/version "1.1.0"} org.clojure/data.priority-map {:mvn/version "1.1.0"} insn/insn {:mvn/version "0.5.2"}