Repository: flink
Updated Branches:
  refs/heads/release-1.5 8a564f82a -> 2685d0b78


[FLINK-9091][build] Dependency convergence run against dependency-reduced poms

This closes #6102.


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

Branch: refs/heads/release-1.5
Commit: 2685d0b78f3475f0b46e6347f2e4e8a727ce26d9
Parents: aa160b5
Author: zentol <ches...@apache.org>
Authored: Mon May 28 15:10:53 2018 +0200
Committer: zentol <ches...@apache.org>
Committed: Fri Jul 13 06:10:32 2018 +0200

----------------------------------------------------------------------
 pom.xml                               | 25 +++++++++++
 tools/check_dependency_convergence.sh | 67 ++++++++++++++++++++++++++++++
 tools/travis_mvn_watchdog.sh          | 36 ++++++++++++++--
 3 files changed, 124 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/2685d0b7/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index aab798b..79ba41f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -694,6 +694,29 @@ under the License.
                </profile>
 
                <profile>
+                       <id>check-convergence</id>
+                       <activation>
+                               <property>
+                                       <name>check-convergence</name>
+                               </property>
+                       </activation>
+                       <build>
+                               <plugins>
+                                       <plugin>
+                                               
<groupId>org.apache.maven.plugins</groupId>
+                                               
<artifactId>maven-enforcer-plugin</artifactId>
+                                               <executions>
+                                                       <execution>
+                                                               
<id>dependency-convergence</id>
+                                                               
<phase>validate</phase>
+                                                       </execution>
+                                               </executions>
+                                       </plugin>
+                               </plugins>
+                       </build>
+               </profile>
+
+               <profile>
                        <id>legacyCode</id>
                        <activation>
                                <property>
@@ -1269,6 +1292,8 @@ under the License.
                                        </execution>
                                        <execution>
                                                <id>dependency-convergence</id>
+                                               <!-- disabled by default as it 
interacts badly with shade-plugin -->
+                                               <phase>none</phase>
                                                <goals>
                                                        <goal>enforce</goal>
                                                </goals>

http://git-wip-us.apache.org/repos/asf/flink/blob/2685d0b7/tools/check_dependency_convergence.sh
----------------------------------------------------------------------
diff --git a/tools/check_dependency_convergence.sh 
b/tools/check_dependency_convergence.sh
new file mode 100755
index 0000000..5db8d9d
--- /dev/null
+++ b/tools/check_dependency_convergence.sh
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+################################################################################
+#  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.
+################################################################################
+
+HERE="`dirname \"$0\"`"                                # relative
+HERE="`( cd \"$HERE\" && pwd )`"       # absolutized and normalized
+if [ -z "$HERE" ] ; then
+       # error; for some reason, the path is not accessible
+       # to the script (e.g. permissions re-evaled after suid)
+       exit 1  # fail
+fi
+
+FLINK_DIR=HERE
+
+if [[ $(basename ${HERE}) == "tools" ]] ; then
+  FLINK_DIR="${HERE}/.."
+fi
+
+FLINK_DIR="`( cd \"${FLINK_DIR}\" && pwd )`" 
+
+echo ${FLINK_DIR}
+
+# get list of all flink modules
+# searches for directories containing a pom.xml file
+# sorts the list alphabetically
+# only accepts directories starting with "flink" to filter force-shading
+modules=$(find . -maxdepth 3 -name 'pom.xml' -printf '%h\n' | sort -u | grep 
"flink")
+
+for module in ${modules}
+do
+    # we are only interested in child modules
+    for other_module in ${modules}
+    do 
+        if [[ "${other_module}" != "${module}" && "${other_module}" = 
"${module}"/* ]]; then
+        echo "excluding ${module} since it is not a leaf module"
+            continue 2
+        fi
+    done
+    
+    cd "${module}"
+    echo "checking ${module}"
+    output=$(mvn validate -nsu -Dcheckstyle.skip=true -Dcheck-convergence)
+    exit_code=$?
+    if [[ ${exit_code} != 0 ]]; then
+        echo "dependency convergence failed."
+        echo "${output}"
+        exit ${exit_code}
+    fi
+    cd "${FLINK_DIR}"
+done
+
+exit 0

http://git-wip-us.apache.org/repos/asf/flink/blob/2685d0b7/tools/travis_mvn_watchdog.sh
----------------------------------------------------------------------
diff --git a/tools/travis_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh
index e08f0cc..d008124 100755
--- a/tools/travis_mvn_watchdog.sh
+++ b/tools/travis_mvn_watchdog.sh
@@ -500,12 +500,40 @@ EXIT_CODE=$(<$MVN_EXIT)
 
 echo "MVN exited with EXIT CODE: ${EXIT_CODE}."
 
+# Make sure to kill the watchdog in any case after $MVN_COMPILE has completed
+echo "Trying to KILL watchdog (${WD_PID})."
+( kill $WD_PID 2>&1 ) > /dev/null
+
 rm $MVN_PID
 rm $MVN_EXIT
 
+# only run dependency-convergence in misc because it is the only profile 
building all of Flink
+case $TEST in
+       (misc)
+               if [ $EXIT_CODE == 0 ]; then
+                       printf 
"\n\n==============================================================================\n"
+                       printf "Checking dependency convergence\n"
+                       printf 
"==============================================================================\n"
+
+                       ./tools/check_dependency_convergence.sh
+                       EXIT_CODE=$?
+               else
+                       printf 
"\n==============================================================================\n"
+                       printf "Previous build failure detected, skipping 
dependency-convergence check.\n"
+                       printf 
"==============================================================================\n"
+               fi
+       ;;
+esac
+
 # Run tests if compilation was successful
 if [ $EXIT_CODE == 0 ]; then
 
+       # Start watching $MVN_OUT
+       watchdog &
+       echo "STARTED watchdog (${WD_PID})."
+
+       WD_PID=$!
+
        echo "RUNNING '${MVN_TEST}'."
 
        # Run $MVN_TEST and pipe output to $MVN_OUT for the watchdog. The PID 
is written to $MVN_PID to
@@ -517,6 +545,10 @@ if [ $EXIT_CODE == 0 ]; then
 
        echo "MVN exited with EXIT CODE: ${EXIT_CODE}."
 
+       # Make sure to kill the watchdog in any case after $MVN_TEST has 
completed
+       echo "Trying to KILL watchdog (${WD_PID})."
+       ( kill $WD_PID 2>&1 ) > /dev/null
+
        rm $MVN_PID
        rm $MVN_EXIT
 else
@@ -527,10 +559,6 @@ fi
 
 # Post
 
-# Make sure to kill the watchdog in any case after $MVN_COMPILE and $MVN_TEST 
have completed
-echo "Trying to KILL watchdog (${WD_PID})."
-( kill $WD_PID 2>&1 ) > /dev/null
-
 # only misc builds flink-dist and flink-yarn-tests
 case $TEST in
        (misc)

Reply via email to