Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions BUILDING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Requirements:

* JDK 1.8+
* Maven 3.1 or later
* Findbugs 2.0.2 or later (if running findbugs)
* ProtocolBuffer 2.5.0
* Internet connection for first build (to fetch all dependencies)
* Hadoop version should be 2.7.0 or higher.
Expand Down Expand Up @@ -36,7 +35,7 @@ Maven build goals:
* Compile : mvn compile
* Run tests : mvn test
* Create JAR : mvn package
* Run findbugs : mvn compile findbugs:findbugs
* Run spotsbugs : mvn compile spotbugs:spotsbugs
* Run checkstyle : mvn compile checkstyle:checkstyle
* Install JAR in M2 cache : mvn install
* Deploy JAR to Maven repo : mvn deploy
Expand Down
9 changes: 0 additions & 9 deletions build-tools/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,6 @@ RUN apt-get -q update && apt-get -q install --no-install-recommends -y default-j
&& ln -s java-8-openjdk-amd64 /usr/lib/jvm/default-java
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64

######
# Install findbugs
######
# hadolint ignore=DL3008
RUN apt-get -q update && apt-get -q install --no-install-recommends -y findbugs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV FINDBUGS_HOME /usr

######
# Install maven
######
Expand Down
67 changes: 33 additions & 34 deletions build-tools/test-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ DIFF=${DIFF:-diff}
JIRACLI=${JIRA:-jira}
SED=${SED:-sed}
CURL=${CURL:-curl}
FINDBUGS_HOME=${FINDBUGS_HOME}

