frankgh commented on code in PR #45:
URL: https://github.com/apache/cassandra-sidecar/pull/45#discussion_r1194430129


##########
vertx-client-shaded/build.gradle:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * The sole purpose of this sub-project is to produce a shaded package for the 
vertx-client. Currently,
+ * the shadow plugin has some limitations when producing a non-shaded and 
shaded versions of the jar.
+ */
+
+import 
com.github.jengelman.gradle.plugins.shadow.transformers.CacheableTransformer
+import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
+import 
com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext
+import shadow.org.apache.tools.zip.ZipEntry
+import shadow.org.apache.tools.zip.ZipOutputStream
+
+plugins {
+    id('java-library')
+    id('maven-publish')
+    id('com.github.johnrengelman.shadow') version '6.1.0'
+}
+
+group 'org.apache.cassandra.sidecar'
+version project.version
+
+sourceCompatibility = 1.8
+
+configurations {
+    all*.exclude(group: 'ch.qos.logback')
+}
+
+dependencies {
+    shadow(group: 'org.slf4j', name: 'slf4j-api', version: 
"${project.slf4jVersion}")
+    shadow(group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', 
version: '2.14.2')
+    api(project(':vertx-client'))
+}
+
+// Relocating a Package
+shadowJar {
+    archiveClassifier.set('')
+    relocate 'com.fasterxml.jackson.core', 
'o.a.c.sidecar.client.shaded.com.fasterxml.jackson.core'
+    relocate 'com.fasterxml.jackson.databind', 
'o.a.c.sidecar.client.shaded.com.fasterxml.jackson.databind'
+    relocate 'io.netty', 'o.a.c.sidecar.client.shaded.io.netty'
+    relocate 'io.vertx', 'o.a.c.sidecar.client.shaded.io.vertx'
+    relocate 'META-INF/native/libnetty', 
'META-INF/native/sidecar_client_netty_shaded_netty'
+    relocate 'META-INF/native/netty', 
'META-INF/native/io_sidecar_client_netty_shaded_netty'
+    relocate 'META-INF/versions/11/io/vertx', 
'META-INF/versions/11/o/a/c/sidecar/client/shaded/io/vertx'
+    transform(NettyResourceTransformer.class)
+    mergeServiceFiles()
+
+    dependencies {
+        exclude(dependency('org.slf4j:.*:.*'))
+        // Exclude the jackson-annotations dependency so that extension 
clients can keep annotating POJOs
+        // without the need to use shadow annotations. For example, they can 
continue using
+        // com.fasterxml.jackson.annotation.JsonProperty.
+        
exclude(dependency('com.fasterxml.jackson.core:jackson-annotations:.*'))
+    }
+}
+
+publishing {
+    publications {
+        shadow(MavenPublication) { publication ->
+            project.shadow.component(publication)
+
+            groupId project.group
+            artifactId "vertx-client-all"
+            version System.getenv("CODE_VERSION") ?: "${version}"
+        }
+    }
+}
+
+/**
+ * A Transformer which updates the Netty JAR META-INF/ resources to accurately
+ * reference shaded class names.
+ */
+@CacheableTransformer
+class NettyResourceTransformer implements Transformer {

Review Comment:
   this is just renaming netty directories in the fat jar :) 



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to