Repository: flink
Updated Branches:
  refs/heads/master dc1a0dce0 -> 8595dadb8


[FLINK-7840] [build] Shade netty in akka


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/8595dadb
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/8595dadb
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/8595dadb

Branch: refs/heads/master
Commit: 8595dadb89a1276c6c7d0ed2e2fae396a5c1d222
Parents: dc1a0dc
Author: Stephan Ewen <[email protected]>
Authored: Sat Oct 14 01:49:26 2017 +0200
Committer: Stephan Ewen <[email protected]>
Committed: Thu Oct 26 17:37:20 2017 +0200

----------------------------------------------------------------------
 flink-runtime/pom.xml                           | 25 ++++++++++++
 .../flink-test-utils/pom.xml                    | 42 ++++++++++++++++++++
 .../flink/networking/NetworkFailureHandler.java |  1 +
 flink-yarn/pom.xml                              | 34 +++++++---------
 tools/travis_mvn_watchdog.sh                    | 14 +++++--
 5 files changed, 94 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/8595dadb/flink-runtime/pom.xml
----------------------------------------------------------------------
diff --git a/flink-runtime/pom.xml b/flink-runtime/pom.xml
index a5372ed..83ac781 100644
--- a/flink-runtime/pom.xml
+++ b/flink-runtime/pom.xml
@@ -427,17 +427,42 @@ under the License.
                                                        <goal>shade</goal>
                                                </goals>
                                                <configuration>
+                                                       <!-- we need this to 
avoid having to specify all of akka's dependencies -->
+                                                       
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
                                                        <artifactSet>
                                                                <includes 
combine.children="append">
                                                                        
<include>org.apache.flink:flink-shaded-curator-recipes</include>
+                                                                       <!-- 
add akka, akka's netty, akka uncommon math -->
+                                                                       <!-- we 
can do this only because our own netty dependency is
+                                                                               
already externally shaded (flink-shaded-netty) -->
+                                                                       
<include>com.typesafe.akka:akka-remote_*</include>
+                                                                       
<include>io.netty:netty</include>
+                                                                       
<include>org.uncommons.maths:uncommons-maths</include>
                                                                </includes>
                                                        </artifactSet>
                                                        <relocations 
combine.children="append">
                                                                <relocation>
+                                                                       
<pattern>org.jboss.netty</pattern>
+                                                                       
<shadedPattern>org.apache.flink.shaded.akka.org.jboss.netty</shadedPattern>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>org.uncommons.math</pattern>
+                                                                       
<shadedPattern>org.apache.flink.shaded.akka.org.uncommons.math</shadedPattern>
+                                                               </relocation>
+                                                               <relocation>
                                                                        
<pattern>org.apache.curator</pattern>
                                                                        
<shadedPattern>org.apache.flink.shaded.org.apache.curator</shadedPattern>
                                                                </relocation>
                                                        </relocations>
