@@ -7,51 +7,18 @@ The differentiator is **dictionary compression** — trained from your own data
77ZDICT — plus a ** zero-copy ` MemorySegment ` API** for callers whose bytes are
88already off-heap (e.g. an mmap slice in, an arena buffer out).
99
10- A core goal is a ** hermetic build with no binary blobs** : the native library is
11- never checked in or downloaded prebuilt. It is compiled from the pinned
12- ` third_party/zstd ` source on every build via ` zig cc ` , which bundles its own
13- clang + libc for every target. Anyone with the repo and Zig reproduces the exact
14- ` .dylib/.so/.dll ` from source — no vendored binaries to trust, audit, or keep in
15- sync, and no host toolchain or sysroot to provision.
16-
1710## Layout
1811
19- Multi-module Maven build. Root aggregator artifactId is ` parent ` ; the published
20- library is ` io.github.dfa1:zstd-java ` .
21-
22- ```
23- zstd-java/ root pom, artifactId: parent
24- ├─ zstd/ library module, artifactId: zstd-java (only Java sources)
25- ├─ native/<classifier>/ one module per platform, packages libzstd.<ext>
26- ├─ bom/ dependency BOM
27- ├─ third_party/zstd/ vendored facebook/zstd submodule (C source of truth)
28- └─ scripts/build-zstd.sh zig cc build, invoked by each native module
29- ```
30-
31- - ` zstd/ ` — pure-Java FFM bindings, package ` io.github.dfa1.zstdffm ` .
32- - ` native/<classifier>/ ` — no Java; each builds + bundles the shared library for
33- one classifier: ` osx-aarch64 ` , ` osx-x86_64 ` , ` linux-x86_64 ` , ` linux-aarch64 ` ,
34- ` windows-x86_64 ` , ` windows-aarch64 ` .
35- - ` third_party/zstd/ ` — pinned submodule; the only source of native code.
36-
37- ## Build requirements
12+ Multi-module Maven build (` io.github.dfa1:zstd-java ` ):
3813
39- Deliberately minimal — part of the hermetic goal is a tiny prerequisite set:
40-
41- - ** JDK 25+** — required for the stable ` java.lang.foreign ` API. Tested on
42- Temurin/Zulu 25.
43- - ** Zig** on ` PATH ` — the C cross-compiler for the native library; this is the
44- only native-toolchain dependency (no system clang/gcc, no CMake, no sysroot).
45- Tested with ` zig 0.16.0 ` .
46- - ** Git** — to fetch the ` third_party/zstd ` submodule
47- (` git clone --recurse-submodules ` , or ` git submodule update --init ` ).
48- - ** A POSIX shell** — ` scripts/build-zstd.sh ` is bash; cross-builds run from a
49- Unix host (macOS/Linux). Windows targets are produced by cross-compiling, not
50- by building on Windows.
51-
52- Maven itself is ** not** required: use the bundled wrapper ` ./mvnw ` , which pins
53- Maven 3.9.16. Runtime needs ` --enable-native-access=ALL-UNNAMED ` (already set for
54- the test run via the surefire ` argLine ` ).
14+ - ` zstd/ ` — the library module, artifactId ` zstd-java ` , pure-Java FFM bindings
15+ (package ` io.github.dfa1.zstdffm ` ). The only module with Java sources.
16+ - ` native/<classifier>/ ` — one module per platform; each packages a
17+ ` libzstd.{dylib,so,dll} ` built from the ` third_party/zstd ` submodule. No Java.
18+ Classifiers: ` osx-aarch64 ` , ` osx-x86_64 ` , ` linux-x86_64 ` , ` linux-aarch64 ` ,
19+ ` windows-x86_64 ` , ` windows-aarch64 ` .
20+ - ` bom/ ` — dependency BOM.
21+ - ` zstd/ ` — vendored ` facebook/zstd ` git submodule (the C source of truth).
5522
5623## Native build
5724
@@ -98,9 +65,6 @@ Built `.dylib/.so/.dll` are git-ignored; they are regenerated from the submodule
9865
9966- 4-space indent, ** zero SonarQube bugs/smells** , no ` sun.misc.Unsafe ` or internal JDK APIs.
10067- Prefer explicit over clever; fail fast on unhandled cases.
101- - Idiomatic modern Java: reuse the JDK (override ` Iterator.forEachRemaining ` , don't invent
102- ` forEachChunk ` ; use ` Optional ` , records, sealed types, pattern switches, virtual threads, FFM).
103- New APIs should feel like JDK APIs.
10468- Always braces for ` if ` /` else ` /` for ` /` while ` , even one-liners (` if (c) { return a; } ` ).
10569- ** Time quantities use ` java.time.Duration ` , never ` long ` ** (no ` long timeoutMs ` /` delayNanos ` ).
10670 Exception: low-level JDK interop taking ` long ns ` (` Thread.sleep ` , ` LockSupport.parkNanos ` ,
@@ -114,4 +78,4 @@ Built `.dylib/.so/.dll` are git-ignored; they are regenerated from the submodule
11478 ` <strong> ` ,` <pre> ` ,` <table> ` , …). Use blank ` /// ` for paragraphs, ` - ` lists, ` ```java ``` ` ,
11579 ` **bold** ` . Cross-refs ` [ClassName#method(ParamType)] ` — verify the target exists (wrong refs are
11680 ** errors** ).
117- - Check: ` ./mvnw javadoc:javadoc -pl zstd ` must produce zero output.
81+ - Check: ` ./mvnw javadoc:javadoc -pl core ` must produce zero output.
0 commit comments