###############################################################################
printUsage() {
Expand All @@ -60,7 +59,7 @@ printUsage() {
echo "--grep-cmd=<cmd> The 'grep' command to use (default 'grep')"
echo "--patch-cmd=<cmd> The 'patch' command to use (default 'patch')"
echo "--diff-cmd=<cmd> The 'diff' command to use (default 'diff')"
echo "--findbugs-home=<path> Findbugs home directory (default FINDBUGS_HOME environment variable)"
echo "--spotbugs-home=<path> SpotsBugs home directory (default SPOTBUGS_HOME environment variable)"
echo "--dirty-workspace Allow the local git workspace to have uncommitted changes"
echo "--run-tests Run all tests below the base directory"
echo
Expand Down Expand Up @@ -115,8 +114,8 @@ parseArgs() {
--jira-password=*)
JIRA_PASSWD=${i#*=}
;;
--findbugs-home=*)
FINDBUGS_HOME=${i#*=}
--spotbugs-home=*)
SPOTBUGS_HOME=${i#*=}
;;
--dirty-workspace)
DIRTY_WORKSPACE=true
Expand Down Expand Up @@ -507,7 +506,7 @@ $JIRA_COMMENT_FOOTER"


###############################################################################
### Install the new jars so tests and findbugs can find all of the updated jars
### Install the new jars so tests and SpotsBugs can find all of the updated jars
buildAndInstall () {
echo ""
echo ""
Expand All @@ -525,67 +524,67 @@ buildAndInstall () {


###############################################################################
### Check there are no changes in the number of Findbugs warnings
checkFindbugsWarnings () {
### Check there are no changes in the number of SpotBugs warnings
checkSpotBugsWarnings () {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Determining number of patched Findbugs warnings."
echo " Determining number of patched SpotBugs warnings."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""

rc=0
echo " Running findbugs "
echo "$MVN clean test findbugs:findbugs -DskipTests < /dev/null > $PATCH_DIR/patchFindBugsOutput.txt 2>&1"
$MVN clean test findbugs:findbugs -DskipTests < /dev/null > $PATCH_DIR/patchFindBugsOutput.txt 2>&1
echo " Running SpotBugs "
echo "$MVN clean test spotbugs:spotbugs -DskipTests < /dev/null > $PATCH_DIR/patchSpotBugsOutput.txt 2>&1"
$MVN clean test spotbugs:spotbugs -DskipTests < /dev/null > $PATCH_DIR/patchSpotBugsOutput.txt 2>&1
rc=$?
findbugs_version=$(${AWK} 'match($0, /findbugs-maven-plugin:[^:]*:findbugs/) { print substr($0, RSTART + 22, RLENGTH - 31); exit }' "${PATCH_DIR}/patchFindBugsOutput.txt")
spotbugs_version=$(${AWK} 'match($0, /spotbugs-maven-plugin:[^:]*:spotbugs/) { print substr($0, RSTART + 22, RLENGTH - 31); exit }' "${PATCH_DIR}/patchSpotBugsOutput.txt")

if [ $rc != 0 ] ; then
JIRA_COMMENT="$JIRA_COMMENT

{color:red}-1 findbugs{color}. The patch appears to cause Findbugs (version ${findbugs_version}) to fail."
{color:red}-1 spotbugs{color}. The patch appears to cause SpotsBugs (version ${spotbugs_version}) to fail."
return 1
fi

findbugsWarnings=0
for file in $(find $BASEDIR -name findbugsXml.xml)
spotbugsWarnings=0
for file in $(find $BASEDIR -name spotbugsXml.xml)
do
relative_file=${file#$BASEDIR/} # strip leading $BASEDIR prefix
if [ ! $relative_file == "target/findbugsXml.xml" ]; then
module_suffix=${relative_file%/target/findbugsXml.xml} # strip trailing path
if [ ! $relative_file == "target/spotbugsXml.xml" ]; then
module_suffix=${relative_file%/target/spotbugsXml.xml} # strip trailing path
module_suffix=`basename ${module_suffix}`
fi

cp $file $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
$FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
$PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
$PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
newFindbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
$PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml | $AWK '{print $1}'`
echo "Found $newFindbugsWarnings Findbugs warnings ($file)"
findbugsWarnings=$((findbugsWarnings+newFindbugsWarnings))
$FINDBUGS_HOME/bin/convertXmlToText -html \
$PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml \
$PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.html
if [[ $newFindbugsWarnings > 0 ]] ; then
JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/patchprocess/newPatchFindbugsWarnings${module_suffix}.html
cp $file $PATCH_DIR/patchSpotbugsWarnings${module_suffix}.xml
$SPOTBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
$PATCH_DIR/patchSpotbugsWarnings${module_suffix}.xml \
$PATCH_DIR/patchSpotbugsWarnings${module_suffix}.xml
newSpotbugsWarnings=`$SPOTBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchSpotbugsWarnings${module_suffix}.xml \
$PATCH_DIR/newPatchSpotbugsWarnings${module_suffix}.xml | $AWK '{print $1}'`
echo "Found $newSpotbugsWarnings SpotBugs warnings ($file)"
spotbugsWarnings=$((spotbugsWarnings+newSpotbugsWarnings))
$SPOTBUGS_HOME/bin/convertXmlToText -html \
$PATCH_DIR/newPatchSpotbugsWarnings${module_suffix}.xml \
$PATCH_DIR/newPatchSpotbugsWarnings${module_suffix}.html
if [[ $newSpotbugsWarnings > 0 ]] ; then
JIRA_COMMENT_FOOTER="SpotBugs warnings: $BUILD_URL/artifact/patchprocess/newPatchSpotbugsWarnings${module_suffix}.html
$JIRA_COMMENT_FOOTER"
fi
done

if [[ $findbugsWarnings -gt 0 ]] ; then
if [[ $spotbugsWarnings -gt 0 ]] ; then
JIRA_COMMENT="$JIRA_COMMENT

{color:red}-1 findbugs{color}. The patch appears to introduce $findbugsWarnings new Findbugs (version ${findbugs_version}) warnings."
{color:red}-1 spotbugs{color}. The patch appears to introduce $spotbugsWarnings new SpotBugs (version ${spotbugs_version}) warnings."
return 1
fi
JIRA_COMMENT="$JIRA_COMMENT

{color:green}+1 findbugs{color}. The patch does not introduce any new Findbugs (version ${findbugs_version}) warnings."
{color:green}+1 spotbugs{color}. The patch does not introduce any new SpotBugs (version ${spotbugs_version}) warnings."
return 0
}

Expand Down Expand Up @@ -805,7 +804,7 @@ fi
checkJavadocWarnings
(( RESULT = RESULT + $? ))
buildAndInstall
checkFindbugsWarnings
checkSpotBugsWarnings
(( RESULT = RESULT + $? ))
checkReleaseAuditWarnings
(( RESULT = RESULT + $? ))
Expand Down
73 changes: 30 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
<protoc.path>${env.PROTOC_PATH}</protoc.path>
<scm.url>scm:git:https://gitbox.apache.org/repos/asf/tez.git</scm.url>
<frontend-maven-plugin.version>1.4</frontend-maven-plugin.version>
<findbugs-maven-plugin.version>3.0.5</findbugs-maven-plugin.version>
<maven-checkstyle-plugin.version>3.1.1</maven-checkstyle-plugin.version>
<spotbugs.version>4.1.4</spotbugs.version>
<maven-checkstyle-plugin.version>3.1.1</maven-checkstyle-plugin.version>
<checkstyle.version>8.35</checkstyle.version>
<dependency-check-maven.version>1.3.6</dependency-check-maven.version>
<test.build.data>${project.build.directory}/tmp</test.build.data>
Expand Down Expand Up @@ -695,9 +695,17 @@
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.0</version>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>${spotbugs.version}</version>
<optional>true</optional>
</dependency>
<!-- Dependency for SpotBugs -->
<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<version>1.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
Expand Down Expand Up @@ -878,9 +886,13 @@
<version>${dependency-check-maven.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs-maven-plugin.version}</version>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs.version}</version>
<configuration>
<excludeFilterFile>${project.basedir}/findbugs-exclude.xml</excludeFilterFile>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -1002,11 +1014,8 @@
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<excludeFilterFile>${basedir}/findbugs-exclude.xml</excludeFilterFile>
</configuration>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
</plugin>
<plugin>
<!-- OWASP's dependency-check plugin will scan the third party
Expand Down Expand Up @@ -1098,45 +1107,23 @@
</build>
</profile>
<profile>
<id>findbugs</id>
<id>spotbugs</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>findbugs</name>
<name>spotbugs</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<executions>
<execution>
<id>site</id>
<phase>pre-site</phase>
<goals>
<goal>findbugs</goal>
</goals>
</execution>
</executions>
<configuration>
<excludeFilterFile>${basedir}/findbugs-exclude.xml</excludeFilterFile>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
<canGenerate>true</canGenerate>
<excludeFilterFile>${basedir}/findbugs-exclude.xml</excludeFilterFile>
<xmlOutput>true</xmlOutput>
<!-- Optional directory to put spotbugs xdoc xml report -->
<xmlOutputDirectory>target/site</xmlOutputDirectory>
<excludeFilterFile>${project.basedir}/findbugs-exclude.xml</excludeFilterFile>
</configuration>
</plugin>
</plugins>
Expand Down
4 changes: 0 additions & 4 deletions tez-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions tez-dag/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions tez-runtime-internals/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
Expand Down