# Shell script fragment to infer the location of # $SPOTBUGS_HOME and assign it to the spotbugs_home shell # variable. Also sets the fb_osname shell variable, # as the output of uname. script.get.fbhome=\ spotbugs_home=@SPOTBUGS_HOME@\n\ fb_osname=`uname`\n\ \n\ if [ ! -d "$spotbugs_home" ]; then\n\ \techo "The path $spotbugs_home,"\n\ \techo "which is where I think SpotBugs is located,"\n\ \techo "does not seem to be a directory."\n\ \texit 1\n\ fi # Define the escape_arg function, which turns an arbitrary string into # a escaped version that may be appended to an argument list. # No quotes should be used in the construction of the # argument list string. Escapes (backslashes) are added where needed # to preserve spaces, quote characters, and special characters inside # the single argument being added. # # Usage: # my_args="$my_args `escape_arg "$first_arg"`" # my_args="$my_args `escape_arg "$second_arg"`" # ... # exec java -Xmx584m $main_class $my_args # # Bourne shell programming really, really sucks. script.define.escape_arg=\ escape_arg() {\n\ \techo "$1" | sed -e "s,\\\\([\\\\\\"' \t]\\\\),\\\\\\\\\\\\1,g"\n\ } # Pick a default Java executable. # This should be done before executing any code that # could override fb_javacmd. script.set.default.java=\ # Choose default java binary\n\ fb_javacmd=java\n\ if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then\n\ \tfb_javacmd="$JAVA_HOME/bin/java"\n\ fi # Fragment to execute java, using the arguments stored # in the shell's $@ variable (and/or in the $fb_appargs variable). # Unless fb_appjar is specified, assumes the class to be executed # is in $spotbugs_home/lib/spotbugs.jar. script.wrap.java=\ fb_javacmd=\${fb_javacmd:-"java"}\n\ fb_maxheap=\${fb_maxheap:-"-Xmx768m"}\n\ fb_classpath=$spotbugs_home/lib/config:$(build-classpath spotbugs)\n\ if [ -n "$CLASSPATH" ]; then\n\ \tfb_classpath+=":$CLASSPATH"\n\ fi\n\ set -f\n\ exec "$fb_javacmd" \\\n\ \t-classpath "$fb_classpath" \\\n\ \t-Dspotbugs.home="$spotbugs_home"\\\n\ \t$fb_maxheap $fb_jvmargs $fb_mainclass \${@:+"$@"} $fb_appargs