Skip to content

Commit 35e853e

Browse files
committed
fix(examples): stop the decks publishing a -SNAPSHOT coordinate, and name 2.1.1 in the README
The committed engine decks rendered "v2.1.1-SNAPSHOT" - on the hero pill, in the every-page footer and in the PDF metadata - so the asset the README links to advertised a coordinate nobody can resolve. Example documents are regenerated whenever their content changes, not only at a release, and the reactor version carries a qualifier between cuts. The strip already existed, privately, in one deck: EngineDeckExample open-coded replaceFirst("-.*$", "") for its version pill and interpolated the raw value everywhere else, and the v2 deck never inherited it. It moves to ExampleVersion.withoutQualifier(), the v1 deck drops its own duplicate banner.properties loader, and every rendered site now goes through the one accessor. ExampleVersionTest pins it: removing the strip turns two of its three tests red. The four committed decks are regenerated and carry no qualifier. README's "Latest stable" block names v2.1.1. cut-release.ps1 deliberately does not rewrite that prose and aborts at Step 0 when it disagrees with the version being cut.
1 parent a099c69 commit 35e853e

9 files changed

Lines changed: 63 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</p>
2121

2222
> **Release status** &mdash;
23-
> 🟢 **Latest stable**: [v2.1.0](https://github.com/DemchaAV/GraphCompose/releases/tag/v2.1.0) &mdash; the **PowerPoint** release: `graph-compose-render-pptx` turns the same resolved layout into an editable deck &mdash; one page per slide, geometry-identical to the PDF, text and panels as native shapes. Ships as `@Beta`. **[What each backend supports &darr;](docs/architecture/backend-capability-matrix.md)**
23+
> 🟢 **Latest stable**: [v2.1.1](https://github.com/DemchaAV/GraphCompose/releases/tag/v2.1.1) &mdash; the **PowerPoint** release: `graph-compose-render-pptx` turns the same resolved layout into an editable deck &mdash; one page per slide, geometry-identical to the PDF, text and panels as native shapes. Ships as `@Beta`. **[What each backend supports &darr;](docs/architecture/backend-capability-matrix.md)**
2424
2525
> &nbsp;·&nbsp; ⬆️ **Upgrading from 1.x?** `graph-compose` stays a drop-in for PDF with no code change; see the [2.0 modules migration guide](./docs/migration/v2.0.0-modules.md)
2626
> &nbsp;·&nbsp; See [API stability policy](./docs/api-stability.md) for tier definitions.
-18 Bytes
Binary file not shown.
-69 Bytes
Binary file not shown.

examples/src/main/java/com/demcha/examples/flagships/EngineDeckExample.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.demcha.compose.document.svg.SvgIcon;
4848
import com.demcha.compose.font.FontName;
4949
import com.demcha.examples.support.ExampleOutputPaths;
50+
import com.demcha.examples.support.ExampleVersion;
5051

5152
import java.awt.image.BufferedImage;
5253
import java.io.IOException;
@@ -112,7 +113,7 @@ public final class EngineDeckExample {
112113
* filtering (e.g. straight from an IDE), so the banner never prints the raw
113114
* {@code @…@} token.
114115
*/
115-
private static final String VERSION;
116+
private static final String VERSION = ExampleVersion.withoutQualifier();
116117
private static final String CODENAME;
117118

118119
static {
@@ -122,9 +123,8 @@ public final class EngineDeckExample {
122123
banner.load(in);
123124
}
124125
} catch (IOException ignored) {
125-
// Missing/unreadable metadata falls through to the defaults below.
126+
// Missing/unreadable metadata falls through to the default below.
126127
}
127-
VERSION = resolved(banner.getProperty("version"), "dev");
128128
CODENAME = resolved(banner.getProperty("codename"), "");
129129
}
130130

@@ -411,10 +411,10 @@ private static DocumentNode brandLine() {
411411

412412
/** Version pill ("v1.8.0") with the codename centred beside it as a tag. */
413413
private static DocumentNode versionBlock() {
414-
// Show the base version only: a dev/pre-release qualifier ("2.0.0-SNAPSHOT",
415-
// "2.0.0-beta.1") is wider than the 96pt pill, and the engine wraps long
416-
// tokens at their "." / "-" seams — the pill would break onto two lines.
417-
String pillVersion = VERSION.replaceFirst("-.*$", "");
414+
// VERSION already carries no qualifier: one would be wider than the 96pt
415+
// pill, and the engine wraps long tokens at their "." / "-" seams, so the
416+
// pill would break onto two lines.
417+
String pillVersion = VERSION;
418418
DocumentNode pill = new ShapeContainerBuilder().name("VerPill")
419419
.roundedRect(96, 30, 8).fillColor(VIOLET_DEEP)
420420
.center(new ParagraphBuilder().text("v" + pillVersion)

examples/src/main/java/com/demcha/examples/flagships/EngineDeckV2Example.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public final class EngineDeckV2Example {
113113
private static final DocumentColor PALE_BLUE = DocumentColor.rgb(232, 243, 255);
114114
private static final DocumentColor PALE_MINT = DocumentColor.rgb(230, 249, 242);
115115

116-
private static final String VERSION = ExampleVersion.current();
116+
private static final String VERSION = ExampleVersion.withoutQualifier();
117117

118118
/**
119119
* The {@code major.minor} of {@link #VERSION}, for the banner's prose labels.

examples/src/main/java/com/demcha/examples/support/ExampleVersion.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ public static String currentLine() {
4444
return majorMinor(CURRENT);
4545
}
4646

47+
/**
48+
* {@link #current()} without any pre-release qualifier: {@code "2.1.1"} for
49+
* {@code "2.1.1-SNAPSHOT"}.
50+
*
51+
* <p>Example documents are regenerated whenever their content changes, not
52+
* only at a release, so between cuts the reactor version carries a
53+
* {@code -SNAPSHOT} suffix. Rendering that suffix publishes a coordinate
54+
* nobody can resolve, and the committed decks did exactly that after an
55+
* off-cycle refresh. Anything a reader sees goes through here.</p>
56+
*
57+
* @return the version up to the first {@code -}
58+
*/
59+
public static String withoutQualifier() {
60+
return CURRENT.replaceFirst("-.*$", "");
61+
}
62+
4763
/**
4864
* Reduces a version to its {@code major.minor} prefix.
4965
*
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.demcha.examples.support;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.assertj.core.api.Assertions.assertThat;
6+
7+
/**
8+
* Guards the version string the published example documents render.
9+
*
10+
* <p>Example PDFs are regenerated whenever their content changes, not only at a
11+
* release, so between cuts the reactor version carries {@code -SNAPSHOT}. That
12+
* suffix reached the committed decks once already, which meant the README-linked
13+
* asset advertised a coordinate nobody could resolve. The strip lived privately
14+
* in one deck and the other never inherited it; it is shared now, and this is
15+
* what keeps a future caller from reaching for {@code current()} by habit.</p>
16+
*/
17+
class ExampleVersionTest {
18+
19+
@Test
20+
void theRenderedVersionCarriesNoPreReleaseQualifier() {
21+
assertThat(ExampleVersion.withoutQualifier())
22+
.describedAs("published examples must not render a -SNAPSHOT or -rc coordinate")
23+
.doesNotContain("-");
24+
}
25+
26+
@Test
27+
void itKeepsTheReleaseDigitsIntact() {
28+
assertThat(ExampleVersion.withoutQualifier())
29+
.describedAs("stripping the qualifier must not eat the version itself")
30+
.isEqualTo(ExampleVersion.current().replaceFirst("-.*$", ""));
31+
}
32+
33+
@Test
34+
void theLineIsTheLeadingMajorMinor() {
35+
assertThat(ExampleVersion.majorMinor("2.1.1-SNAPSHOT")).isEqualTo("2.1");
36+
assertThat(ExampleVersion.majorMinor("dev")).isEqualTo("dev");
37+
}
38+
}
-18 Bytes
Binary file not shown.
-69 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)