+                                                       <filters>
+                                                               <filter>
+                                                                       
<artifact>*</artifact>
+                                                                       
<excludes>
+                                                                               
<exclude>META-INF/maven/io.netty/**</exclude>
+                                                                               
<exclude>META-INF/maven/org.uncommons.maths/**</exclude>
+                                                                       
</excludes>
+                                                               </filter>
+                                                       </filters>
                                                </configuration>
                                        </execution>
                                </executions>

http://git-wip-us.apache.org/repos/asf/flink/blob/8595dadb/flink-test-utils-parent/flink-test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/flink-test-utils-parent/flink-test-utils/pom.xml 
b/flink-test-utils-parent/flink-test-utils/pom.xml
index 4f53794..4dcf6df 100644
--- a/flink-test-utils-parent/flink-test-utils/pom.xml
+++ b/flink-test-utils-parent/flink-test-utils/pom.xml
@@ -65,6 +65,13 @@ under the License.
                </dependency>
 
                <dependency>
+                       <groupId>io.netty</groupId>
+                       <artifactId>netty</artifactId>
+                       <version>3.10.6.Final</version>
+                       <scope>compile</scope>
+               </dependency>
+
+               <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>${junit.version}</version>
@@ -117,6 +124,41 @@ under the License.
                                <inherited>true</inherited>
                                <extensions>true</extensions>
                        </plugin>
+
+                       <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>
+                                                       <artifactSet>
+                                                               <includes 
combine.children="append">
+                                                                       
<include>io.netty:netty</include>
+                                                               </includes>
+                                                       </artifactSet>
+                                                       <relocations 
combine.children="append">
+                                                               <relocation>
+                                                                       
<pattern>org.jboss.netty</pattern>
+                                                                       
<shadedPattern>org.apache.flink.shaded.testutils.org.jboss.netty</shadedPattern>
+                                                               </relocation>
+                                                       </relocations>
+                                                       <filters>
+                                                               <filter>
+                                                                       
<artifact>*</artifact>
+                                                                       
<excludes>
+                                                                               
<exclude>META-INF/maven/io.netty/**</exclude>
+                                                                       
</excludes>
+                                                               </filter>
+                                                       </filters>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
                </plugins>
        </build>
 

http://git-wip-us.apache.org/repos/asf/flink/blob/8595dadb/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/networking/NetworkFailureHandler.java
----------------------------------------------------------------------
diff --git 
a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/networking/NetworkFailureHandler.java
 
b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/networking/NetworkFailureHandler.java
index 07d2341..383961c 100644
--- 
a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/networking/NetworkFailureHandler.java
+++ 
b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/networking/NetworkFailureHandler.java
@@ -30,6 +30,7 @@ import org.jboss.netty.channel.ExceptionEvent;
 import org.jboss.netty.channel.MessageEvent;
 import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
 import org.jboss.netty.channel.socket.ClientSocketChannelFactory;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/flink/blob/8595dadb/flink-yarn/pom.xml
----------------------------------------------------------------------
diff --git a/flink-yarn/pom.xml b/flink-yarn/pom.xml
index 372285b..feaace0 100644
--- a/flink-yarn/pom.xml
+++ b/flink-yarn/pom.xml
@@ -26,7 +26,7 @@ under the License.
                <version>1.4-SNAPSHOT</version>
                <relativePath>..</relativePath>
        </parent>
-       
+
        <artifactId>flink-yarn_${scala.binary.version}</artifactId>
        <name>flink-yarn</name>
        <packaging>jar</packaging>
@@ -39,12 +39,6 @@ under the License.
                        <groupId>org.apache.flink</groupId>
                        
<artifactId>flink-runtime_${scala.binary.version}</artifactId>
                        <version>${project.version}</version>
-                       <exclusions>
-                               <exclusion>
-                                       <artifactId>hadoop-core</artifactId>
-                                       <groupId>org.apache.hadoop</groupId>
-                               </exclusion>
-                       </exclusions>
                </dependency>
 
                <dependency>
@@ -60,21 +54,15 @@ under the License.
                </dependency>
 
                <dependency>
-                       <groupId>org.apache.flink</groupId>
-                       
<artifactId>flink-test-utils_${scala.binary.version}</artifactId>
-                       <version>${project.version}</version>
-                       <type>test-jar</type>
-                       <scope>test</scope>
-               </dependency>
-
-               <dependency>
                        <groupId>com.typesafe.akka</groupId>
                        
<artifactId>akka-actor_${scala.binary.version}</artifactId>
+                       <scope>provided</scope>
                </dependency>
 
                <dependency>
                        <groupId>com.typesafe.akka</groupId>
                        
<artifactId>akka-remote_${scala.binary.version}</artifactId>
+                       <scope>provided</scope>
                </dependency>
 
                <dependency>
@@ -92,14 +80,16 @@ under the License.
                        </exclusions>
                </dependency>
 
+               <!-- test dependencies -->
+
                <dependency>
-                       <groupId>com.typesafe.akka</groupId>
-                       
<artifactId>akka-testkit_${scala.binary.version}</artifactId>
+                       <groupId>org.apache.flink</groupId>
+                       
<artifactId>flink-test-utils_${scala.binary.version}</artifactId>
+                       <version>${project.version}</version>
+                       <type>test-jar</type>
                        <scope>test</scope>
                </dependency>
 
-               <!-- test dependencies -->
-
                <dependency>
                        <groupId>org.apache.flink</groupId>
                        
<artifactId>flink-runtime_${scala.binary.version}</artifactId>
@@ -123,6 +113,12 @@ under the License.
                        <type>test-jar</type>
                        <version>${hadoop.version}</version>
                </dependency>
+
+               <dependency>
+                       <groupId>com.typesafe.akka</groupId>
+                       
<artifactId>akka-testkit_${scala.binary.version}</artifactId>
+                       <scope>test</scope>
+               </dependency>
        </dependencies>
 
        <profiles>

http://git-wip-us.apache.org/repos/asf/flink/blob/8595dadb/tools/travis_mvn_watchdog.sh
----------------------------------------------------------------------
diff --git a/tools/travis_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh
index a6b0b5b..f608e51 100755
--- a/tools/travis_mvn_watchdog.sh
+++ b/tools/travis_mvn_watchdog.sh
@@ -308,10 +308,18 @@ check_shaded_artifacts() {
                return 1
        fi
 
-       NETTY=`cat allClasses | grep '^io/netty' | wc -l`
-       if [ "$NETTY" != "0" ]; then
+       IO_NETTY=`cat allClasses | grep '^io/netty' | wc -l`
+       if [ "$IO_NETTY" != "0" ]; then
                echo 
"=============================================================================="
-               echo "Detected '$NETTY' unshaded netty dependencies in fat jar"
+               echo "Detected '$IO_NETTY' unshaded io.netty classes in fat jar"
+               echo 
"=============================================================================="
+               return 1
+       fi
+
+       ORG_NETTY=`cat allClasses | grep '^org/jboss/netty' | wc -l`
+       if [ "$ORG_NETTY" != "0" ]; then
+               echo 
"=============================================================================="
+               echo "Detected '$ORG_NETTY' unshaded org.jboss.netty classes in 
fat jar"
                echo 
"=============================================================================="
                return 1
        fi

Reply via email to