Skip to content

Commit 818af6c

Browse files
Update to sbt 2 (#309)
* Update sbt to 2.0.1 * Fix assembling and serial (non-parallel) testing * Fix binary checks and uploading * Update to sbt 2.0.6, fix remaining build output paths - Bump sbt 2.0.1 -> 2.0.6 (latest stable). - Fix the AOT test: the binary is moved to the working directory, so it has to be invoked as ./jelly-cli, not jelly-cli. - Update publish.yml for the sbt 2 target layout. It was missed earlier, so releases would have shipped no binaries at all. - Update the build-from-source paths in the README. - Silence sbt 2's unused-key lint, which flags the Debian/RPM/Universal packaging settings that sbt-native-packager defines but we never use. --------- Co-authored-by: Andriy Plokhotnyuk <plokhotnyuk@gmail.com>
1 parent fa00c61 commit 818af6c

7 files changed

Lines changed: 30 additions & 21 deletions

File tree

.github/workflows/aot-test.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,51 +35,54 @@ jobs:
3535
run: |
3636
set -euo pipefail
3737
38+
# sbt 2 nests build outputs under target/out/<platform>/<scala version>/<project>/
39+
mv target/out/jvm/scala-*/jelly-cli/graalvm-native-image/jelly-cli jelly-cli
40+
3841
# See if it runs at all
39-
target/graalvm-native-image/jelly-cli version || exit 1
42+
./jelly-cli version || exit 1
4043
4144
# Make sure reflection is supported
42-
target/graalvm-native-image/jelly-cli version | grep "JVM reflection: supported" \
45+
./jelly-cli version | grep "JVM reflection: supported" \
4346
|| exit 1
4447
4548
# Make sure large RDF/XML file parsing is supported
46-
target/graalvm-native-image/jelly-cli version | grep "Large RDF/XML file parsing: supported" \
49+
./jelly-cli version | grep "Large RDF/XML file parsing: supported" \
4750
|| exit 1
4851
4952
# Test RDF conversions
5053
echo '_:b <http://t.org/> _:b .' > in.nt
51-
target/graalvm-native-image/jelly-cli \
54+
./jelly-cli \
5255
rdf to-jelly --in-format=nt in.nt > out.jelly && \
5356
[ -s out.jelly ] || exit 1
54-
target/graalvm-native-image/jelly-cli \
57+
./jelly-cli \
5558
rdf from-jelly --out-format=jelly-text out.jelly > out.txt && \
5659
[ -s out.txt ] || exit 1
5760
# From jelly-text
58-
target/graalvm-native-image/jelly-cli \
61+
./jelly-cli \
5962
rdf to-jelly --in-format=jelly-text out.txt > out2.jelly && \
6063
[ -s out2.jelly ] || exit 1
61-
target/graalvm-native-image/jelly-cli \
64+
./jelly-cli \
6265
rdf from-jelly --out-format=jsonld out.jelly > out.json && \
6366
[ -s out.json ] || exit 1
6467
echo '{"@graph":[{"@id":"http://e.org/r","http://e.org/p":{"@value":"v"}}]}' | \
65-
target/graalvm-native-image/jelly-cli rdf to-jelly --in-format "jsonld" > jsonld.jelly && \
68+
./jelly-cli rdf to-jelly --in-format "jsonld" > jsonld.jelly && \
6669
[ -s jsonld.jelly ] || exit 1
6770
echo '<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Seq rdf:about="http://example.org/favourite-fruit"></rdf:Seq></rdf:RDF>' | \
68-
target/graalvm-native-image/jelly-cli rdf to-jelly --in-format "rdfxml" > rdfxml.jelly && \
71+
./jelly-cli rdf to-jelly --in-format "rdfxml" > rdfxml.jelly && \
6972
[ -s rdfxml.jelly ] || exit 1
7073
7174
# Invalid RDF/XMl input test
7275
# Regression test for: https://github.com/Jelly-RDF/cli/issues/217
7376
echo 'invalidxml' | \
74-
( ! target/graalvm-native-image/jelly-cli rdf to-jelly --in-format "rdfxml" &> error.txt ) && \
77+
( ! ./jelly-cli rdf to-jelly --in-format "rdfxml" &> error.txt ) && \
7578
grep 'Content is not allowed in prolog' error.txt || exit 1
7679
7780
# Test rdf validate
78-
target/graalvm-native-image/jelly-cli \
81+
./jelly-cli \
7982
rdf validate out.jelly --compare-to-rdf-file in.nt || exit 1
8083
8184
- name: Upload binary
8285
uses: actions/upload-artifact@v4
8386
with:
8487
name: jelly-cli-${{ matrix.os }}
85-
path: target/graalvm-native-image/*
88+
path: jelly-cli

.github/workflows/publish.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
uses: actions/upload-artifact@v4
3232
with:
3333
name: jelly-cli-${{ matrix.os }}
34-
path: target/graalvm-native-image/*
34+
# sbt 2 nests build outputs under target/out/<platform>/<scala version>/<project>/
35+
path: target/out/jvm/scala-*/jelly-cli/graalvm-native-image/*
3536

3637
jit-compile:
3738
name: Build the uber-JAR
@@ -53,7 +54,7 @@ jobs:
5354
shell: bash
5455
run: |
5556
sbt -v assembly
56-
mv target/scala-*/jelly-cli-assembly*.jar jelly-cli.jar
57+
mv target/out/jvm/scala-*/jelly-cli/jelly-cli-assembly*.jar jelly-cli.jar
5758
5859
- name: Upload assembly
5960
uses: actions/upload-artifact@v4

.github/workflows/scala.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
- name: Build and test
4242
shell: bash
43-
run: sbt -v +test test-serial:test
43+
run: sbt -v +test TestSerial/test
4444

4545
test-assembly:
4646
runs-on: ubuntu-latest
@@ -61,7 +61,7 @@ jobs:
6161
shell: bash
6262
run: |
6363
sbt -v assembly
64-
mv target/scala-*/jelly-cli-assembly*.jar jelly-cli.jar
64+
mv target/out/jvm/scala-*/jelly-cli/jelly-cli-assembly*.jar jelly-cli.jar
6565
6666
- name: Test the assembly
6767
run: |

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ The CI checks will not pass if this is not the case.
176176
- Ensure you have [GraalVM](https://www.graalvm.org/) installed and the `native-image` utility is available in your `PATH`.
177177
- Clone the repository.
178178
- Run `sbt GraalVMNativeImage/packageBin`
179-
- The binary will be available at `./target/graalvm-native-image/jelly-cli`.
179+
- The binary will be available at `./target/out/jvm/scala-3.*.*/jelly-cli/graalvm-native-image/jelly-cli`.
180180

181181
#### Über-JAR build (just-in-time)
182182

183183
- Run `sbt assembly`
184-
- The resulting JAR will be in `./target/scala-3.*.*/jelly-cli-assembly-*.jar`
184+
- The resulting JAR will be in `./target/out/jvm/scala-3.*.*/jelly-cli/jelly-cli-assembly-*.jar`
185185
- Run it like: `java -jar <path-to-jar>`
186186

187187
----

build.sbt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ ThisBuild / semanticdbEnabled := true
22
lazy val scalaV = "3.8.4"
33
ThisBuild / scalaVersion := scalaV
44

5+
// sbt-native-packager (pulled in by GraalVMNativeImagePlugin) defines settings for the Debian,
6+
// RPM, and Universal packaging formats, which we don't use. sbt 2 reports all of them as unused
7+
// keys on every startup, so turn the lint off.
8+
Global / lintUnusedKeysOnLoad := false
9+
510
resolvers +=
611
"Sonatype OSS Snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots"
712

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version = 1.12.15
1+
sbt.version = 2.0.6

src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class RdfToJellySpec extends AnyWordSpec with TestFixtureHelper with Matchers:
102102
}
103103

104104
"input stream to output stream, generalized RDF (N-Triples)" in {
105-
val inputStream = new FileInputStream(getClass.getResource("/generalized.nt").getPath)
105+
val inputStream = getClass.getResourceAsStream("/generalized.nt")
106106
RdfToJelly.setStdIn(inputStream)
107107
val (out, err) = RdfToJelly.runTestCommand(
108108
List("rdf", "to-jelly", "--in-format=nt"),
@@ -116,7 +116,7 @@ class RdfToJellySpec extends AnyWordSpec with TestFixtureHelper with Matchers:
116116
}
117117

118118
"input stream to output stream, generalized RDF (N-Quads)" in {
119-
val inputStream = new FileInputStream(getClass.getResource("/generalized.nq").getPath)
119+
val inputStream = getClass.getResourceAsStream("/generalized.nq")
120120
RdfToJelly.setStdIn(inputStream)
121121
val (out, err) = RdfToJelly.runTestCommand(
122122
List("rdf", "to-jelly", "--in-format=nq"),

0 commit comments

Comments
 (0)