You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2019/05/15 07:00:22 UTC

[flink-shaded] 01/04: [FLINK-11580][netty] add statically linked netty-tcnative

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

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-shaded.git

commit 4875bdc24d7d8a0076b65a11762fd49e536faaff
Author: Nico Kruber <ni...@data-artisans.com>
AuthorDate: Wed Jul 11 22:27:47 2018 +0200

    [FLINK-11580][netty] add statically linked netty-tcnative
    
    With one of the artifacts of netty-tcnative [1], this enables support for using
    the OpenSSL engine instead of the one from the JDK. [2] claims significant
    improvements (3x) over the JDK and we may just also save some resources.
    
    From the available artifacts, this commits selects the one which is statically
    linked against Google's BoringSSL. Please refer to [1] for further details.
    
    Due to possible licensing issues with the openSSL license BoringSSL is based on,
    we only build this module if the build profile
    'include-netty-tcnative-static-Pinclude-netty-tcnative-static' is activated.
    
    [1] http://netty.io/wiki/forked-tomcat-native.html
    [2] https://netty.io/wiki/requirements-for-4.x.html#wiki-h4-4
---
 flink-shaded-netty-tcnative-static/pom.xml         | 110 +++++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE             |  14 +++
 pom.xml                                            |  12 +++
 3 files changed, 136 insertions(+)

diff --git a/flink-shaded-netty-tcnative-static/pom.xml b/flink-shaded-netty-tcnative-static/pom.xml
new file mode 100644
index 0000000..7c8fc97
--- /dev/null
+++ b/flink-shaded-netty-tcnative-static/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.flink</groupId>
+        <artifactId>flink-shaded</artifactId>
+        <version>7.0</version>
+        <relativePath>..</relativePath>
+    </parent>
+
+    <artifactId>flink-shaded-netty-tcnative-static</artifactId>
+    <name>flink-shaded-netty-tcnative-static</name>
+    <version>${netty.tcnative.version}-7.0</version>
+
+    <properties>
+        <netty.tcnative.version>2.0.25.Final</netty.tcnative.version>
+    </properties>
+
+    <dependencies>
+        <!-- Netty's native openSSL support -->
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-tcnative-boringssl-static</artifactId>
+            <version>${netty.tcnative.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>shade-flink</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <createDependencyReducedPom>true</createDependencyReducedPom>
+                            <dependencyReducedPomLocation>${project.basedir}/target/dependency-reduced-pom.xml</dependencyReducedPomLocation>
+                            <artifactSet>
+                                <includes>
+                                    <include>io.netty:netty-tcnative-boringssl-static</include>
+                                </includes>
+                            </artifactSet>
+                            <relocations>
+                                <relocation>
+                                    <pattern>io.netty</pattern>
+                                    <shadedPattern>org.apache.flink.shaded.netty4.io.netty</shadedPattern>
+                                </relocation>
+                            </relocations>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.7</version>
+                <executions>
+                    <execution>
+                        <id>rename-native-library</id>
+                        <phase>package</phase>
+                        <configuration>
+                            <target>
+                                <echo message="unpacking netty jar" />
+                                <unzip src="${project.build.directory}/${artifactId}-${version}.jar" dest="${project.build.directory}/unpacked/" />
+                                <echo message="renaming netty_tcnative library" />
+                                <move todir="${project.build.directory}/unpacked/META-INF/native" includeemptydirs="false">
+                                    <fileset dir="${project.build.directory}/unpacked/META-INF/native"/>
+                                    <mapper type="regexp" from="(lib)?netty_tcnative_(linux_x86_64.so|osx_x86_64.jnilib|windows_x86_64.dll)" to="\1org_apache_flink_shaded_netty4_netty_tcnative_\2"/>
+                                </move>
+                                <echo message="repackaging netty jar" />
+                                <jar destfile="${project.build.directory}/${artifactId}-${version}.jar" basedir="${project.build.directory}/unpacked" />
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
diff --git a/flink-shaded-netty-tcnative-static/src/main/resources/META-INF/NOTICE b/flink-shaded-netty-tcnative-static/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..ef57f70
--- /dev/null
+++ b/flink-shaded-netty-tcnative-static/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,14 @@
+flink-shaded-netty-openssl-static
+Copyright 2014-2019 The Apache Software Foundation
+
+This project includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This project bundles the following dependencies under the Apache Software License 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+
+- io.netty:netty-tcnative-boringssl-static:2.0.25.Final
+
+This project bundles the following dependencies under the OpenSSL license.
+See bundled license files for details.
+
+- BoringSSL (statically linked native libraries)
diff --git a/pom.xml b/pom.xml
index 4eb1837..515917b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,6 +63,18 @@ under the License.
 
     <profiles>
         <profile>
+            <id>include-netty-tcnative-static</id>
+            <activation>
+                <property>
+                    <name>include-netty-tcnative-static</name>
+                </property>
+            </activation>
+            <modules>
+                <module>flink-shaded-netty-tcnative-static</module>
+            </modules>
+        </profile>
+
+        <profile>
             <id>release</id>
             <build>
                 <plugins>