Skip to content

Commit

Permalink
Install jextract with SDKMAN
Browse files Browse the repository at this point in the history
  • Loading branch information
mk868 committed Dec 14, 2024
1 parent e25a9f7 commit 5c0f344
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 53 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 11 additions & 19 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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
12 changes: 1 addition & 11 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
```
15 changes: 1 addition & 14 deletions prepare-jextract.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 5c0f344

Please sign in to comment.