jerryshao commented on code in PR #15131:
URL: https://github.com/apache/gravitino/pull/15131#discussion_r4637459260
##########
bundles/aws-bundle/build.gradle.kts:
##########
@@ -18,14 +18,106 @@
* under the License.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+import java.util.zip.ZipEntry
+import java.util.zip.ZipFile
+import java.util.zip.ZipOutputStream
plugins {
`maven-publish`
id("java")
alias(libs.plugins.shadow)
}
+/**
+ * Removes the unrelocated Netty copy that aws-java-sdk-bundle (AWS SDK for
Java v1, pulled in by
+ * hadoop-aws) embeds under io/netty.
+ *
+ * A dependency constraint cannot replace classes that live inside another
jar. Left in place, those
+ * classes are merged with the standalone Netty jars used by the AWS SDK v2,
and the bundle ends up
+ * with classes and metadata of two different Netty releases. The standalone
Netty jars provide every
+ * module embedded in aws-java-sdk-bundle, and the embedded classes are binary
compatible with them
+ * within the 4.1 line, so removing the embedded copy leaves a single Netty
release in the bundle.
+ * Other jars pass through unchanged.
+ */
+@CacheableTransform
+abstract class StripEmbeddedNettyTransform :
TransformAction<TransformParameters.None> {
+ companion object {
+ val STRIPPED: Attribute<Boolean> =
+ Attribute.of("org.apache.gravitino.embedded-netty-stripped",
Boolean::class.javaObjectType)
+ const val EMBEDDING_JAR_PREFIX = "aws-java-sdk-bundle-"
+ private val NETTY_ENTRY_PREFIXES = listOf(
+ "io/netty/",
Review Comment:
[P1] In aws-java-sdk-bundle-1.12.367.jar, the embedded Netty classes are
already relocated to `com/amazonaws/thirdparty/io/netty/`; there are no classes
under `io/netty/`. This filter therefore removes the 4.1.86 metadata but leaves
the old implementation intact. AWS callers such as `PutMediaHandlerInitializer`
still reference that namespace, so the standalone 4.1.140 jars do not replace
it. Please implement a replacement that also handles those caller references,
or retain the metadata and exemptions until this embedded copy is addressed.
Add a regression check covering the AWS-shaded implementation rather than
relying only on `pom.properties`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]