XComp commented on code in PR #23195:
URL: https://github.com/apache/flink/pull/23195#discussion_r1296070723


##########
tools/ci/verify_bundled_optional.sh:
##########
@@ -17,24 +17,51 @@
 # limitations under the License.
 #
 
+usage() {
+  echo "Usage: $0 <maven-build-output>"
+  echo "    <maven-build-output>                 A file containing the output 
of the Maven build."
+  echo ""
+  echo "mvnw clean package > <maven-build-output>"
+  echo ""
+  echo "The environment variable MVN is used to specify the Maven binaries; 
defaults to 'mvnw'."
+  echo "See further details in the JavaDoc of ShadeOptionalChecker."
+}
+
+while getopts 'h' o; do
+  case "${o}" in
+    h)
+      usage
+      exit 0
+      ;;
+  esac
+done
+
+if [[ "$#" != "1" ]]; then
+  usage
+  exit 1
+fi
+
 ## Checks that all bundled dependencies are marked as optional in the poms
 MVN_CLEAN_COMPILE_OUT=$1
-CI_DIR=$2
-FLINK_ROOT=$3
 
-source "${CI_DIR}/maven-utils.sh"
+MVN=${MVN:-./mvnw}
 
-cd "$FLINK_ROOT" || exit
+dependency_plugin_output=/tmp/optional_dep.txt
 
-dependency_plugin_output=${CI_DIR}/optional_dep.txt
+$MVN dependency:tree -B > "${dependency_plugin_output}"

Review Comment:
   ```suggestion
   $MVN dependency:tree -T1 -B > "${dependency_plugin_output}"
   ```
   That caused the error on my side. I use a local `.mvn/maven.config` to set 
default parameters (`-DskipTests -Dfast -Pskip-webui-build -T1C` and a custom 
settings xml that points to a separate local repository). The multi-threading 
is the problem here. `dependency:tree` can run in multiple threads. But that 
will screw up the output of course which causes the dependency tree parsing to 
malfunction :facepalm: 



##########
tools/ci/license_check.sh:
##########
@@ -17,6 +17,34 @@
 # limitations under the License.
 
################################################################################
 
+usage() {
+  if [[ "$#" != "2" ]]; then

Review Comment:
   I guess, the if condition is not necessary here



##########
tools/ci/license_check.sh:
##########
@@ -17,6 +17,34 @@
 # limitations under the License.
 
################################################################################
 
+usage() {
+  if [[ "$#" != "2" ]]; then
+    echo "Usage: $0 <maven-build-output> <deployed-artifacts-folder>"
+    echo "    <maven-build-output>                 A file containing the 
output of the Maven build."
+    echo "    <deployed-artifacts-folder>          A directory containing a 
Maven repository into which the Flink artifacts were deployed."
+    echo ""
+    echo "Example preparation:"
+    echo "    mvnw clean deploy 
-DaltDeploymentRepository=validation_repository::default::file:<deployed-artifacts-folder>
 > <maven-build-output>"
+    echo ""
+    echo "The environment variable MVN is used to specify the Maven binaries; 
defaults to 'mvnw'."
+    echo "See further details in the JavaDoc of LicenseChecker."
+  fi
+}
+
+while getopts 'h' o; do
+  case "${o}" in
+    h)
+      usage

Review Comment:
   nit: Even though it's possible to do it like that I think we should call the 
method with brackets (i.e. `usage()`) to improve the readability of the code.



##########
tools/ci/verify_bundled_optional.sh:
##########
@@ -17,24 +17,51 @@
 # limitations under the License.
 #
 
+usage() {
+  echo "Usage: $0 <maven-build-output>"
+  echo "    <maven-build-output>                 A file containing the output 
of the Maven build."
+  echo ""
+  echo "mvnw clean package > <maven-build-output>"
+  echo ""
+  echo "The environment variable MVN is used to specify the Maven binaries; 
defaults to 'mvnw'."
+  echo "See further details in the JavaDoc of ShadeOptionalChecker."
+}
+
+while getopts 'h' o; do
+  case "${o}" in
+    h)
+      usage
+      exit 0
+      ;;
+  esac
+done
+
+if [[ "$#" != "1" ]]; then
+  usage
+  exit 1
+fi
+
 ## Checks that all bundled dependencies are marked as optional in the poms
 MVN_CLEAN_COMPILE_OUT=$1
