Add offline jdt2jar CLI and distroless packaging#148
Conversation
Agent-Logs-Url: https://github.com/simbo1905/java.util.json.Java21/sessions/46541410-0395-47ca-bf41-41ba6d0a8dc6 Co-authored-by: simbo1905 <322608+simbo1905@users.noreply.github.com>
Agent-Logs-Url: https://github.com/simbo1905/java.util.json.Java21/sessions/46541410-0395-47ca-bf41-41ba6d0a8dc6 Co-authored-by: simbo1905 <322608+simbo1905@users.noreply.github.com>
Agent-Logs-Url: https://github.com/simbo1905/java.util.json.Java21/sessions/46541410-0395-47ca-bf41-41ba6d0a8dc6 Co-authored-by: simbo1905 <322608+simbo1905@users.noreply.github.com>
…d CI Docker builds - Move Dockerfile from repo root to jdt2jar/ (built with -f jdt2jar/Dockerfile .) - Add jdt2jar/.dockerignore to exclude build artifacts - Rewrite jdt2jar/README.md with full Docker/GHCR usage instructions - Update root README.md to signpost to jdt2jar submodule for optional tool - Add docker-build job to ci.yml (Java 25, smoke test) - Add docker-build job to maven.yml (Java 25, smoke test after tests pass) - Add docker-publish job to release-on-tag.yml (pushes version + latest to ghcr.io) - Release notes now include Docker image pull commands How to verify: docker build -t jdt2jar -f jdt2jar/Dockerfile . docker run --rm jdt2jar --help
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc652d4f79
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,21 @@ | |||
| # Build outputs | |||
There was a problem hiding this comment.
Move Docker ignore rules to active build context
This ignore file is never applied by the current CI/release Docker builds because they invoke docker build with context: . (repository root), and Docker only reads .dockerignore from the context root (or a Dockerfile.dockerignore companion). As a result, large/sensitive files (for example .git/, .env, and local artifacts) are still sent in build context despite being listed here, which increases build time and can leak unintended content into remote builders.
Useful? React with 👍 / 👎.
|
|
||
| private static Path sourcePathFor(Path output) { | ||
| final var name = output.getFileName().toString(); | ||
| final var sourceName = name.endsWith(".jar") ? name.substring(0, name.length() - 4) + ".java" : name + ".java"; |
There was a problem hiding this comment.
Derive companion source filename from class name
The --include-sources output path is computed from the JAR filename (widget-validator.java) instead of the generated public class name (WidgetValidator), so the emitted source is not directly compilable: javac fails with “public class ... should be declared in a file named ...”. This breaks the advertised source-emission workflow whenever --class differs from the output JAR basename.
Useful? React with 👍 / 👎.
- Root README: module table distinguishes interpreter (infrequent config) vs codegen (hot-path) - json-java21-jtd/README: documents config-parsing use case, links to codegen - json-java21-jtd-codegen/README: documents hot-path use case, links to interpreter - jdt2jar/README: documents build-time pre-compilation bridging both paths - All three sub-READMEs note JDK incubator future direction
- Interpreter module (json-java21-jtd): JtdValidator.compileInterpreter() replaces deprecated compile() - Codegen module (json-java21-jtd-codegen): new JtdValidator.compileGenerated() in own package - Generated bytecode implements json.java21.jtd.codegen.JtdValidator (not interpreter's interface) - ValidatorMain uses codegen's JtdValidator for generated validators - Jdt2Jar bundles codegen's JtdValidator.class in output JARs - All tests updated to use new method names - pom.xml: -Werror + showDeprecation across all modules - READMEs updated with clear two-path guidance How to verify: jenv local 21 && ./mvnw test -pl json-java21-jtd -am jenv local 25 && ./mvnw test -pl json-java21-jtd,json-java21-jtd-codegen -am
…Generated test from interpreter module)
The JTD codegen path now has an offline packaging flow that turns a schema into a standalone validator JAR at build time. The repo also ships a minimal distroless container for running the compiler without a full JDK in the final image.
What changed
jdt2jarmodule with a shaded CLI that:--output,--package,--class,--main, and--include-sourcesjava -jarentrypoint.jlinkruntime and packages it into the container image.Why this change is needed
How were these changes tested
Checklist
CODING_STYLE_LLM.mdconvensionsAGENTS.mdupdated if appropriate