From d30d06eb65b0e98913550bc8d37c8e5e89ed1d73 Mon Sep 17 00:00:00 2001 From: Greg Lewis Date: Sun, 13 Mar 2011 23:00:17 +0000 Subject: [PATCH] . Add a port of FindBugs: FindBugs looks for bugs in Java programs. It is based on the concept of bug patterns. A bug pattern is a code idiom that is often an error. Bug patterns arise for a variety of reasons: * Difficult language features * Misunderstood API methods * Misunderstood invariants when code is modified during maintenance * Garden variety mistakes: typos, use of the wrong boolean operator FindBugs uses static analysis to inspect Java bytecode for occurrences of bug patterns. WWW: http://findbugs.sourceforge.net/ --- devel/Makefile | 1 + devel/java-findbugs/Makefile | 79 +++++++++++++++++++++++ devel/java-findbugs/distinfo | 2 + devel/java-findbugs/files/patch-findbugs2 | 75 +++++++++++++++++++++ devel/java-findbugs/pkg-descr | 13 ++++ 5 files changed, 170 insertions(+) create mode 100644 devel/java-findbugs/Makefile create mode 100644 devel/java-findbugs/distinfo create mode 100644 devel/java-findbugs/files/patch-findbugs2 create mode 100644 devel/java-findbugs/pkg-descr diff --git a/devel/Makefile b/devel/Makefile index 969ec303fb76..183f1e8cf53a 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -673,6 +673,7 @@ SUBDIR += jakelib2 SUBDIR += jam SUBDIR += jansson + SUBDIR += java-findbugs SUBDIR += java-util-concurrent SUBDIR += javolution SUBDIR += jclassinfo diff --git a/devel/java-findbugs/Makefile b/devel/java-findbugs/Makefile new file mode 100644 index 000000000000..ac19c5fd7f80 --- /dev/null +++ b/devel/java-findbugs/Makefile @@ -0,0 +1,79 @@ +# New ports collection makefile for: findbugs +# Date created: 19 December 2010 +# Whom: glewis +# +# $FreeBSD$ +# + +PORTNAME= findbugs +PORTVERSION= 1.3.9 +CATEGORIES= devel java +MASTER_SITES= SF +PKGNAMEPREFIX= java- + +MAINTAINER= glewis@FreeBSD.org +COMMENT= Find Bugs in Java Programs + +RUN_DEPENDS= java:${PORTSDIR}/java/javavmwrapper + +LICENSE= LGPL21 +USE_JAVA= yes +NO_BUILD= yes + +JAR_FILES= annotations.jar \ + ant.jar \ + asm-3.1.jar \ + asm-analysis-3.1.jar \ + asm-commons-3.1.jar \ + asm-tree-3.1.jar \ + asm-util-3.1.jar \ + asm-xml-3.1.jar \ + bcel.jar \ + commons-lang-2.4.jar \ + dom4j-1.6.1.jar \ + ${PORTNAME}.jar \ + ${PORTNAME}-ant.jar \ + jFormatString.jar \ + jaxen-1.1.1.jar \ + jdepend-2.9.jar \ + jsr305.jar \ + mysql-connector-java-5.1.7-bin.jar + +.for f in ${JAR_FILES} +PLIST_FILES+= %%DATADIR%%/lib/${f} +.endfor +PLIST_FILES+= %%DATADIR%%/bin/${PORTNAME} \ + bin/${PORTNAME} + +.if !defined(NOPORTDOCS) +PORTDOCS= * +.endif + +.if !defined(NOPORTEXAMPLES) +PORTEXAMPLES= * +.endif + +do-install: + @-${MKDIR} ${DATADIR}/lib +.for f in ${JAR_FILES} + @${INSTALL_DATA} ${WRKSRC}/lib/${f} ${DATADIR}/lib/ +.endfor + @-${MKDIR} ${DATADIR}/bin + @${REINPLACE_CMD} -e "s:%%LOCALBASE%%:${LOCALBASE}:" \ + -e "s:%%JAVAJARDIR%%:${JAVAJARDIR}:" ${WRKSRC}/bin/${PORTNAME}2 + ${INSTALL_SCRIPT} ${WRKSRC}/bin/${PORTNAME}2 ${DATADIR}/bin/${PORTNAME} + ${LN} -sf ${DATADIR}/bin/${PORTNAME} ${PREFIX}/bin/${PORTNAME} +.if !defined(NOPORTDOCS) + @-${MKDIR} ${DOCSDIR} +.for f in LICENSE* README* + @${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR} +.endfor + @cd ${WRKSRC}/doc && ${COPYTREE_SHARE} . ${DOCSDIR}/ +.endif +.if !defined(NOPORTEXAMPLES) + @-${MKDIR} ${EXAMPLESDIR} + @cd ${WRKSRC}/src && ${COPYTREE_SHARE} . ${EXAMPLESDIR}/ + @cd ${WRKSRC}/bin && ${COPYTREE_BIN} . ${EXAMPLESDIR}/ +.endif + +.include diff --git a/devel/java-findbugs/distinfo b/devel/java-findbugs/distinfo new file mode 100644 index 000000000000..a8cc1522cc8b --- /dev/null +++ b/devel/java-findbugs/distinfo @@ -0,0 +1,2 @@ +SHA256 (findbugs-1.3.9.tar.gz) = 6805754cb7933855695d56a4626227ba0320c8e36687b37362e99a59c80a5052 +SIZE (findbugs-1.3.9.tar.gz) = 7481095 diff --git a/devel/java-findbugs/files/patch-findbugs2 b/devel/java-findbugs/files/patch-findbugs2 new file mode 100644 index 000000000000..3f1687405cab --- /dev/null +++ b/devel/java-findbugs/files/patch-findbugs2 @@ -0,0 +1,75 @@ +--- bin/findbugs2.orig 2010-12-26 13:57:04.000000000 -0800 ++++ bin/findbugs2 2010-12-26 14:00:48.000000000 -0800 +@@ -27,27 +27,11 @@ + dir=`dirname "$program"` + findbugs_home="$dir/.." + +-# Handle FHS-compliant installations (e.g., Fink) +-if [ -d "$findbugs_home/share/findbugs" ]; then +- findbugs_home="$findbugs_home/share/findbugs" +-fi +- + # Make absolute + findbugs_home=`cd "$findbugs_home" && pwd` + + fb_pathsep=':' + +-# Handle cygwin, courtesy of Peter D. Stout +-fb_osname=`uname` +-if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then +- findbugs_home=`cygpath --mixed "$findbugs_home"` +- fb_pathsep=';' +-fi +-# Handle MKS, courtesy of Kelly O'Hair +-if [ "${fb_osname}" = "Windows_NT" ]; then +- fb_pathsep=';' +-fi +- + if [ ! -d "$findbugs_home" ]; then + echo "The path $findbugs_home," + echo "which is where I think FindBugs is located," +@@ -56,14 +40,7 @@ + fi + + # Choose default java binary +-fb_javacmd=java +-if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then +- if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then +- fb_javacmd=`cygpath --mixed "$JAVA_HOME"`/bin/java +- else +- fb_javacmd="$JAVA_HOME/bin/java" +- fi +-fi ++fb_javacmd="%%LOCALBASE%%/bin/java" + + # Default UI is GUI2 + fb_launchui="2" +@@ -133,7 +110,7 @@ + jvm_user_props="-D$1 $jvm_user_props" + shift + ;; +- ++ + -D*=*) + jvm_user_props="$1 $user_props" + shift +@@ -158,17 +135,9 @@ + + done + +-# Extra JVM args for MacOSX. +-if [ $fb_osname = "Darwin" ]; then +- fb_jvmargs="$fb_jvmargs \ +- -Xdock:name=FindBugs -Xdock:icon=${findbugs_home}/lib/buggy.icns \ +- -Dapple.laf.useScreenMenuBar=true" +-fi +- + # + # Launch JVM + # +-exec "$fb_javacmd" \ +- -classpath "$fb_appjar$fb_pathsep$CLASSPATH" \ ++JAVA_VERSION="1.5+" exec "$fb_javacmd" \ + -Dfindbugs.home="$findbugs_home" \ + $jvm_debug $jvm_maxheap $jvm_ea $jvm_conservespace $jvm_user_props \ + -Dfindbugs.launchUI=$fb_launchui \ diff --git a/devel/java-findbugs/pkg-descr b/devel/java-findbugs/pkg-descr new file mode 100644 index 000000000000..2bd63b00c564 --- /dev/null +++ b/devel/java-findbugs/pkg-descr @@ -0,0 +1,13 @@ +FindBugs looks for bugs in Java programs. It is based on the concept of bug +patterns. A bug pattern is a code idiom that is often an error. Bug patterns +arise for a variety of reasons: + +* Difficult language features +* Misunderstood API methods +* Misunderstood invariants when code is modified during maintenance +* Garden variety mistakes: typos, use of the wrong boolean operator + +FindBugs uses static analysis to inspect Java bytecode for occurrences of +bug patterns. + +WWW: http://findbugs.sourceforge.net/