From 5ec2361fedac531527528b51db6dd909b2d878b9 Mon Sep 17 00:00:00 2001 From: Elliott Clark Date: Wed, 15 Oct 2014 10:28:45 -0700 Subject: [PATCH] HBASE-12261 Add checkstyle to HBase build process --- dev-support/test-patch.sh | 40 +++++++++++++++++--- hbase-checkstyle/pom.xml | 32 ++++++++++++++++ .../resources/hbase/checkstyle-suppressions.xml | 8 ++++ .../src/main/resources/hbase/checkstyle.xml | 32 ++++++++++++++++ pom.xml | 44 +++++++++++++++++++++- 5 files changed, 148 insertions(+), 8 deletions(-) create mode 100644 hbase-checkstyle/pom.xml create mode 100644 hbase-checkstyle/src/main/resources/hbase/checkstyle-suppressions.xml create mode 100644 hbase-checkstyle/src/main/resources/hbase/checkstyle.xml diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh index 1cad668..4e970cb 100755 --- a/dev-support/test-patch.sh +++ b/dev-support/test-patch.sh @@ -220,7 +220,6 @@ setup () { against trunk revision ${SVN_REVISION}. ATTACHMENT ID: ${ATTACHMENT_ID}" - #PENDING: cp -f $SUPPORT_DIR/etc/checkstyle* ./src/test ### Copy the patch file to $PATCH_DIR else VERSION=PATCH-${defect} @@ -250,16 +249,17 @@ setup () { echo "======================================================================" echo "" echo "" - echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavacWarnings.txt 2>&1" + echo "$MVN clean package checkstyle:checkstyle-aggregate -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavacWarnings.txt 2>&1" export MAVEN_OPTS="${MAVEN_OPTS}" # build core and tests - $MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavacWarnings.txt 2>&1 + $MVN clean package checkstyle:checkstyle-aggregate -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavacWarnings.txt 2>&1 if [[ $? != 0 ]] ; then ERR=`$GREP -A 5 'Compilation failure' $PATCH_DIR/trunkJavacWarnings.txt` echo "Trunk compilation is broken? {code}$ERR{code}" cleanupAndExit 1 fi + mv target/checkstyle-result.xml $PATCH_DIR/trunkCheckstyle.xml } ############################################################################### @@ -493,6 +493,35 @@ checkJavacWarnings () { return 0 } +checkCheckstyleErrors() { + echo "" + echo "" + echo "======================================================================" + echo "======================================================================" + echo " Determining number of patched Checkstyle errors." + echo "======================================================================" + echo "======================================================================" + echo "" + echo "" + if [[ -f $PATCH_DIR/trunkCheckstyle.xml ]] ; then + $MVN package -DskipTests checkstyle:checkstyle-aggregate > /dev/null 2>&1 + mv target/checkstyle-result.xml $PATCH_DIR/patchCheckstyle.xml + trunkCheckstyleErrors=`$GREP ' + + +4.0.0 +org.apache.hbase +hbase-checkstyle +2.0.0-SNAPSHOT +HBase - Checkstyle +Module to hold Checkstyle properties for HBase. + + + \ No newline at end of file diff --git a/hbase-checkstyle/src/main/resources/hbase/checkstyle-suppressions.xml b/hbase-checkstyle/src/main/resources/hbase/checkstyle-suppressions.xml new file mode 100644 index 0000000..3531e2a --- /dev/null +++ b/hbase-checkstyle/src/main/resources/hbase/checkstyle-suppressions.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/hbase-checkstyle/src/main/resources/hbase/checkstyle.xml b/hbase-checkstyle/src/main/resources/hbase/checkstyle.xml new file mode 100644 index 0000000..8f58623 --- /dev/null +++ b/hbase-checkstyle/src/main/resources/hbase/checkstyle.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index e301d51..1b97e38 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,7 @@ hbase-testing-util hbase-annotations hbase-rest + hbase-checkstyle scm:git:git://git.apache.org/hbase.git @@ -664,6 +665,22 @@ ${protoc.path} + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.13 + + + org.apache.hbase + hbase-checkstyle + ${project.version} + + + + hbase/checkstyle.xml + hbase/checkstyle-suppressions.xml + + @@ -713,6 +730,21 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + + org.apache.hbase + hbase-checkstyle + ${project.version} + + + + hbase/checkstyle.xml + hbase/checkstyle-suppressions.xml + + @@ -2361,8 +2393,16 @@ - - + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.13 + + hbase/checkstyle.xml + hbase/checkstyle-suppressions.xml + + -- 2.1.1