author | Stefan Vogel <sv@exept.de> |
Tue, 09 Apr 2013 14:03:12 +0200 | |
changeset 143 | 252c91b7f96d |
parent 102 | a63aa44303e3 |
child 144 | b38e5af6b408 |
permissions | -rw-r--r-- |
72 | 1 |
"{ Package: 'stx:goodies/builder/reports' }" |
2 |
||
3 |
"{ NameSpace: Builder }" |
|
4 |
||
5 |
StandaloneStartup subclass:#ReportRunner |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'Builder-Reports' |
|
10 |
! |
|
11 |
||
12 |
ReportRunner class instanceVariableNames:'parser report debugging' |
|
13 |
||
14 |
" |
|
15 |
The following class instance variables are inherited by this class: |
|
16 |
||
17 |
StandaloneStartup - MutexHandle |
|
18 |
Object - |
|
19 |
" |
|
20 |
! |
|
21 |
||
22 |
||
23 |
!ReportRunner class methodsFor:'initialization'! |
|
24 |
||
25 |
initialize |
|
26 |
||
27 |
super initialize. |
|
28 |
debugging := Transcript notNil and:[Transcript isView]. |
|
29 |
||
30 |
"Created: / 06-11-2011 / 22:07:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
31 |
! ! |
|
32 |
||
33 |
!ReportRunner class methodsFor:'command line options'! |
|
34 |
||
35 |
cmdlineOptionOutputDirectory |
|
36 |
||
37 |
^CmdLineOption new |
|
38 |
short: $D; |
|
39 |
long: 'output-directory'; |
|
40 |
description: 'Default report output directory'; |
|
41 |
action:[:outputdir | |
|
42 |
Report outputDir: outputdir. |
|
43 |
self verboseInfo:'Report dir: ' , Report outputDir asString. |
|
44 |
] |
|
45 |
||
46 |
"Created: / 06-11-2011 / 09:33:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
47 |
! |
|
48 |
||
49 |
cmdlineOptionReport |
|
50 |
||
51 |
^CmdLineOption new |
|
52 |
short: $r; |
|
97
c6a5d1c4df41
changed: #cmdlineOptionReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
53 |
long: 'report'; |
72 | 54 |
description: 'Report to run'; |
55 |
action:[:option | |
|
56 |
report := Smalltalk at: option asSymbol. |
|
57 |
report isNil ifTrue:[ |
|
78
d3f87f298062
Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
77
diff
changeset
|
58 |
Stderr nextPutLine:('ERROR: Report class %1 does not exist (forgot to load package?)' bindWith: option). |
72 | 59 |
"/Smalltalk exit: 1. |
60 |
]. |
|
61 |
report := report new. |
|
62 |
parser options addAll: (CmdLineOption optionsFor: report) |
|
63 |
] |
|
64 |
||
65 |
"Created: / 06-11-2011 / 09:45:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
97
c6a5d1c4df41
changed: #cmdlineOptionReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
92
diff
changeset
|
66 |
"Modified: / 31-10-2012 / 12:40:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
72 | 67 |
! ! |
68 |
||
69 |
!ReportRunner class methodsFor:'defaults'! |
|
70 |
||
77 | 71 |
allowCoverageMeasurementOption |
72 |
||
73 |
^false "CoverageReport will do that" |
|
74 |
||
75 |
"Created: / 13-01-2012 / 11:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
76 |
! |
|
77 |
||
72 | 78 |
allowDebugOption |
79 |
||
80 |
^true |
|
81 |
||
82 |
"Created: / 21-07-2011 / 09:48:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
83 |
! ! |
|
84 |
||
85 |
!ReportRunner class methodsFor:'multiple applications support'! |
|
86 |
||
87 |
applicationRegistryPath |
|
88 |
"the key under which this application stores its process ID in the registry |
|
89 |
as a collection of path-components. |
|
90 |
i.e. if #('foo' 'bar' 'baz') is returned here, the current applications ID will be stored |
|
91 |
in HKEY_CURRENT_USER\Software\foo\bar\baz\CurrentID. |
|
92 |
(would also be used as a relative path for a temporary lock file under unix). |
|
93 |
Used to detect if another instance of this application is already running." |
|
94 |
||
95 |
^ #('exept' 'smalltallx' 'hdreportrunner') |
|
96 |
||
97 |
"Modified: / 21-07-2011 / 09:43:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
98 |
! |
|
99 |
||
100 |
applicationUUID |
|
101 |
"answer an application-specific unique uuid. |
|
102 |
This is used as the name of some exclusive OS-resource, which is used to find out, |
|
103 |
if another instance of this application is already running. |
|
104 |
Under win32, a mutex is used; under unix, an exclusive file in the tempDir could be used." |
|
105 |
||
106 |
^ '99f65c80-b375-11e0-86ad-0013e89c0459' asUUID |
|
107 |
||
108 |
"Modified: / 21-07-2011 / 09:44:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
109 |
! ! |
|
110 |
||
111 |
!ReportRunner class methodsFor:'startup'! |
|
112 |
||
113 |
setupToolsForDebug |
|
114 |
||
115 |
super setupToolsForDebug. |
|
116 |
debugging := true. |
|
117 |
||
118 |
"Created: / 06-11-2011 / 22:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
77 | 119 |
! |
120 |
||
121 |
usage |
|
122 |
||
123 |
Stderr nextPutAll:'usage: report-runner.'; |
|
124 |
nextPutAll: (OperatingSystem isMSWINDOWSlike ifTrue:['bat'] ifFalse:['sh']); |
|
125 |
nextPutAll: ' [-D <dir>] -r <report> [-p <package1> [-p <package2> [...]]]'; cr. |
|
126 |
||
127 |
Stderr nextPutLine:' --help .................. output this message'. |
|
128 |
Stderr nextPutLine:' --verbose ............... verbose startup'. |
|
129 |
Stderr nextPutLine:' --noBanner .............. no splash screen'. |
|
130 |
Stderr nextPutLine:' --newAppInstance ........ start as its own application process (do not reuse a running instance)'. |
|
131 |
self allowScriptingOption ifTrue:[ |
|
132 |
Stderr nextPutLine:' --scripting portNr ...... enable scripting via port (or stdin/stdOut, if 0)'. |
|
133 |
]. |
|
134 |
self allowDebugOption ifTrue:[ |
|
135 |
Stderr nextPutLine:' --debug ................. enable Debugger'. |
|
136 |
]. |
|
137 |
||
138 |
"/ ' ......................... ' |
|
139 |
Stderr nextPutLine:' -D <dir>'. |
|
140 |
Stderr nextPutLine:' --output-directory=<dir> directory where report files will go'. |
|
141 |
Stderr nextPutLine:' -r <report class>'. |
|
142 |
Stderr nextPutLine:' --report=<report class> . report to run. available reports:'. |
|
143 |
Report available do:[:report| |
|
144 |
Stderr nextPutAll:' '; nextPutLine: report name |
|
145 |
]. |
|
146 |
Stderr nextPutLine:' -p <package>'. |
|
147 |
Stderr nextPutLine:' --package=<package> ..... package to run report on'. |
|
148 |
Stderr nextPutLine:' May be specified multiple times.'. |
|
149 |
||
150 |
" |
|
151 |
self usage |
|
152 |
" |
|
153 |
||
154 |
"Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
72 | 155 |
! ! |
156 |
||
157 |
!ReportRunner class methodsFor:'startup-to be redefined'! |
|
158 |
||
102
a63aa44303e3
changed: #main: - support for not-officially-supported VM options
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
159 |
main:argv |
143 | 160 |
"Process command line arguments" |
102
a63aa44303e3
changed: #main: - support for not-officially-supported VM options
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
161 |
|
72 | 162 |
parser := CmdLineParser new. |
163 |
[ |
|
143 | 164 |
parser parse: argv for: self. |
165 |
] on:CmdLineOptionError do:[:ex| |
|
72 | 166 |
Stderr nextPutLine:'Error when processing options: ', ex description. |
92 | 167 |
debugging ifFalse:[ |
168 |
ex suspendedContext fullPrintAllOn: Stderr. |
|
72 | 169 |
Stderr nextPutLine:'Exiting'. |
170 |
Smalltalk exit:1. |
|
171 |
] ifTrue:[ |
|
172 |
ex pass |
|
173 |
] |
|
174 |
]. |
|
175 |
||
176 |
[ |
|
177 |
report run. |
|
178 |
debugging ifFalse:[ |
|
179 |
Smalltalk exit:0. |
|
180 |
]. |
|
181 |
] on: Error do:[:ex| |
|
182 |
Stderr nextPutAll:'Error when running tests: '. |
|
183 |
Stderr nextPutAll:ex description; cr. |
|
184 |
ex suspendedContext printAllOn:Stderr. |
|
185 |
debugging ifFalse:[ |
|
186 |
Smalltalk exit:1. |
|
187 |
] ifTrue:[ |
|
188 |
ex pass |
|
189 |
] |
|
190 |
] |
|
191 |
||
102
a63aa44303e3
changed: #main: - support for not-officially-supported VM options
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
192 |
"Modified: / 13-11-2012 / 09:40:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
72 | 193 |
! ! |
194 |
||
195 |
!ReportRunner class methodsFor:'documentation'! |
|
196 |
||
197 |
version |
|
198 |
^ '$Header$' |
|
199 |
! |
|
200 |
||
201 |
version_CVS |
|
202 |
^ '$Header$' |
|
203 |
! |
|
204 |
||
205 |
version_SVN |
|
206 |
^ '§Id: Builder__ReportRunner.st 289 2011-11-10 15:39:10Z vranyj1 §' |
|
207 |
! ! |
|
208 |
||
143 | 209 |
|
72 | 210 |
ReportRunner initialize! |