Skip to content

Commit 70e1a9f

Browse files
committed
Keep packaging optimization independently consumable
1 parent 385dada commit 70e1a9f

3 files changed

Lines changed: 2 additions & 42 deletions

File tree

‎SimpleAPI/pom.xml‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@
9797
</includes>
9898
</configuration>
9999
</execution>
100-
<execution>
101-
<id>thin-library</id>
102-
<phase>package</phase>
103-
<goals><goal>jar</goal></goals>
104-
<configuration>
105-
<classifier>thin</classifier>
106-
</configuration>
107-
</execution>
108100
<execution>
109101
<id>shared-library-sources</id>
110102
<phase>package</phase>
@@ -208,7 +200,6 @@
208200
<reportsDirectory>${project.build.directory}/full-artifact-reports</reportsDirectory>
209201
<systemPropertyVariables>
210202
<simpleapi.fullJar>${project.build.directory}/${project.build.finalName}.jar</simpleapi.fullJar>
211-
<simpleapi.thinJar>${project.build.directory}/${project.build.finalName}-thin.jar</simpleapi.thinJar>
212203
</systemPropertyVariables>
213204
</configuration>
214205
</execution>

‎SimpleAPI/src/test/java/com/bencodez/simpleapi/tests/packaging/FullArtifactTest.java‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,6 @@ public class FullArtifactTest {
6262
Files.size(full), retainedEntries, removedEntries, removedCompressedBytes);
6363
}
6464

65-
@Test void thinArtifactContainsProjectClassesWithoutEmbeddedDependencies() throws Exception {
66-
Path thin = thinJar();
67-
try (JarFile artifact = new JarFile(thin.toFile())) {
68-
assertNotNull(artifact.getEntry("com/bencodez/simpleapi/servercomm/http/HttpTlsIdentity.class"),
69-
"Thin artifact must preserve the complete SimpleAPI API");
70-
assertNotNull(artifact.getEntry("com/bencodez/simpleapi/scheduler/BukkitScheduler.class"));
71-
assertNull(artifact.getEntry("org/bouncycastle/jce/provider/BouncyCastleProvider.class"));
72-
assertNull(artifact.getEntry("com/zaxxer/hikari/HikariDataSource.class"));
73-
assertNull(artifact.getEntry("redis/clients/jedis/Jedis.class"));
74-
assertNull(artifact.getEntry("org/spongepowered/configurate/ConfigurationNode.class"));
75-
assertFalse(artifact.stream().anyMatch(entry -> entry.getName().startsWith("META-INF/versions/")));
76-
}
77-
System.out.printf("Thin artifact: %,d bytes (project classes only)%n", Files.size(thin));
78-
}
79-
8065
@Test void packagedTlsWorksWithoutMavenDependencies() throws Exception {
8166
Path full = fullJar();
8267
String fixtureName = PackagedTlsSmoke.class.getName();
@@ -120,11 +105,4 @@ private static Path fullJar() {
120105
return full;
121106
}
122107

123-
private static Path thinJar() {
124-
String value = System.getProperty("simpleapi.thinJar");
125-
assertNotNull(value, "Run this test through the Maven package lifecycle");
126-
Path thin = Path.of(value).toAbsolutePath().normalize();
127-
assertTrue(Files.isRegularFile(thin), "Missing packaged thin artifact: " + thin);
128-
return thin;
129-
}
130108
}

‎docs/jar-packaging.md‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
`shared-sources` classifiers, dependency scopes, and public APIs are unchanged.
55
There are no additional modules or runtime downloads.
66

7-
The `thin` classifier contains the complete, unshaded SimpleAPI classes and
8-
resources but no embedded third-party classes. It exists for trusted downstream
9-
projects that immediately shade SimpleAPI while explicitly controlling the
10-
ordinary POM's transitive dependencies. It is not a standalone replacement for
11-
the full artifact. In particular, a consumer of HTTP/TLS APIs must still supply
12-
the declared Bouncy Castle libraries. Normal external consumers should continue
13-
to use the self-contained main artifact.
14-
157
The HTTP transport uses Bouncy Castle for its private CA and certificates.
168
Do not remove those dependencies, switch them to `provided`, strip provider
179
mappings, or enable broad `minimizeJar` without packaged-runtime validation.
@@ -38,9 +30,8 @@ git diff --check
3830

3931
The package phase runs `FullArtifactTest` after shading, followed by the existing
4032
shared-classpath tests. It verifies the non-multi-release manifest, absence of
41-
all unreachable versioned payload, preservation of every base
42-
`org/bouncycastle/` entry from the three resolved BC libraries, and the thin
43-
artifact's no-embedded-dependencies contract. It prints the final JAR size and the
33+
all unreachable versioned payload and preservation of every base
34+
`org/bouncycastle/` entry from the three resolved BC libraries. It prints the final JAR size and the
4435
compressed upstream payload omitted. That payload counter is not an exact
4536
before/after distribution size: shading/recompression and ZIP overhead differ.
4637
To measure the exact reduction, compare clean baseline and candidate builds with

0 commit comments

Comments
 (0)