Skip to content

Commit 91e0ef8

Browse files
authored
test(build): add no-poi Maven profile to validate poi-ooxml stays optional (I1) (#91)
Wires up Track I1 from the readiness taskboard. poi-ooxml is declared optional in pom.xml; this PR adds the regression gate that proves the rest of the canonical suite runs without it. Profile: -P no-poi excludes poi-ooxml + poi + poi-ooxml-lite from surefire classpath via classpathDependencyExcludes and sets no.poi=true system property. DocxSemanticBackendTest (whole class) and DocumentSessionTest#semanticBackendsShouldExportManifestsFromDocumentGraph carry @DisabledIfSystemProperty so they skip cleanly. New no-poi-suite CI job runs the profile on every PR. Local run: 1029 tests, 0 failures, 4 skipped under -P no-poi.
1 parent 852d839 commit 91e0ef8

5 files changed

Lines changed: 86 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,34 @@ jobs:
118118
path: examples/target/generated-pdfs/**
119119
if-no-files-found: error
120120

121+
no-poi-suite:
122+
name: Test suite without poi-ooxml (optional-deps regression)
123+
if: github.event_name == 'pull_request'
124+
needs: architecture-and-documentation-guards
125+
runs-on: ubuntu-latest
126+
env:
127+
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
128+
129+
steps:
130+
- name: Check out repository
131+
uses: actions/checkout@v6
132+
133+
- name: Set up Temurin JDK 17
134+
uses: actions/setup-java@v5
135+
with:
136+
distribution: temurin
137+
java-version: '17'
138+
cache: maven
139+
140+
- name: Run suite under -P no-poi
141+
# poi-ooxml is declared <optional>true</optional>; this job
142+
# validates that callers who don't render DOCX still get a
143+
# green suite without the POI footprint. Tests that require
144+
# poi (DocxSemanticBackend output) carry
145+
# @DisabledIfSystemProperty(named = "no.poi", matches = "true")
146+
# and skip cleanly. See Track I1 in the readiness taskboard.
147+
run: ./mvnw -B -ntp test -pl . -P no-poi
148+
121149
binary-compat:
122150
name: Binary Compatibility (japicmp vs v1.6.5)
123151
if: github.event_name == 'pull_request'

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ JitPack continue to resolve through the existing coordinates.
3434
excluded by convention (`InternalAnnotationCoverageTest` covers those).
3535
Method-level `@since` backfill for the ~380 public methods in these
3636
packages is intentionally out of scope here and tracked separately.
37+
- **`no-poi` Maven profile + CI job** (Track I1). The `poi-ooxml`
38+
dependency is declared `<optional>true</optional>` so callers that
39+
render only PDFs don't pay the ~10 MB POI footprint; this PR adds a
40+
regression gate that proves it. Running `./mvnw -P no-poi test -pl .`
41+
excludes `poi-ooxml` (and its `poi` / `poi-ooxml-lite` transitives)
42+
from the surefire test classpath and sets the system property
43+
`no.poi=true`. DOCX-specific tests (`DocxSemanticBackendTest` and the
44+
one DOCX export in `DocumentSessionTest`) now carry
45+
`@DisabledIfSystemProperty(named = "no.poi", matches = "true")` and
46+
skip cleanly. The rest of the canonical suite (1029 tests, 4 skipped
47+
under `-P no-poi`) runs green without POI on the classpath. A new
48+
`no-poi-suite` CI job exercises the profile on every pull request.
3749

3850
### Public API
3951

pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,39 @@
361361
</build>
362362

363363
<profiles>
364+
<!--
365+
Optional-deps regression: runs the canonical suite with
366+
`poi-ooxml` (and its transitives) excluded from the test
367+
classpath, so callers that don't render DOCX validate that
368+
our DocxSemanticBackend is genuinely optional. Tests that
369+
require POI carry @DisabledIfSystemProperty(named = "no.poi",
370+
matches = "true") and skip cleanly under this profile.
371+
Activate with `-P no-poi`. Tracked in v1.6.6 stabilization
372+
(Track I1).
373+
-->
374+
<profile>
375+
<id>no-poi</id>
376+
<build>
377+
<plugins>
378+
<plugin>
379+
<groupId>org.apache.maven.plugins</groupId>
380+
<artifactId>maven-surefire-plugin</artifactId>
381+
<version>${maven.surefire.plugin.version}</version>
382+
<configuration>
383+
<classpathDependencyExcludes>
384+
<classpathDependencyExclude>org.apache.poi:poi-ooxml</classpathDependencyExclude>
385+
<classpathDependencyExclude>org.apache.poi:poi</classpathDependencyExclude>
386+
<classpathDependencyExclude>org.apache.poi:poi-ooxml-lite</classpathDependencyExclude>
387+
</classpathDependencyExcludes>
388+
<systemPropertyVariables>
389+
<no.poi>true</no.poi>
390+
</systemPropertyVariables>
391+
</configuration>
392+
</plugin>
393+
</plugins>
394+
</build>
395+
</profile>
396+
364397
<!--
365398
Binary-compatibility baseline against the last published
366399
release. Activated with `-P japicmp`. Resolves the baseline

src/test/java/com/demcha/compose/document/api/DocumentSessionTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import org.apache.pdfbox.pdmodel.PDPage;
7474
import org.apache.pdfbox.pdmodel.common.PDRectangle;
7575
import org.junit.jupiter.api.Test;
76+
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
7677
import org.apache.pdfbox.rendering.PDFRenderer;
7778
import org.apache.pdfbox.text.PDFTextStripper;
7879

@@ -681,6 +682,8 @@ public List<String> render(LayoutGraph graph, FixedLayoutRenderContext context)
681682
}
682683

683684
@Test
685+
@DisabledIfSystemProperty(named = "no.poi", matches = "true",
686+
disabledReason = "Exercises DocxSemanticBackend; skipped under the no-poi profile that excludes poi-ooxml from the test classpath")
684687
void semanticBackendsShouldExportManifestsFromDocumentGraph() throws Exception {
685688
try (DocumentSession session = GraphCompose.document()
686689
.pageSize(200, 200)

src/test/java/com/demcha/compose/document/backend/semantic/DocxSemanticBackendTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@
1414
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
1515
import org.apache.poi.xwpf.usermodel.XWPFTable;
1616
import org.junit.jupiter.api.Test;
17+
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
1718

1819
import java.io.ByteArrayInputStream;
1920
import java.util.List;
2021

2122
import static org.assertj.core.api.Assertions.assertThat;
2223

24+
/**
25+
* DOCX semantic backend output. Skipped under the {@code -P no-poi}
26+
* profile, where {@code poi-ooxml} is intentionally absent from the
27+
* test classpath to validate that consumers who don't render DOCX can
28+
* still build and run the canonical suite without the optional POI
29+
* footprint (Track I1).
30+
*/
31+
@DisabledIfSystemProperty(named = "no.poi", matches = "true",
32+
disabledReason = "DocxSemanticBackend requires poi-ooxml; the no-poi profile validates the rest of the suite without it")
2333
class DocxSemanticBackendTest {
2434

2535
@Test

0 commit comments

Comments
 (0)