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;
|
|
53 |
long: '--report';
|
|
54 |
description: 'Report to run';
|
|
55 |
action:[:option |
|
|
56 |
report := Smalltalk at: option asSymbol.
|
|
57 |
report isNil ifTrue:[
|
|
58 |
Stderr nextPutLine:('ERROR: Report class %1 does not exist (forgot to load package)' bindWith: option).
|
|
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>"
|
|
66 |
! !
|
|
67 |
|
|
68 |
!ReportRunner class methodsFor:'defaults'!
|
|
69 |
|
77
|
70 |
allowCoverageMeasurementOption
|
|
71 |
|
|
72 |
^false "CoverageReport will do that"
|
|
73 |
|
|
74 |
"Created: / 13-01-2012 / 11:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
75 |
!
|
|
76 |
|
72
|
77 |
allowDebugOption
|
|
78 |
|
|
79 |
^true
|
|
80 |
|
|
81 |
"Created: / 21-07-2011 / 09:48:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
82 |
! !
|
|
83 |
|
|
84 |
!ReportRunner class methodsFor:'multiple applications support'!
|
|
85 |
|
|
86 |
applicationRegistryPath
|
|
87 |
"the key under which this application stores its process ID in the registry
|
|
88 |
as a collection of path-components.
|
|
89 |
i.e. if #('foo' 'bar' 'baz') is returned here, the current applications ID will be stored
|
|
90 |
in HKEY_CURRENT_USER\Software\foo\bar\baz\CurrentID.
|
|
91 |
(would also be used as a relative path for a temporary lock file under unix).
|
|
92 |
Used to detect if another instance of this application is already running."
|
|
93 |
|
|
94 |
^ #('exept' 'smalltallx' 'hdreportrunner')
|
|
95 |
|
|
96 |
"Modified: / 21-07-2011 / 09:43:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
97 |
!
|
|
98 |
|
|
99 |
applicationUUID
|
|
100 |
"answer an application-specific unique uuid.
|
|
101 |
This is used as the name of some exclusive OS-resource, which is used to find out,
|
|
102 |
if another instance of this application is already running.
|
|
103 |
Under win32, a mutex is used; under unix, an exclusive file in the tempDir could be used."
|
|
104 |
|
|
105 |
^ '99f65c80-b375-11e0-86ad-0013e89c0459' asUUID
|
|
106 |
|
|
107 |
"Modified: / 21-07-2011 / 09:44:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
108 |
! !
|
|
109 |
|
|
110 |
!ReportRunner class methodsFor:'startup'!
|
|
111 |
|
|
112 |
setupToolsForDebug
|
|
113 |
|
|
114 |
super setupToolsForDebug.
|
|
115 |
debugging := true.
|
|
116 |
|
|
117 |
"Created: / 06-11-2011 / 22:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
77
|
118 |
!
|
|
119 |
|
|
120 |
usage
|
|
121 |
|
|
122 |
Stderr nextPutAll:'usage: report-runner.';
|
|
123 |
nextPutAll: (OperatingSystem isMSWINDOWSlike ifTrue:['bat'] ifFalse:['sh']);
|
|
124 |
nextPutAll: ' [-D <dir>] -r <report> [-p <package1> [-p <package2> [...]]]'; cr.
|
|
125 |
|
|
126 |
Stderr nextPutLine:' --help .................. output this message'.
|
|
127 |
Stderr nextPutLine:' --verbose ............... verbose startup'.
|
|
128 |
Stderr nextPutLine:' --noBanner .............. no splash screen'.
|
|
129 |
Stderr nextPutLine:' --newAppInstance ........ start as its own application process (do not reuse a running instance)'.
|
|
130 |
self allowScriptingOption ifTrue:[
|
|
131 |
Stderr nextPutLine:' --scripting portNr ...... enable scripting via port (or stdin/stdOut, if 0)'.
|
|
132 |
].
|
|
133 |
self allowDebugOption ifTrue:[
|
|
134 |
Stderr nextPutLine:' --debug ................. enable Debugger'.
|
|
135 |
].
|
|
136 |
|
|
137 |
"/ ' ......................... '
|
|
138 |
Stderr nextPutLine:' -D <dir>'.
|
|
139 |
Stderr nextPutLine:' --output-directory=<dir> directory where report files will go'.
|
|
140 |
Stderr nextPutLine:' -r <report class>'.
|
|
141 |
Stderr nextPutLine:' --report=<report class> . report to run. available reports:'.
|
|
142 |
Report available do:[:report|
|
|
143 |
Stderr nextPutAll:' '; nextPutLine: report name
|
|
144 |
].
|
|
145 |
Stderr nextPutLine:' -p <package>'.
|
|
146 |
Stderr nextPutLine:' --package=<package> ..... package to run report on'.
|
|
147 |
Stderr nextPutLine:' May be specified multiple times.'.
|
|
148 |
|
|
149 |
"
|
|
150 |
self usage
|
|
151 |
"
|
|
152 |
|
|
153 |
"Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
72
|
154 |
! !
|
|
155 |
|
|
156 |
!ReportRunner class methodsFor:'startup-to be redefined'!
|
|
157 |
|
|
158 |
main:argv
|
|
159 |
|
|
160 |
"Process command line arguments"
|
|
161 |
parser := CmdLineParser new.
|
|
162 |
[
|
|
163 |
parser parse: argv for: self.
|
|
164 |
] on: Error do:[:ex|
|
|
165 |
Stderr nextPutLine:'Error when processing options: ', ex description.
|
|
166 |
debugging ifFalse:[
|
|
167 |
Stderr nextPutLine:'Exiting'.
|
|
168 |
Smalltalk exit:1.
|
|
169 |
] ifTrue:[
|
|
170 |
ex pass
|
|
171 |
]
|
|
172 |
].
|
|
173 |
|
|
174 |
[
|
|
175 |
report run.
|
|
176 |
debugging ifFalse:[
|
|
177 |
Smalltalk exit:0.
|
|
178 |
].
|
|
179 |
] on: Error do:[:ex|
|
|
180 |
Stderr nextPutAll:'Error when running tests: '.
|
|
181 |
Stderr nextPutAll:ex description; cr.
|
|
182 |
ex suspendedContext printAllOn:Stderr.
|
|
183 |
debugging ifFalse:[
|
|
184 |
Smalltalk exit:1.
|
|
185 |
] ifTrue:[
|
|
186 |
ex pass
|
|
187 |
]
|
|
188 |
]
|
|
189 |
|
|
190 |
"Modified: / 07-11-2011 / 09:26:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
191 |
! !
|
|
192 |
|
|
193 |
!ReportRunner class methodsFor:'documentation'!
|
|
194 |
|
|
195 |
version
|
|
196 |
^ '$Header$'
|
|
197 |
!
|
|
198 |
|
|
199 |
version_CVS
|
|
200 |
^ '$Header$'
|
|
201 |
!
|
|
202 |
|
|
203 |
version_SVN
|
|
204 |
^ '§Id: Builder__ReportRunner.st 289 2011-11-10 15:39:10Z vranyj1 §'
|
|
205 |
! !
|
|
206 |
|
|
207 |
ReportRunner initialize!
|