You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2020/11/26 03:51:46 UTC

[hbase] branch HBASE-25333 created (now 4ce72fd)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a change to branch HBASE-25333
in repository https://gitbox.apache.org/repos/asf/hbase.git.


      at 4ce72fd  HBASE-25333 Add a yetus check to disable usage of VisibleForTesting annotation on IA.Public and IA.LimitedPrivate classes

This branch includes the following new commits:

     new 4ce72fd  HBASE-25333 Add a yetus check to disable usage of VisibleForTesting annotation on IA.Public and IA.LimitedPrivate classes

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[hbase] 01/01: HBASE-25333 Add a yetus check to disable usage of VisibleForTesting annotation on IA.Public and IA.LimitedPrivate classes

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch HBASE-25333
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 4ce72fdab429ed2f81eaae62e5f6fd7822abc0de
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Thu Nov 26 11:50:56 2020 +0800

    HBASE-25333 Add a yetus check to disable usage of VisibleForTesting annotation on IA.Public and IA.LimitedPrivate classes
---
 dev-support/hbase-personality.sh | 60 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh
index 69e7720..5c178ab 100755
--- a/dev-support/hbase-personality.sh
+++ b/dev-support/hbase-personality.sh
@@ -816,6 +816,66 @@ function hbaseanti_patchfile
   return 0
 }
 
+######################################
+
+add_test_type visible-for-testing
+
+## @description  visible-for-testing file filter
+## @audience     private
+## @stability    evolving
+## @param        filename
+function visible-for-testing_filefilter
+{
+  local filename=$1
+
+  if [[ ${filename} =~ \.java$ ]]; then
+    add_test visible-for-testing
+  fi
+}
+
+## @description  visible-for-testing patch file check
+## @audience     private
+## @stability    evolving
+## @param        repostatus
+function visible-for-testing_precompile
+{
+  local repostatus=$1
+  local logfile="${PATCH_DIR}/patch-visible-for-testing.txt"
+  local errors
+
+  if [[ "${repostatus}" = branch ]]; then
+    return 0
+  fi
+
+  if ! verify_needed_test visible-for-testing; then
+    return 0
+  fi
+
+  big_console_header "VisibleForTesting plugin: ${BUILDMODE}"
+  if [[ "${BUILDMODE}" = "full" ]]; then
+    find -type f -name *.java | grep -v generated | xargs grep -l "@InterfaceAudience.Public\|@InterfaceAudience.LimitedPrivate" | xargs grep -l @VisibleForTesting >> ${logfile}
+  else
+    for f in "${CHANGED_FILES[@]}"
+    do
+      if [[ ${filename} =~ \.java$ ]]; then
+        grep -l "@InterfaceAudience.Public\|@InterfaceAudience.LimitedPrivate" ${filename} | xargs grep -l @VisibleForTesting >> ${logfile}
+      fi
+    done
+  fi
+
+  errors=`wc -l ${logfile} | cut -d" " -f1`
+  if [[ "${errors}" = "0" ]]; then
+    add_vote_table +1 visible-for-testing "Patch does not introduce VisibleForTesting annotation on IA.Public or IA.LimitedPrivate classes."
+    return 0
+  else
+    add_vote_table -1 visible-for-testing "${BUILDMODEMSG} introduces VisibleForTesting annotation on ${errors} IA.Public or IA.LimitedPrivate classes."
+    add_footer_table visible-for-testing "@@BASE@@/patch-visible-for-testing.txt"
+    return 1
+  fi
+}
+
+######################################
+
 ## @description  process the javac output for generating WARNING/ERROR
 ## @audience     private
 ## @stability    evolving