From da546c8895a46cdb527661d0716eda0fe5a382df Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Wed, 14 Sep 2022 14:11:01 +0800 Subject: [PATCH] Add ci rule for blocking legacy kernel registration (#45982) * add ci rule for blocking legacy kernel registration, test=document_fix * add a test case, test=document_fix * Revert "add a test case, test=document_fix" This reverts commit 239e08678b791aabb8fae48c4b74f2a8861e222d. * polish desc, test=document_fix --- tools/check_file_diff_approvals.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/check_file_diff_approvals.sh b/tools/check_file_diff_approvals.sh index cbb9357f6d9..45586e6cc87 100644 --- a/tools/check_file_diff_approvals.sh +++ b/tools/check_file_diff_approvals.sh @@ -213,6 +213,13 @@ if [ ${NO_INFRT_FILES} ] && [ ${HAS_LOG_FATAL} ] && [ "${GIT_PR_ID}" != "" ]; th check_approval 1 6836917 47554610 22561442 fi +FILTER=`git diff --name-only upstream/develop | grep -v "tools/"` +HAS_LEGACY_KERNEL_REGISTRATION=`git diff -U0 upstream/$BRANCH $FILTER | grep '^\+' | grep -oE -m 1 "REGISTER_OP[A-Z_]{1,9}KERNEL[_FUNCTOR|_WITH_CUSTOM_TYPE|_EX]*" || true` +if [ ${HAS_LEGACY_KERNEL_REGISTRATION} ] && [ "${GIT_PR_ID}" != "" ]; then + echo_line="In principle, adding an OpKernel needs to be in the phi/kernels directory. If you must add an OpKernel in the fluid/operators directory, please request one of the RD (chenwhql, zyfncg, YuanRisheng, phlrain) review and approve.\n" + check_approval 1 chenwhql zyfncg YuanRisheng phlrain +fi + HAS_DEFINE_FLAG=`git diff -U0 upstream/$BRANCH |grep -o -m 1 "DEFINE_int32" |grep -o -m 1 "DEFINE_bool" | grep -o -m 1 "DEFINE_string" || true` if [ ${HAS_DEFINE_FLAG} ] && [ "${GIT_PR_ID}" != "" ]; then echo_line="You must have one RD lanxianghit approval for the usage (either add or delete) of DEFINE_int32/DEFINE_bool/DEFINE_string flag.\n" -- GitLab