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 2018/07/13 06:17:31 UTC

[5/5] flink git commit: [FLINK-9091][build] Dependency convergence run against dependency-reduced poms

[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/ca3081be
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/ca3081be
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/ca3081be

Branch: refs/heads/master
Commit: ca3081beaca6da3e5def93c8f4d20ed263f2f544
Parents: d17c6b6
Author: zentol <ch...@apache.org>
Authored: Mon May 28 15:10:53 2018 +0200
Committer: zentol <ch...@apache.org>
Committed: Fri Jul 13 06:11:55 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/ca3081be/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f3aedda..897ae3c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -645,6 +645,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>
@@ -1243,6 +1266,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/ca3081be/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/ca3081be/tools/travis_mvn_watchdog.sh
----------------------------------------------------------------------
diff --git a/tools/travis_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh
index 23697d6..a47475b 100755
--- a/tools/travis_mvn_watchdog.sh
+++ b/tools/travis_mvn_watchdog.sh
@@ -509,12 +509,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
@@ -526,6 +554,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
@@ -536,10 +568,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)