1+ #! /usr/bin/env bash
2+ # Licensed to the Apache Software Foundation (ASF) under one or more
3+ # contributor license agreements. See the NOTICE file distributed with
4+ # this work for additional information regarding copyright ownership.
5+ # The ASF licenses this file to You under the Apache License, Version 2.0
6+ # (the "License"); you may not use this file except in compliance with
7+ # the License. You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
17+ personality_plugins " all"
18+
19+ # # @description Globals specific to this personality
20+ # # @audience private
21+ # # @stability evolving
22+ function personality_globals
23+ {
24+ # shellcheck disable=SC2034
25+ BUILDTOOL=maven
26+ # shellcheck disable=SC2034
27+ PROJECT_NAME=hbase-thirdparty
28+ # shellcheck disable=SC2034
29+ PATCH_BRANCH_DEFAULT=master
30+ # shellcheck disable=SC2034
31+ JIRA_ISSUE_RE=' ^HBASE-[0-9]+$'
32+ # shellcheck disable=SC2034
33+ GITHUB_REPO=" apache/hbase-thirdparty"
34+ }
35+
36+ # #####################################
37+ # Below plugin is copied from https://github.com/apache/hbase/blob/master/dev-support/hbase-personality.sh
38+ # #####################################
39+
40+ add_test_type spotless
41+
42+ # # @description spotless file filter
43+ # # @audience private
44+ # # @stability evolving
45+ # # @param filename
46+ function spotless_filefilter
47+ {
48+ # always add spotless check as it can format almost all types of files
49+ add_test spotless
50+ }
51+ # # @description run spotless:check to check format issues
52+ # # @audience private
53+ # # @stability evolving
54+ # # @param repostatus
55+ function spotless_rebuild
56+ {
57+ local repostatus=$1
58+ local logfile=" ${PATCH_DIR} /${repostatus} -spotless.txt"
59+
60+ if ! verify_needed_test spotless; then
61+ return 0
62+ fi
63+
64+ big_console_header " Checking spotless on ${repostatus} "
65+
66+ start_clock
67+
68+ local -a maven_args=(' spotless:check' )
69+
70+ # disabled because "maven_executor" needs to return both command and args
71+ # shellcheck disable=2046
72+ echo_and_redirect " ${logfile} " $( maven_executor) " ${maven_args[@]} "
73+
74+ count=$( ${GREP} -c ' \[ERROR\]' " ${logfile} " )
75+ if [[ ${count} -gt 0 ]]; then
76+ add_vote_table -1 spotless " ${repostatus} has ${count} errors when running spotless:check, run spotless:apply to fix."
77+ add_footer_table spotless " @@BASE@@/${repostatus} -spotless.txt"
78+ return 1
79+ fi
80+
81+ add_vote_table +1 spotless " ${repostatus} has no errors when running spotless:check."
82+ return 0
83+ }
84+
85+ # #####################################
0 commit comments