Skip to content

Commit 15f39f5

Browse files
committed
feat: Prepare for the first release on maven central.
Still need to set up publishing, but the project is in a good point right now.
1 parent 4ad5348 commit 15f39f5

28 files changed

+159
-316
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_call:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- uses: actions/checkout@v5
16+
- name: Set up JDK 25
17+
uses: actions/setup-java@v5
18+
with:
19+
java-version: '25'
20+
distribution: 'graalvm'
21+
- name: Setup Gradle
22+
uses: gradle/actions/setup-gradle@v5
23+
with:
24+
cache-read-only: ${{ github.event_name != 'push' }}
25+
- name: Build with Gradle
26+
run: ./gradlew build
27+
- name: Javadoc with Gradle
28+
run: ./gradlew javadoc
29+
- name: Test with Gradle
30+
run: ./gradlew test
31+
- name: Native tests with Gradle
32+
run: ./gradlew nativeTest

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# zstd-java
22

3-
Java bindings for the Zstandard compression library. Its meant to replace the use of JNI with FFM.
3+
Java bindings for the Zstandard compression library.
4+
5+
### Provides
6+
- `dev.hallock.zstd` is higher level bindings (Module)
7+
- `dev.hallock.zstd.bindings` the underlying native bindings (Module)
8+
9+
### Dependencies
10+
- Java 25 or higher
11+
- Zstandard library (zstd)
412

513
### Usage
614
Adding to Gradle (kts):
@@ -10,12 +18,16 @@ repositories {
1018
}
1119

1220
dependencies {
13-
implementation("dev.hallock.zstd:zstd:0.1.0")
21+
implementation("dev.hallock.zstd:zstd:<version>")
1422
}
1523
```
24+
where `<version>` is the latest tag.
25+
26+
### Runtime
27+
Ideally you want your project to be using JPMS as running on the module path allows nicer syntax to open native access.
28+
`--enable-native-access=dev.hallock.zstd.bindings` should be used to allow native access to the native Zstandard library.
1629

17-
### Java
18-
Requires Java 25 and will target LTS releases.
30+
Running in the unnamed module should be supported but is not recommended.
1931

2032
#### Resources
2133
- [Zstandard](https://facebook.github.io/zstd/doc/api_manual_latest.html)
@@ -24,8 +36,8 @@ Requires Java 25 and will target LTS releases.
2436

2537
<details>
2638
<summary>AI Disclosure</summary>
27-
AI was used to generate the Demo example, and most of the tests. My philosophy is that AI generated tests are slightly better coverage than no coverage.
28-
This may change in the future and is the only place(s) that is acceptable usage.
39+
AI was used to generate most of the tests. My philosophy is that AI generated tests are slightly better coverage than no coverage.
40+
This should change in the future and is the only place that is acceptable usage.
2941
</details>
3042

3143

ROADMAP.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### Roadmap
2+
Javadocs and better fail fast checking
3+
4+
Create bundled bindings for popular platforms (Windows, Linux, MacOS) to avoid the need for users to install the Zstandard library separately.
5+
6+
Create validation abstraction for streaming (Currently streaming works but allows out of bound accesses)
7+
8+
Support byte[] and ByteBuffer APIs for easier integration with existing code, (Likely copying data to native memory)
9+
10+
Validate native-image reachability metadata on push and create a workflow for it.
11+
12+
Validate jextract on push and create a workflow for it.
13+
14+
Support bindings separately to allow implementations that just consume the jextract module. (native image reachability)
15+
16+
1.0 Will not be tagged until all TODOS are addressed, and Streaming no longer can do out of bound accesses
17+
18+
Consider splitting API into dev.hallock.zstd.api to use services pro

bindings/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
2-
id("java-library")
3-
id("de.infolektuell.jextract") version "1.3.0"
2+
`java-library`
3+
alias(libs.plugins.jextract)
44
}
55

66
group = "dev.hallock.zstd"
7-
version = "0.1-SNAPSHOT"
7+
version = findProperty("version") ?: "dev"
88

99
repositories {
1010
mavenCentral()
@@ -16,7 +16,7 @@ java {
1616
}
1717

1818
dependencies {
19-
api("org.jspecify:jspecify:1.0.0")
19+
api(libs.jspecify)
2020
}
2121

2222
jextract.libraries {

build.gradle.kts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
plugins {
2-
id("java-library")
3-
id("org.graalvm.buildtools.native") version "0.11.2"
2+
`java-library`
3+
alias(libs.plugins.graalvm.buildtools)
44
}
55

66
group = "dev.hallock.zstd"
7-
version = "0.1-SNAPSHOT"
7+
version = findProperty("version") ?: "dev"
88

99
repositories {
1010
mavenCentral()
1111
}
1212

1313
dependencies {
14-
api("org.jspecify:jspecify:1.0.0")
14+
api(libs.jspecify)
1515
api(project(":bindings"))
16-
testImplementation(platform("org.junit:junit-bom:6.0.0"))
17-
testImplementation("org.junit.jupiter:junit-jupiter")
18-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
16+
testImplementation(platform(libs.junit.bom))
17+
testImplementation(libs.junit.jupiter)
18+
testRuntimeOnly(libs.junit.platform.launcher)
1919
}
2020

2121
tasks.test {
2222
useJUnitPlatform()
23-
jvmArgs("--enable-native-access=dev.hallock.zstd.bindings");
23+
jvmArgs("--enable-native-access=dev.hallock.zstd.bindings")
2424
}
2525

26-
2726
java {
2827
toolchain.languageVersion = JavaLanguageVersion.of(25)
2928
modularity.inferModulePath = true
3029
}
3130

31+
tasks.compileJava {
32+
options.compilerArgs.add("-Xlint:all")
33+
options.compilerArgs.add("-Werror")
34+
options.encoding = "UTF-8"
35+
}
3236

3337
graalvmNative {
3438
agent {
@@ -50,7 +54,7 @@ graalvmNative {
5054
binaries {
5155
named("test") {
5256
buildArgs.add("-O0")
53-
jvmArgs.add("--enable-native-access=dev.hallock.zstd.bindings")
57+
jvmArgs.add("--enable-native-access=ALL-UNNAMED") //TODO figure out why this isn't using modules
5458
}
5559
}
5660
}

demo/build.gradle.kts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)