From 5c0f34410fc37286483f05dfcfe0a94949b4a8b0 Mon Sep 17 00:00:00 2001 From: Maciej Kucharczyk Date: Sat, 14 Dec 2024 15:26:47 +0100 Subject: [PATCH] Install jextract with SDKMAN --- .github/workflows/deploy.yml | 13 ++++--------- .github/workflows/maven.yml | 30 +++++++++++------------------- DEVELOPMENT.md | 12 +----------- prepare-jextract.sh | 15 +-------------- 4 files changed, 17 insertions(+), 53 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c4f9b29..140d1f6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,16 +29,11 @@ jobs: "password": "${{ secrets.CENTRAL_TOKEN }}" }] - - name: Cache jextract - id: cache-jextract - uses: actions/cache@v4 + - uses: sdkman/sdkman-action@main + id: sdkman with: - path: jextract - key: 22-jextract+5-33 - - - name: Set up jextract - if: steps.cache-jextract.outputs.cache-hit != 'true' - run: ./prepare-jextract.sh + candidate: jextract + version: 22.ea.6 - name: Deploy with Maven env: diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7fc942b..36163d0 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -20,16 +20,11 @@ jobs: distribution: 'temurin' cache: maven - - name: Cache jextract - id: cache-jextract - uses: actions/cache@v4 + - uses: sdkman/sdkman-action@main + id: sdkman with: - path: jextract - key: 22-jextract+5-33 - - - name: Set up jextract - if: steps.cache-jextract.outputs.cache-hit != 'true' - run: ./prepare-jextract.sh + candidate: jextract + version: 22.ea.6 - name: Check sources with Maven run: | @@ -39,15 +34,10 @@ jobs: - name: Build with Maven run: | ./prepare.sh - mvn -B -ntp -f jgpio/pom.xml install -Djextract.bin=../jextract/bin/jextract + mvn -B -ntp -f jgpio/pom.xml install mvn -B -ntp -f jgpio-it/pom.xml package mvn -B -ntp -f examples/pom.xml package - - uses: actions/upload-artifact@v4 - with: - name: jgpio-target - path: jgpio/target - test-it: needs: build runs-on: self-hosted @@ -61,12 +51,14 @@ jobs: distribution: 'temurin' cache: maven - - uses: actions/download-artifact@v4 + - uses: sdkman/sdkman-action@main + id: sdkman with: - name: jgpio-target - path: jgpio/target + candidate: jextract + version: 22.ea.6 - name: Test IT run: | - mvn -B -ntp -f jgpio/pom.xml jar:jar install:install + ./prepare.sh + mvn -B -ntp -f jgpio/pom.xml install mvn -B -ntp -f jgpio-it/pom.xml verify diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 4d538e4..fc2c4c7 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -3,7 +3,7 @@ ## Requirements - Java 22 or newer -- [jextract](https://jdk.java.net/jextract/) in `$PATH` +- [jextract](https://jdk.java.net/jextract/) in `$PATH`, call `./prepare-jextract.sh` to install it via SDKMAN ## How to build @@ -12,13 +12,3 @@ cd jgpio mvn install ``` - -By default, the build will use `jextract` from your system's `$PATH` variable during Maven -compilation. - -If you want to download and use a fixed version of `jextract`, use the following: - -```shell -./prepare-jextract.sh -mvn install -Djextract.bin=../jextract/bin/jextract -``` diff --git a/prepare-jextract.sh b/prepare-jextract.sh index ff16e79..2541853 100755 --- a/prepare-jextract.sh +++ b/prepare-jextract.sh @@ -1,18 +1,5 @@ #!/bin/bash -function get_jextract() { - file=openjdk-22-jextract+5-33_linux-x64_bin.tar.gz - jextract_dir=jextract - if [ -d "$jextract_dir" ] ; then - echo "$jextract_dir already exist, skipping" - exit 0 - fi - curl -O https://download.java.net/java/early_access/jextract/22/5/"$file" - tar -xf "$file" - rm -fv "$file" - mv -v jextract-22 "$jextract_dir" -} - -get_jextract +sdk install jextract 22.ea.6 echo "Done"