-CI_DIR=$2
-FLINK_ROOT=$3
 
-source "${CI_DIR}/maven-utils.sh"
+MVN=${MVN:-./mvnw}
 
-cd "$FLINK_ROOT" || exit
+dependency_plugin_output=/tmp/optional_dep.txt
 
-dependency_plugin_output=${CI_DIR}/optional_dep.txt
+$MVN dependency:tree -B > "${dependency_plugin_output}"

Review Comment:
   I'm wondering whether we should apply this in every mvn command for which we 
analyze the output. To be on the safe side :thinking: 



##########
tools/ci/verify_bundled_optional.sh:
##########
@@ -17,24 +17,51 @@
 # limitations under the License.
 #
 
+usage() {
+  echo "Usage: $0 <maven-build-output>"
+  echo "    <maven-build-output>                 A file containing the output 
of the Maven build."
+  echo ""
+  echo "mvnw clean package > <maven-build-output>"
+  echo ""
+  echo "The environment variable MVN is used to specify the Maven binaries; 
defaults to 'mvnw'."
+  echo "See further details in the JavaDoc of ShadeOptionalChecker."
+}
+
+while getopts 'h' o; do
+  case "${o}" in
+    h)
+      usage
+      exit 0
+      ;;
+  esac
+done
+
+if [[ "$#" != "1" ]]; then
+  usage
+  exit 1
+fi
+
 ## Checks that all bundled dependencies are marked as optional in the poms
 MVN_CLEAN_COMPILE_OUT=$1
-CI_DIR=$2
-FLINK_ROOT=$3
 
-source "${CI_DIR}/maven-utils.sh"
+MVN=${MVN:-./mvnw}
 
-cd "$FLINK_ROOT" || exit
+dependency_plugin_output=/tmp/optional_dep.txt
 
-dependency_plugin_output=${CI_DIR}/optional_dep.txt
+$MVN dependency:tree -B > "${dependency_plugin_output}"
+EXIT_CODE=$?
 
-run_mvn dependency:tree -B > "${dependency_plugin_output}"
+if [ $EXIT_CODE != 0 ]; then
+    cat ${dependency_plugin_output}
+    echo 
"=============================================================================="
+    echo "Optional Check failed. The dependency tree could not be determined. 
See previous output for details."
+    echo 
"=============================================================================="
+    exit 1

Review Comment:
   that could be also applied to the unchange code below.



##########
tools/ci/verify_bundled_optional.sh:
##########
@@ -17,24 +17,51 @@
 # limitations under the License.
 #
 
+usage() {
+  echo "Usage: $0 <maven-build-output>"
+  echo "    <maven-build-output>                 A file containing the output 
of the Maven build."
+  echo ""
+  echo "mvnw clean package > <maven-build-output>"
+  echo ""
+  echo "The environment variable MVN is used to specify the Maven binaries; 
defaults to 'mvnw'."
+  echo "See further details in the JavaDoc of ShadeOptionalChecker."
+}
+
+while getopts 'h' o; do
+  case "${o}" in
+    h)
+      usage
+      exit 0
+      ;;
+  esac
+done
+
+if [[ "$#" != "1" ]]; then
+  usage
+  exit 1
+fi
+
 ## Checks that all bundled dependencies are marked as optional in the poms
 MVN_CLEAN_COMPILE_OUT=$1
-CI_DIR=$2
-FLINK_ROOT=$3
 
-source "${CI_DIR}/maven-utils.sh"
+MVN=${MVN:-./mvnw}
 
-cd "$FLINK_ROOT" || exit
+dependency_plugin_output=/tmp/optional_dep.txt
 
-dependency_plugin_output=${CI_DIR}/optional_dep.txt
+$MVN dependency:tree -B > "${dependency_plugin_output}"
+EXIT_CODE=$?
 
-run_mvn dependency:tree -B > "${dependency_plugin_output}"
+if [ $EXIT_CODE != 0 ]; then
+    cat ${dependency_plugin_output}
+    echo 
"=============================================================================="
+    echo "Optional Check failed. The dependency tree could not be determined. 
See previous output for details."
+    echo 
"=============================================================================="
+    exit 1

Review Comment:
   ```suggestion
       exit $EXIT_CODE
   ```
   nit



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to