diff --git a/AdvancedCore/pom.xml b/AdvancedCore/pom.xml index b26f1feac..6ab3ea49d 100644 --- a/AdvancedCore/pom.xml +++ b/AdvancedCore/pom.xml @@ -107,6 +107,16 @@ META-INF/*.SF META-INF/*.DSA META-INF/*.RSA + + META-INF/versions/** + module-info.class + + org/checkerframework/** + org/jspecify/** + + META-INF/maven/**/pom.xml + META-INF/maven/**/pom.properties diff --git a/AdvancedCore/src/test/java/com/bencodez/advancedcore/tests/packaging/PackagedArtifactTest.java b/AdvancedCore/src/test/java/com/bencodez/advancedcore/tests/packaging/PackagedArtifactTest.java index d8c1e0d18..660b899ed 100644 --- a/AdvancedCore/src/test/java/com/bencodez/advancedcore/tests/packaging/PackagedArtifactTest.java +++ b/AdvancedCore/src/test/java/com/bencodez/advancedcore/tests/packaging/PackagedArtifactTest.java @@ -30,10 +30,29 @@ void keepsRequiredClassesAndRelocations() throws Exception { assertNotNull(artifact.getEntry("com/bencodez/simpleapi/folialib/FoliaLib.class")); assertNotNull(artifact.getEntry("com/bencodez/simpleapi/hikari/HikariDataSource.class")); assertNotNull(artifact.getEntry("com/bencodez/advancedcore/rhino/Context.class")); + // The normal published AdvancedCore JAR must retain the transport APIs + // embedded in SimpleAPI; downstream consumers load these in isolation. + assertNotNull(artifact.getEntry("redis/clients/jedis/HostAndPort.class")); + assertNotNull(artifact.getEntry("org/eclipse/paho/client/mqttv3/MqttClient.class")); + assertNotNull(artifact.getEntry("com/bencodez/simpleapi/servercomm/http/HttpTlsIdentity.class")); assertNull(artifact.getEntry("com/tcoded/folialib/FoliaLib.class")); assertNull(artifact.getEntry("com/zaxxer/hikari/HikariDataSource.class")); assertNull(artifact.getEntry("org/mozilla/javascript/Context.class")); + assertTrue(artifact.getManifest() != null); + assertTrue(!"true".equalsIgnoreCase( + artifact.getManifest().getMainAttributes().getValue("Multi-Release")), + "Versioned implementations cannot be filtered from a multi-release JAR"); + assertTrue(artifact.stream().noneMatch(entry -> entry.getName().startsWith("META-INF/versions/") + || entry.getName().equals("module-info.class")), + "The shaded distribution must not contain unreachable module payload"); + assertTrue(artifact.stream().noneMatch(entry -> entry.getName().startsWith("org/checkerframework/") + || entry.getName().startsWith("org/jspecify/")), + "Optional annotation libraries should not be embedded"); + assertTrue(artifact.stream().noneMatch(entry -> entry.getName().startsWith("META-INF/maven/") + && (entry.getName().endsWith("/pom.xml") + || entry.getName().endsWith("/pom.properties"))), + "Dependency Maven descriptors should not be embedded"); } System.out.printf("AdvancedCore packaged artifact: %,d bytes; required classes and relocations retained%n", Files.size(artifactPath)); diff --git a/docs/jar-packaging.md b/docs/jar-packaging.md index f79c86596..f2d5ee3f1 100644 --- a/docs/jar-packaging.md +++ b/docs/jar-packaging.md @@ -21,3 +21,27 @@ applies its own narrow artifact filters when producing its smaller user-facing distribution. Deployment profiles use the same Shade configuration; only publication/final-name behavior differs. + +## Additional safe-to-test size filtering + +The normal AdvancedCore artifact embeds SimpleAPI's full published +implementation and must retain its legacy Redis classes, HTTP TLS classes, +and MQTT classes for downstream consumers, even though AdvancedCore itself does +not call those transports. Do not strip them solely on local source reachability. + +The shaded JAR is not a multi-release JAR or JPMS module, so the Maven Shade +filters omit `META-INF/versions/**` and root `module-info.class`. Redundant +dependency `META-INF/maven/**/pom.xml` and `pom.properties` descriptions +are also omitted; service files, version fallbacks, licenses, native resources, +and deployed plugin metadata remain. + +Checker Framework and JSpecify annotation implementation packages are filtered +from the shaded JAR, rather than changing the Java dependency graph or published +method signatures. If an external consumer compiles directly against those +annotation types, it must declare the separate annotation dependency; that +source-compatibility edge remains a review consideration. + +Use `mvn -B -f AdvancedCore/pom.xml clean package` and check both +`PackagedArtifactTest` and VotingPlugin's packaged producer-compatibility test +before accepting an artifact change. The suite exercises class loading but does +not substitute for live Bukkit/Paper/Folia startup validation.