Skip to content

Add a Maven build-and-publish path for the Direct-BT fat jar (incl. reproducible multi-arch docker build) - #3

Open
vkolotov wants to merge 2 commits into
sgothel:masterfrom
vkolotov:maven-publish
Open

Add a Maven build-and-publish path for the Direct-BT fat jar (incl. reproducible multi-arch docker build)#3
vkolotov wants to merge 2 commits into
sgothel:masterfrom
vkolotov:maven-publish

Conversation

@vkolotov

@vkolotov vkolotov commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Direct-BT ships no binaries — the natives are built from source per-arch and there is no published Maven artifact. This PR adds a self-contained path to build the fat jar (for all supported architectures) and publish it to a Maven repository, so JVM/OSGi consumers can depend on org.direct_bt:direct-bt instead of locating a CMake-built jar by hand.

What's here

Publish (maven/)

  • maven/pom.xml — artifact metadata only (coordinates, license, scm, distribution target); builds no Java.
  • maven/publish.sh — takes the CMake-built fat jar + source zip and does a local install or a signed deploy.
  • maven/README.md — the single-arch and multi-arch build paths, local install, and public release.

Build (scripts/)

  • scripts/build-fatjar-multiarch.sh — builds the fat jar in a Debian container per target platform (docker + qemu binfmt) and merges the per-arch natives/<os_and_arch>/ trees into one multi-arch jar. A reproducible alternative to scripts/build-preset-cross.sh, which needs privately-mounted rootfs disk images.
  • scripts/docker/Dockerfile.fatjar + build-fatjar-in-container.sh — the per-arch build environment (clang toolchain per the README) and in-container build.

Architectures

Default linux/amd64 + linux/arm64/v8, both built and verified (each native asserted present and confirmed to be the correct ELF arch).

armhf is not in the default set: on 32-bit ARM sizeof(long double) == sizeof(double) == 8, so the two float_bytes<> specializations in jaulib/include/jau/int_types.hpp collapse to the same float_bytes<8> and clang rejects the redefinition. It can be re-enabled via --platforms once that is resolved in jaulib.

Adds a maven/ directory that publishes the Java library to a Maven
repository as org.direct_bt:direct-bt. The artifact is the fat jar already
produced by the CMake build (Java API plus the platform native libraries);
publish.sh attaches it and the source zip and runs install or
sign-and-deploy using maven/pom.xml for metadata.

This lets JVM and OSGi consumers depend on Direct-BT through Maven instead
of locating the CMake fat jar by hand. distributionManagement and the
deploy path are scaffolding for the maintainer to point at a repository
(Maven Central or any Nexus/Artifactory) and run with a signing key. No
existing build or sources are changed. See maven/README.md.
@vkolotov
vkolotov marked this pull request as ready for review June 25, 2026 21:38
publish.sh publishes the fat jar but the CMake build only ever emits the host
architecture. This adds scripts/build-fatjar-multiarch.sh: it builds the fat jar
in a Debian container per target platform (docker + qemu binfmt) and merges the
per-arch natives/<os_and_arch>/ trees into one multi-arch jar — the form a
published Maven artifact should take. It replaces the mounted-rootfs cross build
in build-preset-cross.sh, which needs private disk images.

Default architectures: linux/amd64 + linux/arm64/v8, both built and verified
(each native asserted present and confirmed to be the right ELF arch). armhf is
omitted by default: on 32-bit ARM sizeof(long double)==sizeof(double), so
jaulib's two float_bytes<> specializations collapse to float_bytes<8> and clang
rejects the redefinition — re-enable via --platforms once that is fixed upstream.

maven/README.md documents both the single-arch and multi-arch build paths.
@vkolotov vkolotov changed the title Add a Maven publish path for the Direct-BT Java library Add a Maven build-and-publish path for the Direct-BT fat jar (incl. reproducible multi-arch docker build) Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant