build: extract the PDF backend into graph-compose-render-pdf#303
Merged
Conversation
2.0's lean-core goal: a consumer that does not render PDF should not pull PDFBox. Move the entire PDF backend out of the engine into a new graph-compose-render-pdf module, leaving graph-compose-core with zero org.apache.pdfbox. The graph-compose wrapper depends on render-pdf, so a bare graph-compose still renders PDF unchanged. - New graph-compose-render-pdf: the fixed-layout PDF backend (document.backend.fixed.pdf.**) and the engine.render.pdf.** render tree (the ecs system, helpers, PdfFont), plus the two ServiceLoader provider implementations and their META-INF/services files. PDFBox, zxing (barcodes), and the commons-logging->SLF4J bridge leave the root pom and live here. - graph-compose-core keeps the DocumentSession API, the ServiceLoader seam (FixedLayoutBackendProvider / FontMetricsProvider), and the PDFBox-free pdf.options value classes. It throws MissingBackendException (naming render-pdf) if asked to render, rasterize, or measure without a backend on the classpath. - FontShowcase, a DSL-based preview builder, moves to com.demcha.compose.document.showcase (it cannot live in the backend-neutral font catalog); the GraphCompose.renderAvailableFontsPreview() facade stays. - The wrapper depends on render-pdf; render-docx / render-pptx add it at test scope (their export lays out through the moved metrics provider); benchmarks add it at compile scope; examples get it transitively via the wrapper. - Test relocation: the render harness and the backend's own tests move to render-pdf/src/test (which builds a tests-classifier jar); the core-functionality render suites move to graph-compose-qa (which consumes that jar and gains javafx for the dev-preview tool). MissingBackendContractTest guards the lean-core contract in core's backend-free scope. - Wired into the aggregator, the CI build gate, publish, cut-release, and VersionConsistencyGuardTest.
The benchmarks module now depends on graph-compose-render-pdf (it calls buildPdf and references the backend types), so the two benchmark CI jobs must install it into the local repo after the core, or dependency resolution fails before compile — the same pattern as the fonts/emoji/core install steps already there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
2.0's lean-core goal: a consumer that doesn't render PDF shouldn't pull PDFBox. This
moves the entire PDF backend out of the engine into a new
graph-compose-render-pdf, leavinggraph-compose-corewith zero PDFBox. Thegraph-composewrapper depends on render-pdf, so a baregraph-composestill rendersPDF unchanged.
What
graph-compose-render-pdf— the fixed-layout backend(
document.backend.fixed.pdf.**) and theengine.render.pdf.**render tree (ecs,helpers,
PdfFont), the twoServiceLoaderprovider impls +META-INF/services.PDFBox, zxing, and the commons-logging→SLF4J bridge leave the root pom and live here.
graph-compose-corekeeps theDocumentSessionAPI, the SPI seam(
FixedLayoutBackendProvider/FontMetricsProvider), and the PDFBox-freepdf.optionsDTOs. It throwsMissingBackendException(naming render-pdf) if askedto render/measure without a backend — a new
MissingBackendContractTestguards this.FontShowcase(a DSL preview builder) moves todocument.showcase; theGraphCompose.renderAvailableFontsPreview()facade stays (javadoc now notes abackend is required).
test scope (their export lays out via the moved metrics provider); benchmarks at
compile scope; examples transitively via the wrapper.
the core-functionality render suites → qa (consumes the harness jar, gains javafx
for the dev tool). Repo-root asset paths go through a shared
RepoPathswalk-uphelper.
Tests
./mvnw -f aggregator/pom.xml clean verify→ BUILD SUCCESS, all 13modules, all tests, guards, and the javadoc gate. Core is PDFBox-free and builds
standalone; the snapshot/visual suites pass from their new homes (renders
byte-identical); a bare
graph-composerenders PDF via the wrapper.