suztomo commented on a change in pull request #11674:
URL: https://github.com/apache/beam/pull/11674#discussion_r426927838



##########
File path: sdks/java/build-tools/beam-linkage-check.sh
##########
@@ -66,51 +66,61 @@ if [ ! -z "$(git diff)" ]; then
   exit 1
 fi
 
+ACCUMULATED_RESULT=0
+
 function runLinkageCheck () {
   COMMIT=$1
   BRANCH=$2
+  MODE=$3 # baseline or validate
   # An empty invocation so that the subsequent checkJavaLinkage does not
   # contain garbage
   echo "`date`:" "Installing artifacts of ${BRANCH}(${COMMIT}) to Maven local 
repository."
-  ./gradlew -Ppublishing -PjavaLinkageArtifactIds=beam-sdks-java-core 
:checkJavaLinkage > /dev/null 2>&1
+  ./gradlew -Ppublishing -PjavaLinkageArtifactIds=beam-sdks-java-core 
-PjavaLinkageWriteBaseline=/dev/null :checkJavaLinkage > /dev/null 2>&1
   for ARTIFACT in $ARTIFACTS; do
-    echo "`date`:" "Running linkage check for ${ARTIFACT} in ${BRANCH}"
-    # Removing time taken to have clean diff
-    ./gradlew -Ppublishing -PjavaLinkageArtifactIds=$ARTIFACT 
:checkJavaLinkage |grep -v 'BUILD SUCCESSFUL in' | grep -v 'dependency paths' > 
${OUTPUT_DIR}/${COMMIT}-${ARTIFACT}
-    echo "`date`:" "Done: ${OUTPUT_DIR}/${COMMIT}-${ARTIFACT}"
+    echo "`date`:" "Running linkage check (${MODE}) for ${ARTIFACT} in 
${BRANCH}"
+
+    BASELINE_FILE=${OUTPUT_DIR}/baseline-${ARTIFACT}.xml
+    if [ "$MODE" = "baseline" ]; then
+      BASELINE_OPTION='-PjavaLinkageWriteBaseline'
+      echo "`date`:" "to create a baseline (existing errors before change) 
$BASELINE_FILE"
+    elif [ "$MODE" = "validate" ]; then
+      BASELINE_OPTION='-PjavaLinkageReadBaseline'
+      echo "`date`:" "using baseline $BASELINE_FILE"
+    else
+      echo "invalid parameter for runLinkageCheck: ${MODE}"

Review comment:
       Fixed.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to