This is an automated email from the ASF dual-hosted git repository.

roryqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 84167c51 [#343] improvement(build): Shade Netty Native lib (#924)
84167c51 is described below

commit 84167c513692806e756ef9aa1d03a75436e2ced9
Author: Neo Chien <[email protected]>
AuthorDate: Sat Jun 10 12:01:10 2023 +0800

    [#343] improvement(build): Shade Netty Native lib (#924)
    
    ### What changes were proposed in this pull request?
    
    Add the shade Netty Native lib into` pom.xml`
    
    ### Why are the changes needed?
    
    Fix: #343
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    current UT
---
 client-mr/core/pom.xml      | 32 ++++++++++++++++++++++++++++++++
 client-spark/spark2/pom.xml | 32 ++++++++++++++++++++++++++++++++
 client-spark/spark3/pom.xml | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+)

diff --git a/client-mr/core/pom.xml b/client-mr/core/pom.xml
index eaa42c75..316462d8 100644
--- a/client-mr/core/pom.xml
+++ b/client-mr/core/pom.xml
@@ -208,6 +208,38 @@
                             </relocations>
                         </configuration>
                     </execution>
+                    <!-- shade the native netty libs as well -->
+                    <execution>
+                        <id>unpack</id>
+                        <phase>package</phase>
+                        <configuration>
+                            <target>
+                                <echo message="Shade netty native libraries to 
${rss.shade.packageName}" />
+                                <unzip src="${artifactId}-${version}.jar" 
dest="${project.build.directory}/unpacked/" />
+                                <echo message="renaming native epoll 
library"></echo>
+                                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                                    <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                                    <mapper 
from="libnetty_transport_native_epoll_x86_64.so"
+                                            
to="lib${rss.shade.packageName}_shaded_netty_transport_native_epoll_x86_64.so"
+                                            type="glob"></mapper>
+                                </move>
+                                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                                    <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                                    <mapper 
from="libnetty_transport_native_epoll_aarch_64.so"
+                                            
to="lib${rss.shade.packageName}_shaded_netty_transport_native_epoll_aarch_64.so"
+                                            type="glob"></mapper>
+                                </move>
+                                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                                    <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                                    <mapper 
from="libnetty_transport_native_kqueue_x86_64.jnilib"
+                                            
to="lib${rss.shade.packageName}_shaded_netty_transport_native_kqueue_x86_64.jnilib"
+                                            type="glob"></mapper>
+                                </move>
+                                <echo message="repackaging netty jar"></echo>
+                                <jar destfile="${artifactId}-${version}.jar" 
basedir="${project.build.directory}/unpacked" />
+                            </target>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
         </plugins>
diff --git a/client-spark/spark2/pom.xml b/client-spark/spark2/pom.xml
index 20e9d531..0b25cbf1 100644
--- a/client-spark/spark2/pom.xml
+++ b/client-spark/spark2/pom.xml
@@ -175,6 +175,38 @@
               </relocations>
             </configuration>
           </execution>
+          <!-- shade the native netty libs as well -->
+          <execution>
+            <id>unpack</id>
+            <phase>package</phase>
+            <configuration>
+              <target>
+                <echo message="Shade netty native libraries to 
${rss.shade.packageName}" />
+                <unzip src="${artifactId}-${version}.jar" 
dest="${project.build.directory}/unpacked/" />
+                <echo message="renaming native epoll library"></echo>
+                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                  <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                  <mapper from="libnetty_transport_native_epoll_x86_64.so"
+                          
to="lib${rss.shade.packageName}_shaded_netty_transport_native_epoll_x86_64.so"
+                          type="glob"></mapper>
+                </move>
+                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                  <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                  <mapper from="libnetty_transport_native_epoll_aarch_64.so"
+                          
to="lib${rss.shade.packageName}_shaded_netty_transport_native_epoll_aarch_64.so"
+                          type="glob"></mapper>
+                </move>
+                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                  <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                  <mapper from="libnetty_transport_native_kqueue_x86_64.jnilib"
+                          
to="lib${rss.shade.packageName}_shaded_netty_transport_native_kqueue_x86_64.jnilib"
+                          type="glob"></mapper>
+                </move>
+                <echo message="repackaging netty jar"></echo>
+                <jar destfile="${artifactId}-${version}.jar" 
basedir="${project.build.directory}/unpacked" />
+              </target>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
     </plugins>
diff --git a/client-spark/spark3/pom.xml b/client-spark/spark3/pom.xml
index 38147246..73558dec 100644
--- a/client-spark/spark3/pom.xml
+++ b/client-spark/spark3/pom.xml
@@ -176,6 +176,38 @@
                             </relocations>
                         </configuration>
                     </execution>
+                    <!-- shade the native netty libs as well -->
+                    <execution>
+                        <id>unpack</id>
+                        <phase>package</phase>
+                        <configuration>
+                            <target>
+                                <echo message="Shade netty native libraries to 
${rss.shade.packageName}" />
+                                <unzip src="${artifactId}-${version}.jar" 
dest="${project.build.directory}/unpacked/" />
+                                <echo message="renaming native epoll 
library"></echo>
+                                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                                    <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                                    <mapper 
from="libnetty_transport_native_epoll_x86_64.so"
+                                            
to="lib${rss.shade.packageName}_shaded_netty_transport_native_epoll_x86_64.so"
+                                            type="glob"></mapper>
+                                </move>
+                                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                                    <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                                    <mapper 
from="libnetty_transport_native_epoll_aarch_64.so"
+                                            
to="lib${rss.shade.packageName}_shaded_netty_transport_native_epoll_aarch_64.so"
+                                            type="glob"></mapper>
+                                </move>
+                                <move includeemptydirs="false" 
todir="${project.build.directory}/unpacked/META-INF/native">
+                                    <fileset 
dir="${project.build.directory}/unpacked/META-INF/native"></fileset>
+                                    <mapper 
from="libnetty_transport_native_kqueue_x86_64.jnilib"
+                                            
to="lib${rss.shade.packageName}_shaded_netty_transport_native_kqueue_x86_64.jnilib"
+                                            type="glob"></mapper>
+                                </move>
+                                <echo message="repackaging netty jar"></echo>
+                                <jar destfile="${artifactId}-${version}.jar" 
basedir="${project.build.directory}/unpacked" />
+                            </target>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
         </plugins>

Reply via email to