reports/Builder__ReportRunner.st
changeset 232 3c3f5f58ddeb
parent 230 9e0098682d8c
child 238 c5047b0ed211
equal deleted inserted replaced
231:9551cb7cfe38 232:3c3f5f58ddeb
   273 
   273 
   274     Stderr nextPutAll:'usage: report-runner.';
   274     Stderr nextPutAll:'usage: report-runner.';
   275            nextPutAll: (OperatingSystem isMSWINDOWSlike ifTrue:['bat'] ifFalse:['sh']);
   275            nextPutAll: (OperatingSystem isMSWINDOWSlike ifTrue:['bat'] ifFalse:['sh']);
   276            nextPutAll: ' [-D <dir>] -r <report> [-p <package1> [-p <package2> [...]]]'; cr.
   276            nextPutAll: ' [-D <dir>] -r <report> [-p <package1> [-p <package2> [...]]]'; cr.
   277 
   277 
       
   278     Stderr nextPutLine:'Common options:'; cr.
       
   279 
   278     Stderr nextPutLine:'  --help .................. output this message'.
   280     Stderr nextPutLine:'  --help .................. output this message'.
   279     Stderr nextPutLine:'  --verbose ............... verbose startup'.
   281 "/    Stderr nextPutLine:'  --verbose ............... verbose startup'.
   280     Stderr nextPutLine:'  --noBanner .............. no splash screen'.
   282 "/    Stderr nextPutLine:'  --noBanner .............. no splash screen'.
   281     Stderr nextPutLine:'  --newAppInstance ........ start as its own application process (do not reuse'.
   283 "/    Stderr nextPutLine:'  --newAppInstance ........ start as its own application process (do not reuse'.
   282     Stderr nextPutLine:'                            a running instance)'.
   284 "/    Stderr nextPutLine:'                            a running instance)'.
   283     self allowScriptingOption ifTrue:[
   285 "/    self allowScriptingOption ifTrue:[
   284         Stderr nextPutLine:'  --scripting portNr ...enable scripting via port (or stdin/stdOut if 0)'.
   286 "/        Stderr nextPutLine:'  --scripting portNr ...enable scripting via port (or stdin/stdOut if 0)'.
   285     ].
   287 "/    ].
   286     self allowDebugOption ifTrue:[
   288     self allowDebugOption ifTrue:[
   287         Stderr nextPutLine:'  --debug ................. enable Debugger'.
   289         Stderr nextPutLine:'  --debug ................. enable Debugger'.
   288     ].
   290     ].
   289 
       
   290     "/                 '  ......................... '
   291     "/                 '  ......................... '
   291     Stderr nextPutLine:'  -D <dir>'.
   292     Stderr nextPutLine:'  -D <dir>'.
   292     Stderr nextPutLine:'  --output-directory=<dir>  directory where report files will go'.
   293     Stderr nextPutLine:'  --output-directory=<dir>  directory where report files will go'.
   293     Stderr nextPutLine:'  -S <expr>'.
   294     Stderr nextPutLine:'  -S <expr>'.
   294     Stderr nextPutLine:'  --setup=<expr> .......... smalltalk expression that is evaluated before'. 
   295     Stderr nextPutLine:'  --setup=<expr> .......... smalltalk expression that is evaluated before'. 
   305         Stderr nextPutAll:'      '; nextPutLine: report name
   306         Stderr nextPutAll:'      '; nextPutLine: report name
   306     ].
   307     ].
   307     Stderr nextPutLine:'  -p <package>'.
   308     Stderr nextPutLine:'  -p <package>'.
   308     Stderr nextPutLine:'  --package=<package> ..... package to run report on'.
   309     Stderr nextPutLine:'  --package=<package> ..... package to run report on'.
   309     Stderr nextPutLine:'                            May be specified multiple times.'.
   310     Stderr nextPutLine:'                            May be specified multiple times.'.
   310     debugging ifTrue:[
   311 
       
   312     Report available do:[:cls|
       
   313         self usageForReportClass: cls.
       
   314     ].
       
   315 
       
   316 
       
   317     debugging ifFalse:[
   311         Smalltalk exit:1.
   318         Smalltalk exit:1.
       
   319     ].
       
   320     "
       
   321     self usage
       
   322     "
       
   323 
       
   324     "Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   325     "Modified: / 27-05-2014 / 17:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   326 !
       
   327 
       
   328 usageForReportClass: class
       
   329     | options |
       
   330 
       
   331     "/ '.........................' size  25
       
   332     options := CmdLineOption optionsFor: class new.
       
   333     options := options reject:[:option | 'pF' includes: option short  ].
       
   334     options notEmptyOrNil ifTrue:[
       
   335         Stderr cr.
       
   336         Stderr nextPutAll: class name; nextPutLine:' options:'; cr.
       
   337         options do:[:option |                
       
   338             | optlen |  
       
   339 
       
   340             Stderr nextPutAll: '  '.
       
   341             option short notNil ifTrue:[ 
       
   342                 Stderr nextPut: $-; nextPut: option short; space.
       
   343                 optlen := 2.
       
   344                 option hasParam ifTrue:[ 
       
   345                     | paramName |
       
   346 
       
   347                     paramName := 'val'.
       
   348                     Stderr nextPut:$<; nextPutAll: paramName; nextPut:$>; space.
       
   349                     optlen := optlen + 3 + paramName size.
       
   350                 ].
       
   351             ].
       
   352             option long notNil ifTrue:[ 
       
   353                  option short notNil ifTrue:[ 
       
   354                     Stderr cr.
       
   355                 ].
       
   356                 Stderr nextPutAll: '  --'.
       
   357                 Stderr nextPutAll: option long.
       
   358                 optlen := option long size + 2.
       
   359                 option hasParam ifTrue:[ 
       
   360                     | paramName |
       
   361 
       
   362                     paramName := 'val'.
       
   363                     Stderr nextPut:$=; nextPut:$<; nextPutAll: paramName; nextPut:$>.
       
   364                     optlen := optlen + 3 + paramName size.
       
   365                 ].
       
   366                 Stderr space.
       
   367             ].
       
   368             Stderr next: (26 - 1"space" -2"--" - optlen) put: $..    
       
   369             Stderr space.
       
   370             option description notNil ifTrue:[
       
   371                 Stderr nextPutAll: option description
       
   372             ].
       
   373             Stderr cr.
       
   374         ]
   312     ]
   375     ]
   313     "
   376 
   314     self usage
   377     "Created: / 27-05-2014 / 16:42:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   315     "
       
   316 
       
   317     "Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   318     "Modified: / 22-01-2014 / 09:58:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   319 ! !
   378 ! !
   320 
   379 
   321 !ReportRunner class methodsFor:'startup-to be redefined'!
   380 !ReportRunner class methodsFor:'startup-to be redefined'!
   322 
   381 
   323 main:argv0
   382 main:argv0
   324     "Process command line arguments"
   383     "Process command line arguments"
   325 
   384 
   326     | argv |
   385     | argv |
   327 
   386 
   328     argv := argv0 asOrderedCollection.
   387     argv := argv0 asOrderedCollection.
       
   388     argv isEmpty ifTrue:[ 
       
   389         self usage.
       
   390     ].
   329     argv remove: '--abortOnSEGV' ifAbsent:[nil].
   391     argv remove: '--abortOnSEGV' ifAbsent:[nil].
   330     parser := CmdLineParser new.
   392     parser := CmdLineParser new.
   331     CmdLineOptionError autoload.
   393     CmdLineOptionError autoload.
   332 
   394 
   333     [
   395     [
   369         ] ifTrue:[
   431         ] ifTrue:[
   370             ex pass
   432             ex pass
   371         ]
   433         ]
   372     ]
   434     ]
   373 
   435 
   374     "Modified: / 12-02-2014 / 15:13:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   436     "Modified: / 27-05-2014 / 17:05:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   375 ! !
   437 ! !
   376 
   438 
   377 !ReportRunner class methodsFor:'documentation'!
   439 !ReportRunner class methodsFor:'documentation'!
   378 
   440 
   379 version
   441 version