Home | History | Annotate | Download | only in bin
      1 #! /bin/sh
      2 
      3 # Generate a defect density table from a bug collection
      4 
      5 program="$0"
      6 
      7 # Follow symlinks until we get to the actual file.
      8 while [ -h "$program" ]; do
      9 	link=`ls -ld "$program"`
     10 	link=`expr "$link" : '.*-> \(.*\)'`
     11 	if [ "`expr "$link" : '/.*'`" = 0 ]; then
     12 		# Relative
     13 		dir=`dirname "$program"`
     14 		program="$dir/$link"
     15 	else
     16 		# Absolute
     17 		program="$link"
     18 	fi
     19 done
     20 
     21 # Assume findbugs home directory is the parent
     22 # of the directory containing the script (which should
     23 # normally be "$findbugs_home/bin").
     24 dir=`dirname "$program"`
     25 findbugs_home="$dir/.."
     26 
     27 # Handle FHS-compliant installations (e.g., Fink)
     28 if [ -d "$findbugs_home/share/findbugs" ]; then
     29 	findbugs_home="$findbugs_home/share/findbugs"
     30 fi
     31 
     32 # Make absolute
     33 findbugs_home=`cd "$findbugs_home" && pwd`
     34 
     35 fb_pathsep=':'
     36 
     37 # Handle cygwin, courtesy of Peter D. Stout
     38 fb_osname=`uname`
     39 if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then
     40 	findbugs_home=`cygpath --mixed "$findbugs_home"`
     41 	fb_pathsep=';'
     42 fi
     43 # Handle MKS, courtesy of Kelly O'Hair
     44 if [ "${fb_osname}" = "Windows_NT" ]; then
     45 	fb_pathsep=';'
     46 fi
     47 
     48 if [ ! -d "$findbugs_home" ]; then
     49 	echo "The path $findbugs_home,"
     50 	echo "which is where I think FindBugs is located,"
     51 	echo "does not seem to be a directory."
     52 	exit 1
     53 fi
     54 
     55 # Choose default java binary
     56 fb_javacmd=java
     57 if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then
     58 	if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then
     59 		fb_javacmd=`cygpath --mixed "$JAVA_HOME"`/bin/java
     60 	else
     61 		fb_javacmd="$JAVA_HOME/bin/java"
     62 	fi
     63 fi
     64 
     65 fb_mainclass=edu.umd.cs.findbugs.workflow.DefectDensity
     66 
     67 fb_javacmd=${fb_javacmd:-"java"}
     68 fb_maxheap=${fb_maxheap:-"-Xmx768m"}
     69 fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}
     70 set -f
     71 #echo command: \
     72 exec "$fb_javacmd" \
     73 	-classpath "$fb_appjar$fb_pathsep$CLASSPATH" \
     74 	-Dfindbugs.home="$findbugs_home"\
     75 	$fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs
     76 
     77 # vim:ts=3
     78