Skip to content

Java bindings target in generate.mk - #7114

Closed
Fedr wants to merge 1 commit into
rust-bindings-targetfrom
java-bindings-target
Closed

Fedr wants to merge 1 commit into
rust-bindings-targetfrom
java-bindings-target

Conversation

@Fedr

@Fedr Fedr commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

TARGET=java in scripts/mrbind/generate.mk, on top of the Java generator from MeshInspector/mrbind#55, the same way #7104 added TARGET=rust. Stacked on #7104.

What it does

  • make -f scripts/mrbind/generate.mk TARGET=java consumes the C bindings description JSON (so TARGET=c must run first, as for C# and Rust), generates the sources into source/MeshLibJava/src (--package meshlib --force-namespace MR, so the API is meshlib.mr.Mesh, meshlib.mr.Functions.makeCube(...), ...), compiles them with -Xlint:all -Werror, and packs source/MeshLibJava/meshlib.jar. All of that is ignored by git; only a README is committed in source/MeshLibJava. The bindings use the foreign function API of Java 22, so the jar has no native code of its own: at runtime the MeshLib shared libraries must be in java.library.path.
  • examples/java-examples: MeshBoolean, MeshDecimate and MeshLoadSave, ported from the Rust examples. They're compiled with plain javac, no build system.
  • source/MRTestJava: the 92 tests of MRTestRust, ported 1:1. Also plain javac, with a 60-line runner instead of a test framework, to keep the bindings dependency-free.
  • CI: the same one Release job per OS and architecture that builds the Rust bindings now also builds the Java ones, runs MeshBoolean and the tests. .github/actions/setup-java downloads a Temurin JDK 25 into the runner's temp directory when the runner has no JDK 22+ (the GitHub-hosted images ship up to 21), like setup-rust does for cargo. build-mrbind keeps and strips mrbind_gen_java too.
  • The thirdparty/mrbind gitlink points at the head of Add a Java bindings generator on top of the C bindings mrbind#55, to be re-bumped after that PR merges.

Testing

Locally on Windows: generate_win.bat TARGET=java from the CI description JSON compiles all 37764 functions (3157 classes) in ~20 s with zero warnings, and 91 of the 92 tests pass against the 3.1.4 NuGet binaries (the one failure calls MR_computePerFaceNormals_1, which those binaries predate; the Rust tests have the same local failure). MeshBoolean runs and writes out_boolean.stl.

🤖 Generated with Claude Code

`TARGET=java` generates `source/MeshLibJava/src` with mrbind_gen_java, compiles
it and packs `meshlib.jar`. Examples and the 92 tests of MRTestRust ported to
Java, built with plain javac. CI runs them in the same Release jobs as Rust,
with a Temurin JDK 25 downloaded into the runner temp directory when needed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Fedr Fedr closed this Oct 13, 2026
@Fedr
Fedr deleted the java-bindings-target branch October 13, 2026 10:25
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