blob: 0cc46215c3d4a2d21ce964890ed9371dabb05645 (
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
@echo off
:: Launch FindBugs on a Windows system.
:: Adapted from scripts found at http://www.ericphelps.com/batch/
:: This will only work on Windows NT or later!
:: Don't affect environment outside of this invocation
setlocal
:: ----------------------------------------------------------------------
:: Set up default values
:: ----------------------------------------------------------------------
set appjar=findbugs.jar
set javahome=
set launcher=java.exe
set start=start "FindBugs"
set jvmargs=
set debugArg=
set conserveSpaceArg=
set workHardArg=
set args=
set javaProps=
set maxheap=768
REM default UI is gui2
set launchUI=2
:: Try finding the default FINDBUGS_HOME directory
:: from the directory path of this script
set default_findbugs_home=%~dp0..
:: Honor JAVA_HOME environment variable if it is set
if "%JAVA_HOME%"=="" goto nojavahome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto nojavahome
set javahome=%JAVA_HOME%\bin\
:nojavahome
goto loop
:: ----------------------------------------------------------------------
:: Process command-line arguments
:: ----------------------------------------------------------------------
:shift2
shift
:shift1
shift
:loop
:: Remove surrounding quotes from %1 and %2
set firstArg=%~1
set secondArg=%~2
if "%firstArg%"=="" goto launch
:: AddMessages
if not "%firstArg%"=="-addMessages" goto notAddMessages
set fb_mainclass=edu.umd.cs.findbugs.AddMessages
goto shift1
:notAddMessages
:: computeBugHistory
if not "%firstArg%"=="-computeBugHistory" goto notUpdate
set fb_mainclass=edu.umd.cs.findbugs.workflow.Update
goto shift1
:notUpdate
:: convertXmlToText
if not "%firstArg%"=="-xmltotext" goto notXmlToText
set fb_mainclass=edu.umd.cs.findbugs.PrintingBugReporter
goto shift1
:notXmlToText
:: copyBuggySource
if not "%firstArg%"=="-copyBS" goto notCopyBS
set fb_mainclass=edu.umd.cs.findbugs.workflow.CopyBuggySource
goto shift1
:notCopyBS
:: defectDensity
if not "%firstArg%"=="-defectDensity" goto notDefectDensity
set fb_mainclass=edu.umd.cs.findbugs.workflow.DefectDensity
goto shift1
:notDefectDensity
:: filterBugs
if not "%firstArg%"=="-filterBugs" goto notFilterBugs
set fb_mainclass=edu.umd.cs.findbugs.workflow.Filter
goto shift1
:notFilterBugs
:: listBugDatabaseInfo
if not "%firstArg%"=="-listBugDatabaseInfo" goto notListBugDatabaseInfo
set fb_mainclass=edu.umd.cs.findbugs.workflow.ListBugDatabaseInfo
goto shift1
:notListBugDatabaseInfo
:: mineBugHistory
if not "%firstArg%"=="-mineBugHistory" goto notMineBugHistory
set fb_mainclass=edu.umd.cs.findbugs.workflow.MineBugHistory
goto shift1
:notMineBugHistory
:: printAppVersion
if not "%firstArg%"=="-printAppVersion" goto notPrintAppVersion
set fb_mainclass=edu.umd.cs.findbugs.workflow.PrintAppVersion
goto shift1
:notPrintAppVersion
:: printClass
if not "%firstArg%"=="-printClass" goto notPrintClass
set fb_mainclass=edu.umd.cs.findbugs.workflow.PrintClass
goto shift1
:notPrintClass
:: rejarForAnalysis
if not "%firstArg%"=="-rejar" goto notRejar
set fb_mainclass=edu.umd.cs.findbugs.workflow.RejarClassesForAnalysis
goto shift1
:notRejar
:: setBugDatabaseInfo
if not "%firstArg%"=="-setInfo" goto notSetBugDatabaseInfo
set fb_mainclass=edu.umd.cs.findbugs.workflow.SetBugDatabaseInfo
goto shift1
:notSetBugDatabaseInfo
:: unionBugs
if not "%firstArg%"=="-unionBugs" goto notUnionBugs
set fb_mainclass=edu.umd.cs.findbugs.workflow.UnionResults
goto shift1
:notUnionBugs
:: xpathFind
if not "%firstArg%"=="-xpathFind" goto notXPathFind
set fb_mainclass=edu.umd.cs.findbugs.workflow.XPathFind
goto shift1
:notXPathFind
if not "%firstArg%"=="-gui" goto notGui
set launchUI=2
set launcher=javaw.exe
goto shift1
:notGui
if not "%firstArg%"=="-gui1" goto notGui1
set launchUI=1
set javaProps=-Dfindbugs.launchUI=1 %javaProps%
set launcher=javaw.exe
goto shift1
:notGui1
if not "%firstArg%"=="-textui" goto notTextui
set launchUI=0
set launcher=java.exe
set start=
goto shift1
:notTextui
if not "%firstArg%"=="-debug" goto notDebug
set launcher=java.exe
set start=
set debugArg=-Dfindbugs.debug=true
goto shift1
:notDebug
if not "%firstArg%"=="-help" goto notHelp
set launchUI=help
set launcher=java.exe
set start=
goto shift1
:notHelp
if not "%firstArg%"=="-version" goto notVersion
set launchUI=version
set launcher=java.exe
set start=
goto shift1
:notVersion
if "%firstArg%"=="-home" set FINDBUGS_HOME=%secondArg%
if "%firstArg%"=="-home" goto shift2
if "%firstArg%"=="-jvmArgs" set jvmargs=%secondArg%
if "%firstArg%"=="-jvmArgs" goto shift2
if "%firstArg%"=="-maxHeap" set maxheap=%secondArg%
if "%firstArg%"=="-maxHeap" goto shift2
if "%firstArg%"=="-conserveSpace" set conserveSpaceArg=-Dfindbugs.conserveSpace=true
if "%firstArg%"=="-conserveSpace" goto shift1
if "%firstArg%"=="-workHard" set workHardArg=-Dfindbugs.workHard=true
if "%firstArg%"=="-workHard" goto shift1
if "%firstArg%"=="-javahome" set javahome=%secondArg%\bin\
if "%firstArg%"=="-javahome" goto shift2
if "%firstArg%"=="-property" set javaProps=-D%secondArg% %javaProps%
if "%firstArg%"=="-property" goto shift2
if "%firstArg%"=="" goto launch
set args=%args% "%firstArg%"
goto shift1
:: ----------------------------------------------------------------------
:: Launch FindBugs
:: ----------------------------------------------------------------------
:launch
:: Make sure FINDBUGS_HOME is set.
:: If it isn't, try using the default value based on the
:: directory path of the invoked script.
:: Note that this will fail miserably if the value of FINDBUGS_HOME
:: has quote characters in it.
if not "%FINDBUGS_HOME%"=="" goto checkHomeValid
set FINDBUGS_HOME=%default_findbugs_home%
:checkHomeValid
if not exist "%FINDBUGS_HOME%\lib\%appjar%" goto homeNotSet
:found_home
:: Launch FindBugs!
if "%fb_mainclass%"=="" goto runJar
"%javahome%%launcher%" %debugArg% %conserveSpaceArg% %workHardArg% %javaProps% "-Dfindbugs.home=%FINDBUGS_HOME%" -Xmx%maxheap%m %jvmargs% "-Dfindbugs.launchUI=%launchUI%" -cp "%FINDBUGS_HOME%\lib\%appjar%" %fb_mainclass% %args%
goto end
:runjar
%start% "%javahome%%launcher%" %debugArg% %conserveSpaceArg% %workHardArg% %javaProps% "-Dfindbugs.home=%FINDBUGS_HOME%" -Xmx%maxheap%m %jvmargs% "-Dfindbugs.launchUI=%launchUI%" -jar "%FINDBUGS_HOME%\lib\%appjar%" %args%
goto end
:: ----------------------------------------------------------------------
:: Report that FINDBUGS_HOME is not set (and was not specified)
:: ----------------------------------------------------------------------
:homeNotSet
echo Could not find FindBugs home directory. There may be a problem
echo with the FindBugs installation. Try setting FINDBUGS_HOME, or
echo re-installing.
goto end
:end
|