blob: 4b965089991a456625f8249cbe059936eca6ec90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
#! /bin/sh
# Launch FindBugs from the command line.
escape_arg() {
echo "$1" | sed -e "s,\\([\\\"' ]\\),\\\\\\1,g"
}
program="$0"
# Follow symlinks until we get to the actual file.
while [ -h "$program" ]; do
link=`ls -ld "$program"`
link=`expr "$link" : '.*-> \(.*\)'`
if [ "`expr "$link" : '/.*'`" = 0 ]; then
# Relative
dir=`dirname "$program"`
program="$dir/$link"
else
# Absolute
program="$link"
fi
done
# Assume findbugs home directory is the parent
# of the directory containing the script (which should
# normally be "$findbugs_home/bin").
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,"
echo "does not seem to be a directory."
exit 1
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_appjar="$findbugs_home/lib/findbugs.jar"
ShowHelpAndExit() {
fb_mainclass="edu.umd.cs.findbugs.ShowHelp"
fb_javacmd=${fb_javacmd:-"java"}
fb_maxheap=${fb_maxheap:-"-Xmx768m"}
fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}
set -f
#echo command: \
exec "$fb_javacmd" \
-classpath "$fb_appjar$fb_pathsep$CLASSPATH" \
-Dfindbugs.home="$findbugs_home"\
$fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs
exit 0
}
# Set defaults
fb_mainclass="edu.umd.cs.findbugs.workflow.FB"
user_jvmargs=''
ea_arg=''
debug_arg=''
conservespace_arg=''
workhard_arg=''
user_props=''
# Handle command line arguments.
while [ $# -gt 0 ]; do
case $1 in
-textui)
fb_mainclass="edu.umd.cs.findbugs.FindBugs2"
;;
-jvmArgs)
shift
user_jvmargs="$1"
;;
-ea)
ea_arg='-ea'
;;
-maxHeap)
shift
fb_maxheap="-Xmx$1m"
;;
-javahome)
shift
fb_javacmd="$1/bin/java"
;;
-debug)
debug_arg="-Dfindbugs.debug=true"
;;
-conserveSpace)
conservespace_arg="-Dfindbugs.conserveSpace=true"
;;
-property)
shift
user_props="-D$1 $user_props"
;;
-D*=*)
user_props="$1 $user_props"
;;
-version)
fb_mainclass=edu.umd.cs.findbugs.Version
fb_appargs="-release"
while [ $# -gt 0 ]; do
shift
done
fb_javacmd=${fb_javacmd:-"java"}
fb_maxheap=${fb_maxheap:-"-Xmx768m"}
fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}
set -f
#echo command: \
exec "$fb_javacmd" \
-classpath "$fb_appjar$fb_pathsep$CLASSPATH" \
-Dfindbugs.home="$findbugs_home"\
$fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs
exit 0
;;
-help)
ShowHelpAndExit
;;
# All unrecognized arguments will be accumulated and
# passed to the application.
*)
fb_appargs="$fb_appargs `escape_arg "$1"`"
;;
esac
shift
done
fb_jvmargs="$user_jvmargs $debug_arg $conservespace_arg $workhard_arg $user_props $ea_arg"
if [ $maxheap ]; then
fb_maxheap="-Xmx${maxheap}m"
fi
# 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
fb_javacmd=${fb_javacmd:-"java"}
fb_maxheap=${fb_maxheap:-"-Xmx768m"}
fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}
set -f
#echo command: \
exec "$fb_javacmd" \
-classpath "$fb_appjar$fb_pathsep$CLASSPATH" \
-Dfindbugs.home="$findbugs_home"\
$fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs
# vim:ts=3
|