Repository layout
Thirteen Gradle modules, nine of them published, and a package rule that lets you read the pipeline off the package list.
The modules
settings.gradle is the map. Every published artifact is goldberry-<module> under the group dev.goldberry.
| Module | Artifact | What it holds | Published |
|---|---|---|---|
:common | goldberry-common | What both halves need and neither owns: logging and the start-up timeline. The lowest module, it requires nothing of Goldberry’s | Required |
:natives | goldberry-natives, plus a classifier jar per platform | The FFM bindings and the CMake superbuild that produces libgoldberry | Required |
:core | goldberry-core | The widget model, style, layout, text, paint and the backend SPI | Required |
:widgets | goldberry-widgets | The widget catalogue, charts included | Required |
:html | goldberry-html | Markdown through the native library, and HTML in Java | Optional |
:emoji | goldberry-emoji | The Noto Color Emoji face and nothing else, 5 MB of paint graphs | Optional |
:gpu | goldberry-gpu | canvas3d and the GPU composition path | Optional |
:media | goldberry-media, plus natives-<target> classifiers | Audio and video over the bundled media engine, and the operating system’s own decoders behind the same SPI | Optional |
:vector | goldberry-vector and natives-<target> classifiers | SVG rendering and a themed SVG widget | Optional |
:mic, :camera | goldberry-mic, goldberry-camera | Audio and video capture | Optional |
:spell | goldberry-spell | Optional Hunspell provider | Optional |
:bom | goldberry-bom | A java-platform pinning every published artifact | Yes |
:toolkit | goldberry | The umbrella: no code, the required modules as dependencies, the optional ones listed <optional> | Yes |
:assets | none | A build-time tool that fetches the pinned fonts and icon set and compiles them into resources :core packages | No |
:weaver | goldberry-weaver | A build-time tool that runs over compiled classes: it collects @Markup widgets into a catalog, and binds @Bind and @Action ahead of time for a native image | Yes |
:gradle-plugin | dev.goldberry.weave | Gradle support for ahead-of-time binding | Yes |
:example | none | The showcase. A subproject so Gradle and every IDE see it | No. A native image of it is attached to each release |
A new optional module is one line in PublishedModules in build-logic plus id 'goldberry.publish' in its build script. The BOM and the umbrella pick it up, and PublishedModulesTest holds each module’s build script to the list.
The package rule
A package is named for the part its contents play, not for the library or the file they came from. The CSS engine is a compiler, so it is css.parse, css.select, css.cascade and css.value. Input is a dispatcher, so it is input.event, input.key, input.hit and input.handler. A native library is split where the foreign memory stops: the wrappers that hold a handle stay beside the binding class, and the enums and values get packages of their own. The module descriptor is the fence.
Every package has a package-info.java whose doc comment says what the package is for and whether, and to whom, it is exported. Every package of a module under the conventions is @NullMarked, so NullAway sees it. PackageInfoTest in build-logic fails on a package with no package-info.java, on one without a doc comment, and on one that is not marked.
Important
A raw
MemorySegmentnever leaves:natives. The module descriptor enforces it,ExportedSurfaceTestreads the descriptor and fails if anything reachable from outside mentions one, and:nativesexports to:coreand to nobody else.
Where things are
| Path | What it is |
|---|---|
docs/ | The design documents. ARCHITECTURE.md is the system layer by layer. core-widgets.md, design-system.md, content-widgets.md and charts.md are the specifications. testing.md and releasing.md are the runbooks, book.md is the guide’s style guide, and status.md and TODO.md say what is built and what is not |
book/ | This guide, and the decision log under book/src/adr/ |
site/ | The landing page at goldberry.dev. build.mjs prerenders it and content.js is what it says |
build-logic/ | The convention plugins, and the drift guards in its tests |
natives/src/main/cmake/ | The superbuild: CMakeLists.txt, the export list in exports/goldberry.symbols, and the C shim |
assets/ | The fetch-and-compile tool for fonts and icons |
weaver/ | The class-file weaver |
example/ | The showcase |
config/ | The PMD ruleset, the SpotBugs exclusions, and Qodana’s profile and baseline |
gradle/libs.versions.toml | Every version and every upstream ref. The only place a ref lives |
licenses/ | The verbatim upstream licence texts, vendored by hand |
tools/ | Scripts: the nullness sweep, and move_package.py for a package move |
Which document wins. design-system.md and core-widgets.md are the authority on what a widget is. ARCHITECTURE.md is a summary of them and says where it departs from them, in its §17.1. The decision log is the authority on why, and a design document describes what. Status says what is built and TODO what is not, and the two are kept apart on purpose.
The convention plugins are seven precompiled Groovy script plugins under build-logic/src/main/groovy/, thin over the Java beside them, which carries the logic and its unit tests:
| Plugin | What it configures |
|---|---|
goldberry.java-conventions | The toolchain, the module path, Error Prone and NullAway, Spotless, PMD, SpotBugs, JaCoCo, blessGoldens, PIT, and the CI annotations; it applies goldberry.benchmarks |
goldberry.benchmarks | The src/benchmark/java source set and the benchmark task, one module at a time; check only compiles it |
goldberry.native-tests | Every test task of a module whose tests load libgoldberry: the grant, the library, the forwarded properties, the native build first; and nativeTests.gpuTests(...) and nativeTests.probe(...) |
goldberry.asset-tool | assetTool.bundle(entries, package): prepareAssets into the resources, and vendorLicences |
goldberry.versioning | The group and the calendar version, printVersion and bumpVersion |
goldberry.publish | The Maven Central publication, applied by the shipped modules and refused anywhere else |
goldberry.weave | The weaver over a module’s compiled classes, catalog half always and model half for a native image |
No build script reads another project’s configuration. What one module’s tests share with another’s is a test fixture — :natives’ library and GPU requirements and its first-thread launcher, :gpu’s compositing harness, :core’s goldens and TimeBudget — and the native target matrix is NativeTarget in build-logic rather than a table :natives lends out.
The build is written in the Groovy DSL. The root build.gradle is a container: it aggregates coverage and owns checkLicenses, checkMarkdown, formatMarkdown and the root blessGoldens.
Tests as drift guards
A fact that has to be true in two places gets a test that reads both.
| Test | Reads | Holds |
|---|---|---|
LinuxDependenciesTest | The dependency table and the workflows | Every required package is installed by the workflows that run checkToolchain |
ExportListTest | goldberry.symbols and the Java bindings | A symbol bound in Java is exported, and a symbol exported is bound |
PackageInfoTest | Every package directory | A package-info.java, a doc comment, @NullMarked |
DecisionLogTest | book/src/adr/ and its README.md | Numbered, contiguous, with a status, and listed in the log’s index |
PublishWorkflowsTest | .github/workflows/ | Only publish.yml uploads to Central, and the per-OS workflows have no push trigger |
PublishedModulesTest | Each module’s build script | The published list and the scripts agree |
DeclaredResourcesTest | src/main/resources | Every resource is covered by a native-image glob |
ExportedSurfaceTest | :natives’ descriptor and class files | No reachable member mentions MemorySegment |
WrittenNamesTest | The weaver’s constants | Every class name the weaver writes as text resolves |
BoundaryTest, DeterminismTest | The whole graph, through ArchUnit | The module arrows in ARCHITECTURE.md §2, and no clock, random source or default locale in the deterministic layer |
SiteTest | site/content.js and the book | The pages the landing page links by name are where it says |
SourceDocsTest | Every Java, Gradle and workflow source, and the book | No record number in a source; every goldberry.dev/docs link lands on a page and a heading that exist; every published package links the guide; no Java source names a file under docs/ |
BenchmarkLaneTest | Every source tree, the build scripts, docs/testing.md and the workflows | No benchmark in a test tree or under a tag; every probe task runs a class in its module’s src/benchmark; every measurement is in the inventory; only benchmarks.yml runs one |
ForwardedPropertiesTest | The workflows | Every switch a workflow sets for a test JVM is on the one list the build hands on |
NativeTargetTest | natives/build.gradle and media/build.gradle | The libraries are installed where every module’s tests look for them |
Most of these live in build-logic/src/test/, which ./gradlew :build-logic:test runs. The ArchUnit pair lives in :widgets, because that is the module whose test classpath holds the whole graph.
The export list and the layout probe
natives/src/main/cmake/exports/goldberry.symbols is the list of symbols libgoldberry exports, and the library exports exactly those and nothing else. The file states its own rule: a symbol bound in Java but missing here fails at load time, and a symbol here that nothing binds is dead weight. ExportListTest enforces both halves by reading the two files as text. It needs no library, because the question is what the source says.
The bindings are hand-written rather than generated. The check that rests on is the layout probe: libgoldberry exports a table of every struct’s size and every field’s offset, and LayoutVerificationTest compares it against what the Java side declares. It needs a built library, so it skips without one and fails under -Dgoldberry.native.required=true. CI’s verify legs pass that flag on every platform.