| 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 | | | package org.jcoderz.phoenix.report; |
| 34 | | | |
| 35 | | | import java.io.File; |
| 36 | | | import java.io.FileOutputStream; |
| 37 | | | import java.io.IOException; |
| 38 | | | import java.nio.charset.Charset; |
| 39 | | | import java.util.ArrayList; |
| 40 | | | import java.util.Collections; |
| 41 | | | import java.util.HashSet; |
| 42 | | | import java.util.Iterator; |
| 43 | | | import java.util.List; |
| 44 | | | import java.util.Set; |
| 45 | | | import java.util.concurrent.ArrayBlockingQueue; |
| 46 | | | import java.util.concurrent.Callable; |
| 47 | | | import java.util.concurrent.CompletionService; |
| 48 | | | import java.util.concurrent.ExecutionException; |
| 49 | | | import java.util.concurrent.ExecutorCompletionService; |
| 50 | | | import java.util.concurrent.Future; |
| 51 | | | import java.util.concurrent.ThreadPoolExecutor; |
| 52 | | | import java.util.concurrent.TimeUnit; |
| 53 | | | import java.util.logging.Level; |
| 54 | | | |
| 55 | | | import javax.xml.bind.JAXBException; |
| 56 | | | import javax.xml.transform.TransformerException; |
| 57 | | | |
| 58 | | | import org.apache.tools.ant.BuildException; |
| 59 | | | import org.apache.tools.ant.Project; |
| 60 | | | import org.apache.tools.ant.Task; |
| 61 | | | import org.apache.tools.ant.taskdefs.Execute; |
| 62 | | | import org.apache.tools.ant.taskdefs.LogStreamHandler; |
| 63 | | | import org.apache.tools.ant.taskdefs.PumpStreamHandler; |
| 64 | | | import org.apache.tools.ant.types.CommandlineJava; |
| 65 | | | import org.apache.tools.ant.types.Path; |
| 66 | | | import org.apache.tools.ant.types.Environment.Variable; |
| 67 | | | import org.jcoderz.commons.taskdefs.AntTaskUtil; |
| 68 | | | import org.jcoderz.commons.types.Date; |
| 69 | | | import org.jcoderz.commons.util.ArraysUtil; |
| 70 | | | import org.jcoderz.commons.util.FileUtils; |
| 71 | | | import org.jcoderz.commons.util.StringUtil; |
| 72 | | | |
| 73 | | | |
| 74 | | | |
| 75 | | | |
| 76 | | | |
| 77 | | | |
| 78 | | (1) | |
| 79 | | | |
| 80 | | | @author |
| 81 | | | |
| 82 | 0 | | public class JcReportAntTask |
| 83 | | | extends Task |
| 84 | | | { |
| 85 | | | private static final int DEFAULT_MAX_HEAP = 256; |
| 86 | 0 | | private static final Date CREATION_TIMESTAMP = Date.now(); |
| 87 | | | private static final int DEFAULT_CPUS = 2; |
| 88 | | | |
| 89 | 0 | | private NestedReportsElement mReports = null; |
| 90 | 0 | (2) | private NestedMappingsElement mMappings = null; |
| 91 | 0 | | private NestedToolsElement mTools = null; |
| 92 | 0 | | private final NestedFiltersElement mFilterElements |
| 93 | | | = new NestedFiltersElement(); |
| 94 | 0 | | private NestedLogfilesElement mLogfilesElements |
| 95 | | | = new NestedLogfilesElement(); |
| 96 | | | |
| 97 | 0 | | private String mName = null; |
| 98 | 0 | | private File mDest = null; |
| 99 | 0 | | private File mOldReportFile = null; |
| 100 | 0 | | private String mWikiBase = null; |
| 101 | 0 | | private String mWebRcsBase = null; |
| 102 | 0 | | private String mWebRcsSuffix = null; |
| 103 | 0 | | private String mPackageBase = null; |
| 104 | 0 | | private String mProjectBase = null; |
| 105 | 0 | | private String mStylesheet = null; |
| 106 | 0 | | private File mTempfolder = null; |
| 107 | 0 | | private int mMaxHeap = DEFAULT_MAX_HEAP; |
| 108 | 0 | | private int mCpus = DEFAULT_CPUS; |
| 109 | 0 | | private Charset mSourceEncoding = null; |
| 110 | 0 | | private boolean mDebug = false; |
| 111 | | | |
| 112 | 0 | | private File mWorkingDir = null; |
| 113 | | | |
| 114 | | | |
| 115 | 0 | | private final CommandlineJava mCommandline = new CommandlineJava(); |
| 116 | | | private int mMaxInner; |
| 117 | | | |
| 118 | | | |
| 119 | | | @return |
| 120 | | | |
| 121 | | | public int getCpus () |
| 122 | | | { |
| 123 | 0 | | return mCpus; |
| 124 | | | } |
| 125 | | | |
| 126 | | | |
| 127 | | | @param |
| 128 | | | |
| 129 | | | public void setCpus (int cpus) |
| 130 | | | { |
| 131 | 0 | | mCpus = cpus; |
| 132 | 0 | | } |
| 133 | | | |
| 134 | | | |
| 135 | | | @return |
| 136 | | | |
| 137 | | | public String getEncoding () |
| 138 | | | { |
| 139 | 0 | | return mSourceEncoding.name(); |
| 140 | | | } |
| 141 | | | |
| 142 | | | |
| 143 | | | @param |
| 144 | | | |
| 145 | | | public void setEncoding (String encoding) |
| 146 | | | { |
| 147 | 0 | | mSourceEncoding = Charset.forName(encoding); |
| 148 | 0 | | } |
| 149 | | | |
| 150 | | | |
| 151 | | | |
| 152 | | | |
| 153 | | | @return |
| 154 | | | |
| 155 | | | public File getWorkingDir () |
| 156 | | | { |
| 157 | 0 | | return mWorkingDir; |
| 158 | | | } |
| 159 | | | |
| 160 | | | |
| 161 | | | |
| 162 | | | |
| 163 | | | |
| 164 | | | @param |
| 165 | | | |
| 166 | | | public void setMaxHeap (String maxheap) |
| 167 | | | { |
| 168 | 0 | (3) | mMaxHeap = Integer.parseInt(maxheap); |
| 169 | 0 | | } |
| 170 | | | |
| 171 | | | |
| 172 | | | |
| 173 | | | |
| 174 | | (4) | |
| 175 | | | @param |
| 176 | | | |
| 177 | | | public void setName (String name) |
| 178 | | (5) | { |
| 179 | 0 | | mName = name; |
| 180 | 0 | | } |
| 181 | | | |
| 182 | | | |
| 183 | | | |
| 184 | | | |
| 185 | | | |
| 186 | | | @param |
| 187 | | | |
| 188 | | | public void setDest (String dest) |
| 189 | | | { |
| 190 | 0 | | mDest = new File(dest); |
| 191 | 0 | | AntTaskUtil.ensureDirectory(mDest); |
| 192 | 0 | | } |
| 193 | | | |
| 194 | | | |
| 195 | | (6) | public void setPackageBase (String packageBase) |
| 196 | | | { |
| 197 | 0 | | mPackageBase = packageBase; |
| 198 | 0 | | } |
| 199 | | | |
| 200 | | | |
| 201 | | (7) | public void setProjectBase (String projectBase) |
| 202 | | | { |
| 203 | 0 | | mProjectBase = projectBase; |
| 204 | 0 | | } |
| 205 | | | |
| 206 | | | |
| 207 | | (8) | public void setWebRcsBase (String webRcsBase) |
| 208 | | | { |
| 209 | 0 | | mWebRcsBase = webRcsBase; |
| 210 | 0 | | } |
| 211 | | | |
| 212 | | | |
| 213 | | (9) | public void setWebRcsSuffix (String webRcsSuffix) |
| 214 | | | { |
| 215 | 0 | | mWebRcsSuffix = webRcsSuffix; |
| 216 | 0 | | } |
| 217 | | | |
| 218 | | | |
| 219 | | (10) | public void setWikiBase (String wikiBase) |
| 220 | | | { |
| 221 | 0 | | mWikiBase = wikiBase; |
| 222 | 0 | | } |
| 223 | | | |
| 224 | | (11) | public void setOldReportFile (String oldReportFile) |
| 225 | | | { |
| 226 | 0 | | mOldReportFile = new File(oldReportFile); |
| 227 | 0 | | } |
| 228 | | | |
| 229 | | | |
| 230 | | | |
| 231 | | | |
| 232 | | | @param |
| 233 | | | |
| 234 | | | public void setStylesheet (String stylesheet) |
| 235 | | | { |
| 236 | 0 | | mStylesheet = stylesheet; |
| 237 | 0 | | } |
| 238 | | | |
| 239 | | | |
| 240 | | | |
| 241 | | | |
| 242 | | | |
| 243 | | | @param |
| 244 | | | |
| 245 | | | public void setTempfolder (String tempfolder) |
| 246 | | | { |
| 247 | 0 | | mTempfolder = new File(tempfolder); |
| 248 | 0 | | } |
| 249 | | | |
| 250 | | | |
| 251 | | | |
| 252 | | | |
| 253 | | | |
| 254 | | | @param |
| 255 | | | |
| 256 | | | public void setDebug (Boolean debug) |
| 257 | | | { |
| 258 | 0 | | mDebug = debug.booleanValue(); |
| 259 | 0 | | } |
| 260 | | | |
| 261 | | | |
| 262 | | (12) | public Path createClasspath () |
| 263 | | | { |
| 264 | 0 | | return mCommandline.createClasspath(getProject()).createPath(); |
| 265 | | | } |
| 266 | | | |
| 267 | | | |
| 268 | | | |
| 269 | | | |
| 270 | | | |
| 271 | | | @throws |
| 272 | | | |
| 273 | | | public void execute () |
| 274 | | | throws BuildException |
| 275 | | | { |
| 276 | | | try |
| 277 | | | { |
| 278 | | | |
| 279 | 0 | | super.log("Executing JcReportAntTask..."); |
| 280 | | | |
| 281 | 0 | | checkParameters(); |
| 282 | | | |
| 283 | | | |
| 284 | | | |
| 285 | 0 | | if (mDest.exists()) |
| 286 | | | { |
| 287 | 0 | | FileUtils.rmdir(mDest); |
| 288 | 0 | | AntTaskUtil.ensureDirectory(mDest); |
| 289 | | | } |
| 290 | | | |
| 291 | | | |
| 292 | 0 | | log("Processing reports..."); |
| 293 | | | |
| 294 | 0 | | final int max |
| 295 | | | = Math.min(mCpus + 1 , mReports.getReports().size()); |
| 296 | 0 | | mMaxInner = 1 + (mCpus / max); |
| 297 | 0 | | super.log("Decided to have " + max + " report types with " |
| 298 | | | + mMaxInner + " reports each in parallel."); |
| 299 | 0 | | final CompletionService<File> service |
| 300 | | | = new ExecutorCompletionService<File>( |
| 301 | | | new ThreadPoolExecutor(max, max, 0, TimeUnit.SECONDS, |
| 302 | | | new ArrayBlockingQueue<Runnable>( |
| 303 | | | mReports.getReports().size()))); |
| 304 | | | |
| 305 | 0 | | final List<Future<File>> jcReports = new ArrayList<Future<File>>(); |
| 306 | 0 | | final Iterator<NestedReportElement> iterReport |
| 307 | | | = mReports.getReports().iterator(); |
| 308 | 0 | | while (iterReport.hasNext()) |
| 309 | | | { |
| 310 | 0 | | final NestedReportElement nre = iterReport.next(); |
| 311 | 0 | | log("Processing report '" + nre.getName() + "' ..."); |
| 312 | 0 | | final Future<File> jcReport = service.submit( |
| 313 | | | new Callable<File> () |
| 314 | 0 | | { |
| 315 | | | public File call () |
| 316 | | | throws InterruptedException, ExecutionException, |
| 317 | | | IOException, JAXBException, TransformerException |
| 318 | | | { |
| 319 | | | final File result; |
| 320 | 0 | | log("Starting: " + nre.getName() |
| 321 | | | + " for " + nre.getSourcePath() + "."); |
| 322 | 0 | | result = performNestedReport(nre); |
| 323 | 0 | | log("Done: " + nre.getName() |
| 324 | | | + " got " + nre.getSourcePath() + "."); |
| 325 | 0 | | return result; |
| 326 | | | } |
| 327 | | | } |
| 328 | | | ); |
| 329 | 0 | | jcReports.add(jcReport); |
| 330 | 0 | | } |
| 331 | | | |
| 332 | 0 | | final File jcReport = executeReportMerger(jcReports); |
| 333 | 0 | | executeJava2Html(jcReport); |
| 334 | | | } |
| 335 | 0 | | catch (Exception ex) |
| 336 | | | { |
| 337 | 0 | (13) | log(ex.toString(), ex, Project.MSG_ERR); |
| 338 | 0 | | throw new BuildException("An unexpected exception occured!", ex); |
| 339 | 0 | | } |
| 340 | 0 | | } |
| 341 | | | |
| 342 | | | |
| 343 | | | private File performNestedReport (final NestedReportElement nre) |
| 344 | | | throws InterruptedException, ExecutionException, IOException, |
| 345 | | | JAXBException, TransformerException |
| 346 | | | { |
| 347 | | | |
| 348 | 0 | | final File reportTmpDir = new File(mWorkingDir, nre.getName()); |
| 349 | 0 | | AntTaskUtil.ensureDirectory(reportTmpDir); |
| 350 | 0 | | final File srcDir = new File(nre.getSourcePath()); |
| 351 | 0 | | final File clsDir = new File(nre.getClassPath()); |
| 352 | | | |
| 353 | 0 | | final CompletionService<File> service |
| 354 | | | = new ExecutorCompletionService<File>( |
| 355 | | | new ThreadPoolExecutor(mMaxInner, mMaxInner, 0, |
| 356 | | | TimeUnit.SECONDS, |
| 357 | | | new ArrayBlockingQueue<Runnable>(5))); |
| 358 | | | |
| 359 | | | |
| 360 | 0 | | File pmdXml = null; |
| 361 | 0 | | final Future<File> pmdResult |
| 362 | | | = submit(mTools.getPmd(), reportTmpDir, |
| 363 | | | srcDir, clsDir, service); |
| 364 | | | |
| 365 | 0 | | File checkstyleXml = null; |
| 366 | 0 | | final Future<File> checkstyleResult |
| 367 | | | = submit(mTools.getCheckstyle(), reportTmpDir, |
| 368 | | | srcDir, clsDir, service); |
| 369 | | | |
| 370 | 0 | | File findbugsXml = null; |
| 371 | 0 | | final Future<File> findbugsResult |
| 372 | | | = submit(mTools.getFindbugs(), reportTmpDir, |
| 373 | | | srcDir, clsDir, service); |
| 374 | | | |
| 375 | 0 | | File cpdXml = null; |
| 376 | 0 | | final Future<File> cpdResult |
| 377 | | | = submit(mTools.getCpd(), reportTmpDir, |
| 378 | | | srcDir, clsDir, service); |
| 379 | | | |
| 380 | 0 | | File coberturaXml = null; |
| 381 | 0 | | final Future<File> coberturaResult |
| 382 | | | = submit(mTools.getCobertura(), reportTmpDir, |
| 383 | | | srcDir, clsDir, service); |
| 384 | | | |
| 385 | | | |
| 386 | 0 | | if (checkstyleResult != null) |
| 387 | | | { |
| 388 | 0 | | checkstyleXml = checkstyleResult.get(); |
| 389 | | | } |
| 390 | 0 | | if (findbugsResult != null) |
| 391 | | | { |
| 392 | 0 | | findbugsXml = findbugsResult.get(); |
| 393 | | | } |
| 394 | 0 | | if (pmdResult != null) |
| 395 | | | { |
| 396 | 0 | | pmdXml = pmdResult.get(); |
| 397 | | | } |
| 398 | 0 | | if (cpdResult != null) |
| 399 | | | { |
| 400 | 0 | | cpdXml = cpdResult.get(); |
| 401 | | | } |
| 402 | 0 | | if (coberturaResult != null) |
| 403 | | | { |
| 404 | 0 | | coberturaXml = coberturaResult.get(); |
| 405 | | | } |
| 406 | | | |
| 407 | | | final File emmaFile; |
| 408 | 0 | | if (mTools.getEmma() != null) |
| 409 | | | { |
| 410 | 0 | | emmaFile = new File(mTools.getEmma().mDatafile); |
| 411 | | | } |
| 412 | | | else |
| 413 | | | { |
| 414 | 0 | | emmaFile = null; |
| 415 | | | } |
| 416 | | | |
| 417 | | | |
| 418 | | | |
| 419 | 0 | | return executeReportNormalizer(srcDir, reportTmpDir, |
| 420 | | | nre.getLevel(), checkstyleXml, findbugsXml, pmdXml, |
| 421 | | | cpdXml, coberturaXml, emmaFile); |
| 422 | | | } |
| 423 | | | |
| 424 | | | |
| 425 | | | private Future<File> submit (final NestedToolElement nce, |
| 426 | | | final File reportTmpDir, final File srcDir, final File clsDir, |
| 427 | | | CompletionService<File> service) |
| 428 | | | { |
| 429 | 0 | | Future<File> result = null; |
| 430 | 0 | | if (nce != null) |
| 431 | | | { |
| 432 | 0 | | result = service.submit( |
| 433 | | | new Callable<File> () |
| 434 | 0 | | { |
| 435 | | | public File call () |
| 436 | | | { |
| 437 | | | final File result; |
| 438 | 0 | | log("Starting: " + nce.toString() + " for " + srcDir |
| 439 | | | + "."); |
| 440 | 0 | | result = nce.execute(reportTmpDir, srcDir, clsDir); |
| 441 | 0 | | log("Done: " + nce.toString() + " got " + result + "."); |
| 442 | 0 | | return result; |
| 443 | | | } |
| 444 | | | } |
| 445 | | | ); |
| 446 | | | } |
| 447 | 0 | | return result; |
| 448 | | | } |
| 449 | | | |
| 450 | | | |
| 451 | | | private void checkParameters () |
| 452 | | | { |
| 453 | 0 | | if (mTempfolder == null) |
| 454 | | | { |
| 455 | 0 | | throw new BuildException("You must specify a temporary folder!", |
| 456 | | | getLocation()); |
| 457 | | | } |
| 458 | 0 | | AntTaskUtil.ensureDirectory(mTempfolder); |
| 459 | 0 | | mWorkingDir = new File(mTempfolder, mName); |
| 460 | 0 | | AntTaskUtil.ensureDirectory(mWorkingDir); |
| 461 | | | |
| 462 | | | |
| 463 | 0 | | final Set<String> reportNames = new HashSet<String>(); |
| 464 | 0 | | final Iterator<NestedReportElement> iterReport |
| 465 | | | = mReports.getReports().iterator(); |
| 466 | 0 | | while (iterReport.hasNext()) |
| 467 | | | { |
| 468 | 0 | | final NestedReportElement nre = iterReport.next(); |
| 469 | 0 | | reportNames.add(nre.getName()); |
| 470 | 0 | | } |
| 471 | 0 | | if (reportNames.size() != mReports.getReports().size()) |
| 472 | | | { |
| 473 | 0 | | throw new BuildException("Reports must not have the same names!", |
| 474 | | | getLocation()); |
| 475 | | | } |
| 476 | 0 | | } |
| 477 | | | |
| 478 | | | |
| 479 | | | |
| 480 | | | |
| 481 | | | |
| 482 | | | |
| 483 | | | <ul> |
| 484 | | | <li><code></code> |
| 485 | | | </li> |
| 486 | | | <li><code></code> |
| 487 | | | </li> |
| 488 | | | <li><code></code> |
| 489 | | | </li> |
| 490 | | | <li><code></code> |
| 491 | | | </li> |
| 492 | | | <li><code></code> |
| 493 | | | </li> |
| 494 | | | <li><code></code></li> |
| 495 | | | <li><code></code></li> |
| 496 | | | <li><code></code></li> |
| 497 | | | <li><code></code></li> |
| 498 | | | <li><code></code></li> |
| 499 | | | </ul> |
| 500 | | | |
| 501 | | | private File executeReportNormalizer (File srcDir, File reportDir, |
| 502 | | | ReportLevel level, File checkstyleXml, |
| 503 | | | File findbugsXml, File pmdXml, File cpdXml, File coberturaXml, |
| 504 | | | File emmaSummary) |
| 505 | | | throws IOException, JAXBException, TransformerException |
| 506 | | | { |
| 507 | | | |
| 508 | 0 | | log("Creating report normalizer command line..."); |
| 509 | 0 | | final CommandlineJava cmd = createCommandlineJava(mCommandline, mMaxHeap); |
| 510 | | | |
| 511 | 0 | | cmd.setClassname("org.jcoderz.phoenix.report.ReportNormalizer"); |
| 512 | | | |
| 513 | 0 | | cmd.createArgument().setValue("-srcDir"); |
| 514 | 0 | | cmd.createArgument().setFile(srcDir); |
| 515 | | | |
| 516 | 0 | | cmd.createArgument().setValue("-level"); |
| 517 | 0 | | cmd.createArgument().setValue(level.toString()); |
| 518 | | | |
| 519 | 0 | | if (mDebug) |
| 520 | | | { |
| 521 | 0 | | cmd.createArgument().setValue("-loglevel"); |
| 522 | 0 | | cmd.createArgument().setValue("FINEST"); |
| 523 | | | } |
| 524 | | | |
| 525 | 0 | | cmd.createArgument().setValue("-projectName"); |
| 526 | 0 | | cmd.createArgument().setValue(mName); |
| 527 | | | |
| 528 | 0 | | cmd.createArgument().setValue("-out"); |
| 529 | 0 | | cmd.createArgument().setFile(reportDir); |
| 530 | | | |
| 531 | 0 | | if (checkstyleXml != null) |
| 532 | | | { |
| 533 | 0 | | cmd.createArgument().setValue("-checkstyle"); |
| 534 | 0 | | cmd.createArgument().setFile(checkstyleXml); |
| 535 | | | } |
| 536 | | | |
| 537 | 0 | | if (findbugsXml != null) |
| 538 | | | { |
| 539 | 0 | | cmd.createArgument().setValue("-findbugs"); |
| 540 | 0 | | cmd.createArgument().setFile(findbugsXml); |
| 541 | | | } |
| 542 | | | |
| 543 | 0 | | if (pmdXml != null) |
| 544 | | | { |
| 545 | 0 | | cmd.createArgument().setValue("-pmd"); |
| 546 | 0 | | cmd.createArgument().setFile(pmdXml); |
| 547 | | | } |
| 548 | | | |
| 549 | 0 | | if (cpdXml != null) |
| 550 | | | { |
| 551 | 0 | | cmd.createArgument().setValue("-cpd"); |
| 552 | 0 | | cmd.createArgument().setFile(cpdXml); |
| 553 | | | } |
| 554 | | | |
| 555 | 0 | | if (coberturaXml != null) |
| 556 | | | { |
| 557 | 0 | | cmd.createArgument().setValue("-cobertura"); |
| 558 | 0 | | cmd.createArgument().setFile(coberturaXml); |
| 559 | | | } |
| 560 | | | |
| 561 | 0 | | if (emmaSummary != null) |
| 562 | | | { |
| 563 | 0 | | cmd.createArgument().setValue("-emma"); |
| 564 | 0 | | cmd.createArgument().setFile(emmaSummary); |
| 565 | | | } |
| 566 | | | |
| 567 | 0 | | for (NestedLogfileElement nge : mLogfilesElements.mGenericReaders) |
| 568 | | | { |
| 569 | 0 | | cmd.createArgument().setValue("-generic"); |
| 570 | 0 | | cmd.createArgument().setFile(nge.getFile()); |
| 571 | 0 | | cmd.createArgument().setValue(nge.getType()); |
| 572 | | | } |
| 573 | | | |
| 574 | 0 | | forkToolProcess(this, cmd, new LogStreamHandler(this, Project.MSG_INFO, |
| 575 | | | Project.MSG_WARN)); |
| 576 | | | |
| 577 | 0 | | return new File(reportDir, ReportNormalizer.JCODERZ_REPORT_XML); |
| 578 | | | } |
| 579 | | | |
| 580 | | | |
| 581 | | | private File executeReportMerger (List<Future<File>> jcReports) |
| 582 | | | throws InterruptedException, ExecutionException, IOException, |
| 583 | | | JAXBException, TransformerException |
| 584 | | | { |
| 585 | 0 | | log("Preparing report merger..."); |
| 586 | 0 | | final ReportMerger merger = new ReportMerger(); |
| 587 | 0 | | if (mDebug) |
| 588 | | | { |
| 589 | 0 | | merger.setLogLevel(Level.ALL); |
| 590 | | | } |
| 591 | 0 | | merger.setOutFile(mWorkingDir); |
| 592 | 0 | | final Iterator<Future<File>> jcReportIter = jcReports.iterator(); |
| 593 | 0 | | while (jcReportIter.hasNext()) |
| 594 | | | { |
| 595 | 0 | | final File jcReport = jcReportIter.next().get(); |
| 596 | 0 | | merger.addReport(jcReport); |
| 597 | 0 | | } |
| 598 | 0 | | final Iterator<NestedFilterElement> filterIter |
| 599 | | | = mFilterElements.getFilters().iterator(); |
| 600 | 0 | | while (filterIter.hasNext()) |
| 601 | | | { |
| 602 | 0 | | final NestedFilterElement filterElement = filterIter.next(); |
| 603 | 0 | | merger.addFilter(filterElement.getFile()); |
| 604 | 0 | | } |
| 605 | 0 | | merger.merge(); |
| 606 | 0 | | merger.filter(); |
| 607 | 0 | | if (mOldReportFile != null) |
| 608 | | | { |
| 609 | 0 | | merger.setOldFile(mOldReportFile); |
| 610 | 0 | | merger.flagNewFindings(); |
| 611 | | | } |
| 612 | | | |
| 613 | 0 | | final File outFile = new File(mWorkingDir, |
| 614 | | | ReportNormalizer.JCODERZ_REPORT_XML); |
| 615 | | | try |
| 616 | | | { |
| 617 | 0 | | FileUtils.copy(outFile, mDest); |
| 618 | | | } |
| 619 | 0 | | catch (IOException e) |
| 620 | | | { |
| 621 | 0 | | throw new BuildException("Could not copy '" + outFile |
| 622 | | | + "' to destination folder '" + mDest + "'!", e, getLocation()); |
| 623 | 0 | | } |
| 624 | | | |
| 625 | 0 | | return outFile; |
| 626 | | | } |
| 627 | | | |
| 628 | | | |
| 629 | | | |
| 630 | | | |
| 631 | | | |
| 632 | | | |
| 633 | | | <pre> |
| 634 | | | |
| 635 | | | |
| 636 | | | |
| 637 | | | |
| 638 | | | |
| 639 | | | |
| 640 | | | |
| 641 | | | |
| 642 | | | |
| 643 | | | </pre> |
| 644 | | | |
| 645 | | | private void executeJava2Html (File jcReport) |
| 646 | | | { |
| 647 | 0 | | log("Creating java2html command line..."); |
| 648 | | | |
| 649 | 0 | | final CommandlineJava cmd = createCommandlineJava(mCommandline, mMaxHeap); |
| 650 | | | |
| 651 | 0 | | cmd.setClassname("org.jcoderz.phoenix.report.Java2Html"); |
| 652 | | | |
| 653 | | | |
| 654 | 0 | | cmd.createVmArgument().setValue("-Djava.awt.headless=true"); |
| 655 | | | |
| 656 | 0 | | cmd.createArgument().setValue("-outDir"); |
| 657 | 0 | | cmd.createArgument().setFile(mDest); |
| 658 | | | |
| 659 | 0 | | cmd.createArgument().setValue("-report"); |
| 660 | 0 | | cmd.createArgument().setFile(jcReport); |
| 661 | | | |
| 662 | 0 | | cmd.createArgument().setValue("-timestamp"); |
| 663 | 0 | | cmd.createArgument().setValue(CREATION_TIMESTAMP.toString( |
| 664 | | | "yyyyMMddHHmmss")); |
| 665 | | | |
| 666 | 0 | | if (mProjectBase != null) |
| 667 | | | { |
| 668 | 0 | | cmd.createArgument().setValue("-projectHome"); |
| 669 | 0 | | cmd.createArgument().setValue(mProjectBase); |
| 670 | | | } |
| 671 | | | |
| 672 | 0 | | if (mStylesheet != null) |
| 673 | | | { |
| 674 | 0 | | cmd.createArgument().setValue("-reportStyle"); |
| 675 | 0 | | cmd.createArgument().setValue(mStylesheet); |
| 676 | | | } |
| 677 | | | |
| 678 | 0 | | cmd.createArgument().setValue("-projectName"); |
| 679 | 0 | | cmd.createArgument().setValue(mName); |
| 680 | | | |
| 681 | 0 | | cmd.createArgument().setValue("-cvsBase"); |
| 682 | 0 | | cmd.createArgument().setValue(mWebRcsBase); |
| 683 | | | |
| 684 | 0 | | if (!StringUtil.isNullOrBlank(mWebRcsSuffix)) |
| 685 | | | { |
| 686 | 0 | | cmd.createArgument().setValue("-cvsSuffix"); |
| 687 | 0 | | cmd.createArgument().setValue(mWebRcsSuffix); |
| 688 | | | } |
| 689 | | | |
| 690 | 0 | | cmd.createArgument().setValue("-wikiBase"); |
| 691 | 0 | | cmd.createArgument().setValue(mWikiBase); |
| 692 | | | |
| 693 | 0 | | if (mPackageBase != null) |
| 694 | | | { |
| 695 | 0 | | cmd.createArgument().setValue("-packageBase"); |
| 696 | 0 | | cmd.createArgument().setValue(mPackageBase); |
| 697 | | | } |
| 698 | | | |
| 699 | 0 | | if (mSourceEncoding != null) |
| 700 | | | { |
| 701 | 0 | | cmd.createArgument().setValue("-sourceEncoding"); |
| 702 | 0 | | cmd.createArgument().setValue(getEncoding()); |
| 703 | | | } |
| 704 | 0 | | if (mDebug) |
| 705 | | | { |
| 706 | 0 | | cmd.createArgument().setValue("-loglevel"); |
| 707 | 0 | | cmd.createArgument().setValue("FINEST"); |
| 708 | | | } |
| 709 | | | |
| 710 | 0 | | forkToolProcess(this, cmd, new LogStreamHandler(this, Project.MSG_INFO, |
| 711 | | | Project.MSG_WARN)); |
| 712 | 0 | | } |
| 713 | | | |
| 714 | | | |
| 715 | | | |
| 716 | | | |
| 717 | | | |
| 718 | | | |
| 719 | | | |
| 720 | | | |
| 721 | | | |
| 722 | | | |
| 723 | | | |
| 724 | | | @return |
| 725 | | | |
| 726 | | | public NestedReportsElement createReports () |
| 727 | | | { |
| 728 | 0 | | mReports = new NestedReportsElement(this); |
| 729 | 0 | | return mReports; |
| 730 | | | } |
| 731 | | | |
| 732 | | | |
| 733 | | | public static class NestedReportsElement |
| 734 | | | { |
| 735 | 0 | | private List<NestedReportElement> mReports |
| 736 | | | = new ArrayList<NestedReportElement>(); |
| 737 | | | private JcReportAntTask mTask; |
| 738 | | | |
| 739 | | | public NestedReportsElement (JcReportAntTask task) |
| 740 | 0 | | { |
| 741 | 0 | | mTask = task; |
| 742 | 0 | | } |
| 743 | | | |
| 744 | | | |
| 745 | | | public NestedReportElement createReport () |
| 746 | | | { |
| 747 | 0 | | mTask.log("Creating report element..."); |
| 748 | 0 | | final NestedReportElement nre = new NestedReportElement(); |
| 749 | 0 | | mReports.add(nre); |
| 750 | 0 | | return nre; |
| 751 | | | } |
| 752 | | | |
| 753 | | | |
| 754 | | | public List<NestedReportElement> getReports () |
| 755 | | | { |
| 756 | 0 | | return Collections.unmodifiableList(mReports); |
| 757 | | | } |
| 758 | | | } |
| 759 | | | |
| 760 | | | |
| 761 | | | |
| 762 | | | |
| 763 | | | <code></code> |
| 764 | | | |
| 765 | | | @author |
| 766 | | | |
| 767 | 0 | | public static class NestedReportElement |
| 768 | | | { |
| 769 | | | private String mName; |
| 770 | | | private ReportLevel mLevel; |
| 771 | | | private String mSourcePath; |
| 772 | | | private String mClassPath; |
| 773 | | | |
| 774 | | | public String getName () |
| 775 | | | { |
| 776 | 0 | | return mName; |
| 777 | | | } |
| 778 | | | |
| 779 | | | |
| 780 | | | public void setName (String name) |
| 781 | | | { |
| 782 | 0 | | mName = name; |
| 783 | 0 | | } |
| 784 | | | |
| 785 | | | public ReportLevel getLevel () |
| 786 | | | { |
| 787 | 0 | | return mLevel; |
| 788 | | | } |
| 789 | | | |
| 790 | | | |
| 791 | | | public void setLevel (String level) |
| 792 | | | { |
| 793 | 0 | | mLevel = ReportLevel.fromString(level); |
| 794 | 0 | | } |
| 795 | | | |
| 796 | | | |
| 797 | | | public String getClassPath () |
| 798 | | | { |
| 799 | 0 | | return mClassPath; |
| 800 | | | } |
| 801 | | | |
| 802 | | | |
| 803 | | | public void setClassPath (String classPath) |
| 804 | | | { |
| 805 | 0 | | mClassPath = classPath; |
| 806 | 0 | | } |
| 807 | | | |
| 808 | | | |
| 809 | | | public String getSourcePath () |
| 810 | | | { |
| 811 | 0 | | return mSourcePath; |
| 812 | | | } |
| 813 | | | |
| 814 | | | |
| 815 | | | public void setSourcePath (String sourcePath) |
| 816 | | | { |
| 817 | 0 | | mSourcePath = sourcePath; |
| 818 | 0 | | } |
| 819 | | | } |
| 820 | | | |
| 821 | | | |
| 822 | | | |
| 823 | | | |
| 824 | | | |
| 825 | | | |
| 826 | | | |
| 827 | | | |
| 828 | | | |
| 829 | | | |
| 830 | | | |
| 831 | | | @return |
| 832 | | | |
| 833 | | | public NestedMappingsElement createMappings () |
| 834 | | | { |
| 835 | 0 | | mMappings = new NestedMappingsElement(this); |
| 836 | 0 | | return mMappings; |
| 837 | | | } |
| 838 | | | |
| 839 | | | |
| 840 | | | public static class NestedMappingsElement |
| 841 | | | { |
| 842 | 0 | | private List<NestedMappingElement> mMappings |
| 843 | | | = new ArrayList<NestedMappingElement>(); |
| 844 | | | private JcReportAntTask mTask; |
| 845 | | | |
| 846 | | | public NestedMappingsElement (JcReportAntTask task) |
| 847 | 0 | | { |
| 848 | 0 | | mTask = task; |
| 849 | 0 | | } |
| 850 | | | |
| 851 | | | public NestedMappingElement createWebRcs () |
| 852 | | | { |
| 853 | 0 | | mTask.log("Creating mapping element..."); |
| 854 | 0 | | final NestedMappingElement nme = new NestedMappingElement(); |
| 855 | 0 | | mMappings.add(nme); |
| 856 | 0 | | return nme; |
| 857 | | | } |
| 858 | | | |
| 859 | | | public List<NestedMappingElement> getMappings () |
| 860 | | | { |
| 861 | 0 | | return mMappings; |
| 862 | | | } |
| 863 | | | } |
| 864 | | | |
| 865 | | | |
| 866 | 0 | | public static class NestedMappingElement |
| 867 | | | { |
| 868 | | | private String mPattern; |
| 869 | | | private String mUrl; |
| 870 | | | private String mSuffix; |
| 871 | | | |
| 872 | | | |
| 873 | | | public String getPattern () |
| 874 | | | { |
| 875 | 0 | | return mPattern; |
| 876 | | | } |
| 877 | | | |
| 878 | | | |
| 879 | | | public void setPattern (String pattern) |
| 880 | | | { |
| 881 | 0 | | mPattern = pattern; |
| 882 | 0 | | } |
| 883 | | | |
| 884 | | | |
| 885 | | | public String getSuffix () |
| 886 | | | { |
| 887 | 0 | | return mSuffix; |
| 888 | | | } |
| 889 | | | |
| 890 | | | |
| 891 | | | public void setSuffix (String suffix) |
| 892 | | | { |
| 893 | 0 | | mSuffix = suffix; |
| 894 | 0 | | } |
| 895 | | | |
| 896 | | | |
| 897 | | | public String getUrl () |
| 898 | | | { |
| 899 | 0 | | return mUrl; |
| 900 | | | } |
| 901 | | | |
| 902 | | | |
| 903 | | | public void setUrl (String url) |
| 904 | | | { |
| 905 | 0 | | mUrl = url; |
| 906 | 0 | | } |
| 907 | | | } |
| 908 | | | |
| 909 | | | |
| 910 | | | |
| 911 | | | |
| 912 | | | |
| 913 | | | |
| 914 | | | |
| 915 | | | |
| 916 | | | |
| 917 | | | |
| 918 | | | |
| 919 | | | @return |
| 920 | | | |
| 921 | | | public NestedToolsElement createTools () |
| 922 | | | { |
| 923 | 0 | | mTools = new NestedToolsElement(this); |
| 924 | 0 | | return mTools; |
| 925 | | | } |
| 926 | | | |
| 927 | | | |
| 928 | | | public static class NestedToolsElement |
| 929 | | | { |
| 930 | | | private JcReportAntTask mTask; |
| 931 | 0 | | private NestedPmdElement mPmd = null; |
| 932 | 0 | | private NestedCpdElement mCpd = null; |
| 933 | 0 | | private NestedFindbugsElement mFindbugs = null; |
| 934 | 0 | | private NestedCheckstyleElement mCheckstyle = null; |
| 935 | 0 | | private NestedCoberturaElement mCobertura = null; |
| 936 | 0 | | private NestedEmmaElement mEmma = null; |
| 937 | | | |
| 938 | | | public NestedToolsElement (JcReportAntTask task) |
| 939 | 0 | | { |
| 940 | 0 | | mTask = task; |
| 941 | 0 | | } |
| 942 | | | |
| 943 | | | |
| 944 | | | public NestedPmdElement createPmd () |
| 945 | | | { |
| 946 | 0 | | mTask.log("Creating Pmd element..."); |
| 947 | 0 | | mPmd = new NestedPmdElement(mTask); |
| 948 | 0 | | return mPmd; |
| 949 | | | } |
| 950 | | | |
| 951 | | | |
| 952 | | | public NestedPmdElement getPmd () |
| 953 | | | { |
| 954 | 0 | | return mPmd; |
| 955 | | | } |
| 956 | | | |
| 957 | | | |
| 958 | | | public NestedCpdElement createCpd () |
| 959 | | | { |
| 960 | 0 | | mTask.log("Creating Cpd element..."); |
| 961 | 0 | | mCpd = new NestedCpdElement(mTask); |
| 962 | 0 | | return mCpd; |
| 963 | | | } |
| 964 | | | |
| 965 | | | |
| 966 | | | public NestedCpdElement getCpd () |
| 967 | | | { |
| 968 | 0 | | return mCpd; |
| 969 | | | } |
| 970 | | | |
| 971 | | | |
| 972 | | | public NestedFindbugsElement createFindbugs () |
| 973 | | | { |
| 974 | 0 | | mTask.log("Creating Findbugs element..."); |
| 975 | 0 | | mFindbugs = new NestedFindbugsElement(mTask); |
| 976 | 0 | | return mFindbugs; |
| 977 | | | } |
| 978 | | | |
| 979 | | | |
| 980 | | | public NestedFindbugsElement getFindbugs () |
| 981 | | | { |
| 982 | 0 | | return mFindbugs; |
| 983 | | | } |
| 984 | | | |
| 985 | | | |
| 986 | | | public NestedCheckstyleElement createCheckstyle () |
| 987 | | | { |
| 988 | 0 | | mTask.log("Creating Checkstyle element..."); |
| 989 | 0 | | mCheckstyle = new NestedCheckstyleElement(mTask); |
| 990 | 0 | | return mCheckstyle; |
| 991 | | | } |
| 992 | | | |
| 993 | | | |
| 994 | | | public NestedCheckstyleElement getCheckstyle () |
| 995 | | | { |
| 996 | 0 | | return mCheckstyle; |
| 997 | | | } |
| 998 | | | |
| 999 | | | |
| 1000 | | | public NestedCoberturaElement createCobertura () |
| 1001 | | | { |
| 1002 | 0 | | mTask.log("Creating Cobertura element..."); |
| 1003 | 0 | | mCobertura = new NestedCoberturaElement(mTask); |
| 1004 | 0 | | return mCobertura; |
| 1005 | | | } |
| 1006 | | | |
| 1007 | | | |
| 1008 | | | public NestedCoberturaElement getCobertura () |
| 1009 | | | { |
| 1010 | 0 | | return mCobertura; |
| 1011 | | | } |
| 1012 | | | |
| 1013 | | | public NestedEmmaElement createEmma () |
| 1014 | | | { |
| 1015 | 0 | | mTask.log("Creating Emma element..."); |
| 1016 | 0 | | mEmma = new NestedEmmaElement(mTask); |
| 1017 | 0 | | return mEmma; |
| 1018 | | | } |
| 1019 | | | |
| 1020 | | | public NestedEmmaElement getEmma () |
| 1021 | | | { |
| 1022 | 0 | | return mEmma; |
| 1023 | | | } |
| 1024 | | | } |
| 1025 | | | |
| 1026 | | | |
| 1027 | | | |
| 1028 | | | |
| 1029 | | | |
| 1030 | | | |
| 1031 | | | |
| 1032 | | | @author |
| 1033 | | | |
| 1034 | | | public abstract static class NestedToolElement |
| 1035 | | | { |
| 1036 | | | protected JcReportAntTask mTask; |
| 1037 | | | protected Path mPath; |
| 1038 | | | protected int mMaxHeap; |
| 1039 | | | |
| 1040 | | | |
| 1041 | 0 | | protected final CommandlineJava mCommandline = new CommandlineJava(); |
| 1042 | | | |
| 1043 | | | public NestedToolElement (JcReportAntTask task) |
| 1044 | 0 | | { |
| 1045 | 0 | | mTask = task; |
| 1046 | 0 | | mMaxHeap = mTask.mMaxHeap; |
| 1047 | 0 | | } |
| 1048 | | | |
| 1049 | | | |
| 1050 | | | |
| 1051 | | | |
| 1052 | | | |
| 1053 | | | @param |
| 1054 | | | |
| 1055 | | | public void setMaxheap (String maxheap) |
| 1056 | | | { |
| 1057 | 0 | | mMaxHeap = Integer.parseInt(maxheap); |
| 1058 | 0 | | } |
| 1059 | | | |
| 1060 | | | |
| 1061 | | | |
| 1062 | | | |
| 1063 | | | |
| 1064 | | | @return |
| 1065 | | | |
| 1066 | | | public Path createClasspath () |
| 1067 | | | { |
| 1068 | 0 | | mPath = mCommandline.createClasspath(mTask.getProject()).createPath(); |
| 1069 | 0 | | return mPath; |
| 1070 | | | } |
| 1071 | | | |
| 1072 | | | public abstract File execute (File reportDir, File srcDir, File clsDir); |
| 1073 | | | } |
| 1074 | | | |
| 1075 | | | |
| 1076 | | | public static class NestedPmdElement |
| 1077 | | | extends NestedToolElement |
| 1078 | | | { |
| 1079 | | | private String mConfig; |
| 1080 | | | private String mTargetjdk; |
| 1081 | | | private String mEncoding; |
| 1082 | | | |
| 1083 | | | public NestedPmdElement (JcReportAntTask task) |
| 1084 | | | { |
| 1085 | 0 | | super(task); |
| 1086 | 0 | | mCommandline.setClassname("net.sourceforge.pmd.PMD"); |
| 1087 | 0 | | } |
| 1088 | | | |
| 1089 | | | |
| 1090 | | | public void setConfig (String config) |
| 1091 | | | { |
| 1092 | 0 | | mConfig = config; |
| 1093 | 0 | | } |
| 1094 | | | |
| 1095 | | | |
| 1096 | | | public void setTargetjdk (String targetjdk) |
| 1097 | | | { |
| 1098 | 0 | | mTargetjdk = targetjdk; |
| 1099 | 0 | | } |
| 1100 | | | |
| 1101 | | | |
| 1102 | | | public void setEncoding (String encoding) |
| 1103 | | | { |
| 1104 | 0 | | mEncoding = encoding; |
| 1105 | 0 | | } |
| 1106 | | | |
| 1107 | | | |
| 1108 | | | public File execute (File reportDir, File srcDir, File clsDir) |
| 1109 | | | { |
| 1110 | 0 | | mTask.log("Creating pmd command line..."); |
| 1111 | 0 | | final CommandlineJava cmd |
| 1112 | | | = createCommandlineJava(mCommandline, mMaxHeap); |
| 1113 | | | |
| 1114 | 0 | | cmd.createArgument().setFile(srcDir); |
| 1115 | | | |
| 1116 | | | |
| 1117 | 0 | | cmd.createArgument().setValue("xml"); |
| 1118 | | | |
| 1119 | 0 | | if (mConfig != null) |
| 1120 | | | { |
| 1121 | 0 | | cmd.createArgument().setFile(new File(mConfig)); |
| 1122 | | | } |
| 1123 | | | |
| 1124 | 0 | | if (mEncoding != null) |
| 1125 | | | { |
| 1126 | 0 | | cmd.createArgument().setValue("-encoding"); |
| 1127 | 0 | | cmd.createArgument().setValue(mEncoding); |
| 1128 | | | } |
| 1129 | 0 | | else if (mTask.getEncoding() != null) |
| 1130 | | | { |
| 1131 | 0 | | cmd.createArgument().setValue("-encoding"); |
| 1132 | 0 | | cmd.createArgument().setValue(mTask.getEncoding()); |
| 1133 | | | } |
| 1134 | | | |
| 1135 | 0 | | if (mTargetjdk != null) |
| 1136 | | | { |
| 1137 | 0 | | cmd.createArgument().setValue("-targetjdk"); |
| 1138 | 0 | | cmd.createArgument().setValue(mTargetjdk); |
| 1139 | | | } |
| 1140 | | | |
| 1141 | 0 | | final File outFile = new File(reportDir, "pmd.xml"); |
| 1142 | 0 | | FileOutputStream fos = null; |
| 1143 | | | try |
| 1144 | | | { |
| 1145 | 0 | | fos = new FileOutputStream(outFile); |
| 1146 | | | } |
| 1147 | 0 | | catch (IOException e) |
| 1148 | | | { |
| 1149 | 0 | | throw new BuildException("Could not find output file: " |
| 1150 | | | + outFile.getAbsolutePath(), e, mTask.getLocation()); |
| 1151 | 0 | | } |
| 1152 | | | |
| 1153 | 0 | | forkToolProcess(mTask, cmd, new PumpStreamHandler(fos, System.err)); |
| 1154 | | | |
| 1155 | 0 | | return outFile; |
| 1156 | | | } |
| 1157 | | | } |
| 1158 | | | |
| 1159 | | | |
| 1160 | | | public static class NestedCpdElement |
| 1161 | | | extends NestedToolElement |
| 1162 | | | { |
| 1163 | | | private static final int DEFAULT_MINIMUM_TOKENS = 100; |
| 1164 | 0 | | private int mMinimumtokens = DEFAULT_MINIMUM_TOKENS; |
| 1165 | 0 | | private String mEncoding = null; |
| 1166 | 0 | | private String mOutputEncoding = "UTF-8"; |
| 1167 | | | |
| 1168 | | | public NestedCpdElement (JcReportAntTask task) |
| 1169 | | | { |
| 1170 | 0 | | super(task); |
| 1171 | 0 | | mCommandline.setClassname("net.sourceforge.pmd.cpd.CPD"); |
| 1172 | 0 | | } |
| 1173 | | | |
| 1174 | | | public void setMinimumtokens (String minimumtokens) |
| 1175 | | | { |
| 1176 | 0 | | mMinimumtokens = Integer.parseInt(minimumtokens); |
| 1177 | 0 | | } |
| 1178 | | | |
| 1179 | | | public void setEncoding (String encoding) |
| 1180 | | | { |
| 1181 | 0 | | mEncoding = encoding; |
| 1182 | 0 | | } |
| 1183 | | | |
| 1184 | | | public void setOutputEncoding (String encoding) |
| 1185 | | | { |
| 1186 | 0 | | mOutputEncoding = encoding; |
| 1187 | 0 | | } |
| 1188 | | | |
| 1189 | | | |
| 1190 | | | |
| 1191 | | | |
| 1192 | | | |
| 1193 | | | <pre> |
| 1194 | | | |
| 1195 | | | </pre> |
| 1196 | | | |
| 1197 | | | public File execute (File reportDir, File srcDir, File clsDir) |
| 1198 | | | { |
| 1199 | 0 | | mTask.log("Creating cpd command line..."); |
| 1200 | 0 | | final CommandlineJava cmd |
| 1201 | | | = createCommandlineJava(mCommandline, mMaxHeap); |
| 1202 | | | |
| 1203 | 0 | | final Variable var = new Variable(); |
| 1204 | 0 | | var.setKey("file.encoding"); |
| 1205 | 0 | | var.setValue(mOutputEncoding); |
| 1206 | 0 | | cmd.getSystemProperties().addVariable(var); |
| 1207 | | | |
| 1208 | 0 | | cmd.createArgument().setFile(srcDir); |
| 1209 | | | |
| 1210 | | | |
| 1211 | 0 | | cmd.createArgument().setValue("--format"); |
| 1212 | 0 | | cmd.createArgument().setValue("net.sourceforge.pmd.cpd.XMLRenderer"); |
| 1213 | | | |
| 1214 | 0 | | if (mEncoding != null) |
| 1215 | | | { |
| 1216 | 0 | | cmd.createArgument().setValue("--encoding"); |
| 1217 | 0 | | cmd.createArgument().setValue(mEncoding); |
| 1218 | | | } |
| 1219 | 0 | | else if (mTask.getEncoding() != null) |
| 1220 | | | { |
| 1221 | 0 | | cmd.createArgument().setValue("--encoding"); |
| 1222 | 0 | | cmd.createArgument().setValue(mTask.getEncoding()); |
| 1223 | | | } |
| 1224 | | | |
| 1225 | | | |
| 1226 | 0 | | cmd.createArgument().setValue("--language"); |
| 1227 | 0 | | cmd.createArgument().setValue("java"); |
| 1228 | | | |
| 1229 | 0 | | cmd.createArgument().setValue("--files"); |
| 1230 | 0 | | cmd.createArgument().setFile(srcDir); |
| 1231 | | | |
| 1232 | 0 | | cmd.createArgument().setValue("--minimum-tokens"); |
| 1233 | 0 | | cmd.createArgument().setValue(String.valueOf(mMinimumtokens)); |
| 1234 | | | |
| 1235 | 0 | | final File outFile = new File(reportDir, "cpd.xml"); |
| 1236 | 0 | | FileOutputStream fos = null; |
| 1237 | | | try |
| 1238 | | | { |
| 1239 | 0 | | fos = new FileOutputStream(outFile); |
| 1240 | | | } |
| 1241 | 0 | | catch (IOException e) |
| 1242 | | | { |
| 1243 | 0 | | throw new BuildException("Could not find output file: " |
| 1244 | | | + outFile.getAbsolutePath(), e, mTask.getLocation()); |
| 1245 | 0 | | } |
| 1246 | | | |
| 1247 | 0 | | forkToolProcess(mTask, cmd, new PumpStreamHandler(fos, System.err)); |
| 1248 | | | |
| 1249 | 0 | | return outFile; |
| 1250 | | | } |
| 1251 | | | } |
| 1252 | | | |
| 1253 | | | |
| 1254 | | | public static class NestedFindbugsElement |
| 1255 | | | extends NestedToolElement |
| 1256 | | | { |
| 1257 | | | private String mConfig; |
| 1258 | 0 | | private String mWarninglevel = "medium"; |
| 1259 | 0 | | private String mEffort = "default"; |
| 1260 | 0 | | private String mOmitVisitors = ""; |
| 1261 | | | private Path mAuxPath; |
| 1262 | 0 | | private boolean mFindBugsDebug = false; |
| 1263 | | | |
| 1264 | | | |
| 1265 | | | |
| 1266 | | | |
| 1267 | | | private Path mPluginList; |
| 1268 | | | |
| 1269 | | | public NestedFindbugsElement (JcReportAntTask task) |
| 1270 | | | { |
| 1271 | 0 | | super(task); |
| 1272 | 0 | | mCommandline.setClassname("edu.umd.cs.findbugs.FindBugs2"); |
| 1273 | 0 | | } |
| 1274 | | | |
| 1275 | | | |
| 1276 | | | |
| 1277 | | | |
| 1278 | | | @param |
| 1279 | | | |
| 1280 | | | public void setDebug (Boolean debug) |
| 1281 | | | { |
| 1282 | 0 | | mFindBugsDebug = debug.booleanValue(); |
| 1283 | 0 | | } |
| 1284 | | | |
| 1285 | | | public void setOmitVisitors (String omitVisitors) |
| 1286 | | | { |
| 1287 | 0 | | mOmitVisitors = omitVisitors; |
| 1288 | 0 | | } |
| 1289 | | | |
| 1290 | | | public void setConfig (String config) |
| 1291 | | | { |
| 1292 | 0 | | mConfig = config; |
| 1293 | 0 | | } |
| 1294 | | | |
| 1295 | | | public void setEffort (String effort) |
| 1296 | | | { |
| 1297 | 0 | | if ("min".equals(effort) || "default".equals(effort) |
| 1298 | | | || "max".equals(effort)) |
| 1299 | | | { |
| 1300 | 0 | | mEffort = effort; |
| 1301 | | | } |
| 1302 | | | else |
| 1303 | | | { |
| 1304 | 0 | | mTask.log("Invalid effort value '" + effort + "!'"); |
| 1305 | | | } |
| 1306 | 0 | | } |
| 1307 | | | |
| 1308 | | | |
| 1309 | | | public void setWarninglevel (String warninglevel) |
| 1310 | | | { |
| 1311 | 0 | | if ("experimental".equals(warninglevel) || "low".equals(warninglevel) |
| 1312 | | | || "medium".equals(warninglevel) || "high".equals(warninglevel)) |
| 1313 | | | { |
| 1314 | 0 | | mWarninglevel = warninglevel; |
| 1315 | | | } |
| 1316 | | | else |
| 1317 | | | { |
| 1318 | 0 | | mTask.log("Invalid warninglevel value '" + warninglevel + "!'"); |
| 1319 | | | } |
| 1320 | 0 | | } |
| 1321 | | | |
| 1322 | | | |
| 1323 | | | |
| 1324 | | | |
| 1325 | | | |
| 1326 | | | |
| 1327 | | | @return |
| 1328 | | | |
| 1329 | | | public Path createPluginlist () |
| 1330 | | | { |
| 1331 | 0 | | mPluginList = new Path(mTask.getProject()); |
| 1332 | 0 | | return mPluginList; |
| 1333 | | | } |
| 1334 | | | |
| 1335 | | | |
| 1336 | | | |
| 1337 | | | |
| 1338 | | | |
| 1339 | | | @return |
| 1340 | | | |
| 1341 | | | public Path createAuxclasspath () |
| 1342 | | | { |
| 1343 | 0 | | mAuxPath = new Path(mTask.getProject()); |
| 1344 | 0 | | return mAuxPath; |
| 1345 | | | } |
| 1346 | | | |
| 1347 | | | |
| 1348 | | | |
| 1349 | | | |
| 1350 | | | <pre> |
| 1351 | | | |
| 1352 | | | |
| 1353 | | | |
| 1354 | | | |
| 1355 | | | |
| 1356 | | | |
| 1357 | | | |
| 1358 | | | |
| 1359 | | | |
| 1360 | | | |
| 1361 | | | |
| 1362 | | | |
| 1363 | | | |
| 1364 | | | |
| 1365 | | | |
| 1366 | | | |
| 1367 | | | |
| 1368 | | | |
| 1369 | | | |
| 1370 | | | |
| 1371 | | | |
| 1372 | | | |
| 1373 | | | |
| 1374 | | | |
| 1375 | | | |
| 1376 | | | |
| 1377 | | | </pre> |
| 1378 | | | |
| 1379 | | | |
| 1380 | | | |
| 1381 | | | |
| 1382 | | | public File execute (File reportDir, File srcDir, File clsDir) |
| 1383 | | | { |
| 1384 | 0 | | mTask.log("Creating findbugs command line..."); |
| 1385 | 0 | | final CommandlineJava cmd |
| 1386 | | | = createCommandlineJava(mCommandline, mMaxHeap); |
| 1387 | | | |
| 1388 | 0 | | if (mFindBugsDebug) |
| 1389 | | | { |
| 1390 | 0 | | cmd.createVmArgument().setValue("-Dfindbugs.debug=true"); |
| 1391 | | | } |
| 1392 | | | |
| 1393 | 0 | | if (mPluginList != null) |
| 1394 | | | { |
| 1395 | 0 | | cmd.createArgument().setValue("-pluginList"); |
| 1396 | 0 | | cmd.createArgument().setPath(mPluginList); |
| 1397 | | | } |
| 1398 | | | |
| 1399 | 0 | | if (!StringUtil.isEmptyOrNull(mOmitVisitors)) |
| 1400 | | | { |
| 1401 | 0 | | cmd.createArgument().setValue("-omitVisitors"); |
| 1402 | 0 | | cmd.createArgument().setValue(mOmitVisitors); |
| 1403 | | | } |
| 1404 | | | |
| 1405 | | | |
| 1406 | 0 | | final File outFile = new File(reportDir, "findbugs.xml"); |
| 1407 | 0 | | cmd.createArgument().setValue("-output"); |
| 1408 | 0 | | cmd.createArgument().setFile(outFile); |
| 1409 | | | |
| 1410 | 0 | | cmd.createArgument().setValue("-sourcepath"); |
| 1411 | 0 | | cmd.createArgument().setFile(srcDir); |
| 1412 | | | |
| 1413 | | | |
| 1414 | 0 | | cmd.createArgument().setValue("-xml:withMessages"); |
| 1415 | | | |
| 1416 | 0 | | if (mConfig != null) |
| 1417 | | | { |
| 1418 | 0 | | cmd.createArgument().setValue("-exclude"); |
| 1419 | 0 | | cmd.createArgument().setFile(new File(mConfig)); |
| 1420 | | | } |
| 1421 | | | |
| 1422 | 0 | | if (mAuxPath != null) |
| 1423 | | | { |
| 1424 | 0 | | cmd.createArgument().setValue("-auxclasspath"); |
| 1425 | 0 | | cmd.createArgument().setPath(mAuxPath); |
| 1426 | | | } |
| 1427 | | | |
| 1428 | 0 | | cmd.createArgument().setValue("-" + mWarninglevel); |
| 1429 | | | |
| 1430 | 0 | | cmd.createArgument().setValue("-effort:" + mEffort); |
| 1431 | | | |
| 1432 | 0 | | cmd.createArgument().setFile(clsDir); |
| 1433 | | | |
| 1434 | | (14) | |
| 1435 | 0 | | forkToolProcess(mTask, cmd, new LogStreamHandler(mTask, |
| 1436 | | | Project.MSG_INFO, Project.MSG_WARN)); |
| 1437 | | | |
| 1438 | 0 | | return outFile; |
| 1439 | | | } |
| 1440 | | | |
| 1441 | | | } |
| 1442 | | | |
| 1443 | | | |
| 1444 | | | public static class NestedCheckstyleElement |
| 1445 | | | extends NestedToolElement |
| 1446 | | | { |
| 1447 | | | private String mConfig; |
| 1448 | | | private String mProperties; |
| 1449 | | | |
| 1450 | | | public NestedCheckstyleElement (JcReportAntTask task) |
| 1451 | | | { |
| 1452 | 0 | | super(task); |
| 1453 | 0 | | mCommandline.setClassname("com.puppycrawl.tools.checkstyle.Main"); |
| 1454 | 0 | | } |
| 1455 | | | |
| 1456 | | | |
| 1457 | | | public void setConfig (String config) |
| 1458 | | | { |
| 1459 | 0 | | mConfig = config; |
| 1460 | 0 | | } |
| 1461 | | | |
| 1462 | | | |
| 1463 | | | public void setProperties (String properties) |
| 1464 | | | { |
| 1465 | 0 | | mProperties = properties; |
| 1466 | 0 | | } |
| 1467 | | | |
| 1468 | | | public String toString () |
| 1469 | | | { |
| 1470 | 0 | | return "Checkstyle"; |
| 1471 | | | } |
| 1472 | | | |
| 1473 | | | public File execute (File reportDir, File srcDir, File clsPath) |
| 1474 | | | { |
| 1475 | 0 | | mTask.log("Creating checkstyle command line..."); |
| 1476 | 0 | | final CommandlineJava cmd |
| 1477 | | | = createCommandlineJava(mCommandline, mMaxHeap); |
| 1478 | | | |
| 1479 | 0 | | cmd.createArgument().setValue("-o"); |
| 1480 | 0 | | final File outFile = new File(reportDir, "checkstyle.xml"); |
| 1481 | 0 | | cmd.createArgument().setFile(outFile); |
| 1482 | | | |
| 1483 | 0 | | if (mConfig == null) |
| 1484 | | | { |
| 1485 | 0 | (15) | throw new BuildException("The 'config' attribute is mandatory" |
| 1486 | | | + " for the checkstyle task!", mTask.getLocation()); |
| 1487 | | | } |
| 1488 | 0 | | cmd.createArgument().setValue("-c"); |
| 1489 | 0 | | cmd.createArgument().setFile(new File(mConfig)); |
| 1490 | | | |
| 1491 | | | |
| 1492 | 0 | | cmd.createArgument().setValue("-f"); |
| 1493 | 0 | | cmd.createArgument().setValue("xml"); |
| 1494 | | | |
| 1495 | 0 | | if (mProperties != null) |
| 1496 | | | { |
| 1497 | 0 | | cmd.createArgument().setValue("-p"); |
| 1498 | 0 | | cmd.createArgument().setFile(new File(mProperties)); |
| 1499 | | | } |
| 1500 | | | |
| 1501 | 0 | | cmd.createArgument().setValue("-r"); |
| 1502 | 0 | | cmd.createArgument().setFile(srcDir); |
| 1503 | | | |
| 1504 | 0 | | if (mTask.getEncoding() != null) |
| 1505 | | | { |
| 1506 | 0 | | final Variable var = new Variable(); |
| 1507 | 0 | | var.setKey("file.encoding"); |
| 1508 | 0 | | var.setValue(mTask.getEncoding()); |
| 1509 | 0 | | cmd.getSystemProperties().addVariable(var); |
| 1510 | | | } |
| 1511 | | | |
| 1512 | 0 | | forkToolProcess(mTask, cmd, new LogStreamHandler(mTask, |
| 1513 | | | Project.MSG_INFO, Project.MSG_WARN)); |
| 1514 | | | |
| 1515 | 0 | | return outFile; |
| 1516 | | | } |
| 1517 | | | } |
| 1518 | | | |
| 1519 | | | |
| 1520 | | | public static class NestedCoberturaElement |
| 1521 | | | extends NestedToolElement |
| 1522 | | | { |
| 1523 | | | private String mDatafile; |
| 1524 | | | |
| 1525 | | | public NestedCoberturaElement (JcReportAntTask task) |
| 1526 | | | { |
| 1527 | 0 | | super(task); |
| 1528 | 0 | | mCommandline.setClassname("net.sourceforge.cobertura.reporting.Main"); |
| 1529 | 0 | | } |
| 1530 | | | |
| 1531 | | | |
| 1532 | | | public void setDatafile (String datafile) |
| 1533 | | | { |
| 1534 | 0 | | mDatafile = datafile; |
| 1535 | 0 | | } |
| 1536 | | | |
| 1537 | | | |
| 1538 | | | |
| 1539 | | | |
| 1540 | | | |
| 1541 | | | <pre> |
| 1542 | | | |
| 1543 | | | |
| 1544 | | | |
| 1545 | | | </pre> |
| 1546 | | | |
| 1547 | | | public File execute (File reportDir, File srcDir, File clsPath) |
| 1548 | | | { |
| 1549 | 0 | | mTask.log("Creating cobertura command line..."); |
| 1550 | 0 | | final CommandlineJava cmd |
| 1551 | | | = createCommandlineJava(mCommandline, mMaxHeap); |
| 1552 | | | |
| 1553 | 0 | | File dataFile = null; |
| 1554 | 0 | | if (mDatafile == null) |
| 1555 | | | { |
| 1556 | 0 | (16) | throw new BuildException("The datafile attribute is mandatory!", |
| 1557 | | | mTask.getLocation()); |
| 1558 | | | } |
| 1559 | 0 | | dataFile = new File(mDatafile); |
| 1560 | 0 | | if (!dataFile.exists()) |
| 1561 | | | { |
| 1562 | 0 | | throw new BuildException( |
| 1563 | | | "The datafile '" + mDatafile + "' was not found!", |
| 1564 | | | mTask.getLocation()); |
| 1565 | | | } |
| 1566 | | | |
| 1567 | 0 | | cmd.createArgument().setValue("--destination"); |
| 1568 | 0 | | final File outFile = new File(reportDir, "coverage.xml"); |
| 1569 | 0 | | cmd.createArgument().setFile(reportDir); |
| 1570 | | | |
| 1571 | | | |
| 1572 | 0 | | cmd.createArgument().setValue("--format"); |
| 1573 | 0 | | cmd.createArgument().setValue("xml"); |
| 1574 | | | |
| 1575 | 0 | | cmd.createArgument().setValue("--datafile"); |
| 1576 | 0 | | cmd.createArgument().setFile(dataFile); |
| 1577 | | | |
| 1578 | 0 | | cmd.createArgument().setFile(srcDir); |
| 1579 | | | |
| 1580 | 0 | | forkToolProcess(mTask, cmd, new LogStreamHandler(mTask, |
| 1581 | | | Project.MSG_INFO, Project.MSG_WARN)); |
| 1582 | | | |
| 1583 | 0 | | return outFile; |
| 1584 | | | } |
| 1585 | | | } |
| 1586 | | | |
| 1587 | 0 | | public static class NestedEmmaElement |
| 1588 | | | extends NestedToolElement |
| 1589 | | | { |
| 1590 | | | private String mDatafile; |
| 1591 | | | |
| 1592 | | | public NestedEmmaElement (JcReportAntTask task) |
| 1593 | | | { |
| 1594 | 0 | | super(task); |
| 1595 | 0 | | } |
| 1596 | | | |
| 1597 | | | public void setDatafile (String datafile) |
| 1598 | | | { |
| 1599 | 0 | | mDatafile = datafile; |
| 1600 | 0 | | } |
| 1601 | | | |
| 1602 | | | |
| 1603 | | | |
| 1604 | | | |
| 1605 | | | public File execute (File reportDir, File srcDir, File clsPath) |
| 1606 | | | { |
| 1607 | 0 | | return new File(mDatafile); |
| 1608 | | | } |
| 1609 | | | } |
| 1610 | | | |
| 1611 | | | |
| 1612 | | | |
| 1613 | | | |
| 1614 | | | |
| 1615 | | | |
| 1616 | | | |
| 1617 | | | |
| 1618 | | | @return |
| 1619 | | | |
| 1620 | | | public NestedLogfilesElement createLogfiles () |
| 1621 | | | { |
| 1622 | 0 | | return mLogfilesElements; |
| 1623 | | | } |
| 1624 | | | |
| 1625 | | | |
| 1626 | 0 | | public static class NestedLogfilesElement |
| 1627 | | | { |
| 1628 | 0 | | private List<NestedLogfileElement> mGenericReaders |
| 1629 | | | = new ArrayList<NestedLogfileElement>(); |
| 1630 | | | |
| 1631 | | | |
| 1632 | | | public void addLogfile (NestedLogfileElement nge) |
| 1633 | | | { |
| 1634 | 0 | | mGenericReaders.add(nge); |
| 1635 | 0 | | } |
| 1636 | | | |
| 1637 | | | |
| 1638 | | | public List<NestedLogfileElement> getLogfile () |
| 1639 | | | { |
| 1640 | 0 | | return mGenericReaders; |
| 1641 | | | } |
| 1642 | | | } |
| 1643 | | | |
| 1644 | 0 | | public static class NestedLogfileElement |
| 1645 | | | { |
| 1646 | | | private String mType; |
| 1647 | | | private File mFile; |
| 1648 | | | |
| 1649 | | | public File getFile () |
| 1650 | | | { |
| 1651 | 0 | | return mFile; |
| 1652 | | | } |
| 1653 | | | |
| 1654 | | | public String getType () |
| 1655 | | | { |
| 1656 | 0 | | return mType; |
| 1657 | | | } |
| 1658 | | | |
| 1659 | | | public void setFile (File file) |
| 1660 | | | { |
| 1661 | 0 | | mFile = file; |
| 1662 | 0 | | } |
| 1663 | | | |
| 1664 | | | public void setType (String type) |
| 1665 | | | { |
| 1666 | 0 | | mType = type; |
| 1667 | 0 | | } |
| 1668 | | | } |
| 1669 | | | |
| 1670 | | | |
| 1671 | | | |
| 1672 | | | |
| 1673 | | | |
| 1674 | | | |
| 1675 | | | |
| 1676 | | | |
| 1677 | | | |
| 1678 | | | @return |
| 1679 | | | |
| 1680 | | | public NestedFiltersElement createFilters () |
| 1681 | | | { |
| 1682 | 0 | | return mFilterElements; |
| 1683 | | | } |
| 1684 | | | |
| 1685 | | | |
| 1686 | 0 | | public static class NestedFiltersElement |
| 1687 | | | { |
| 1688 | 0 | | private List<NestedFilterElement> mFilters |
| 1689 | | | = new ArrayList<NestedFilterElement>(); |
| 1690 | | | |
| 1691 | | | |
| 1692 | | | public void addFilter (NestedFilterElement nfe) |
| 1693 | | | { |
| 1694 | 0 | | mFilters.add(nfe); |
| 1695 | 0 | | } |
| 1696 | | | |
| 1697 | | | |
| 1698 | | | public List<NestedFilterElement> getFilters () |
| 1699 | | | { |
| 1700 | 0 | | return mFilters; |
| 1701 | | | } |
| 1702 | | | } |
| 1703 | | | |
| 1704 | | | |
| 1705 | 0 | | public static class NestedFilterElement |
| 1706 | | | { |
| 1707 | | | private File mFile; |
| 1708 | | | |
| 1709 | | | public File getFile () |
| 1710 | | | { |
| 1711 | 0 | | return mFile; |
| 1712 | | | } |
| 1713 | | | |
| 1714 | | | |
| 1715 | | | public void setFile (String file) |
| 1716 | | | { |
| 1717 | 0 | | mFile = new File(file); |
| 1718 | 0 | | } |
| 1719 | | | } |
| 1720 | | | |
| 1721 | | | |
| 1722 | | | |
| 1723 | | | |
| 1724 | | | |
| 1725 | | | |
| 1726 | | | |
| 1727 | | | |
| 1728 | | | |
| 1729 | | | |
| 1730 | | | |
| 1731 | | | @param |
| 1732 | | | @param |
| 1733 | | | @return |
| 1734 | | | |
| 1735 | | | private static CommandlineJava createCommandlineJava ( |
| 1736 | | | CommandlineJava cmdline, int maxHeap) |
| 1737 | | | { |
| 1738 | | | final CommandlineJava cmd; |
| 1739 | | | try |
| 1740 | | | { |
| 1741 | 0 | | cmd = (CommandlineJava) cmdline.clone(); |
| 1742 | | | } |
| 1743 | 0 | | catch (CloneNotSupportedException unexpected) |
| 1744 | | | { |
| 1745 | 0 | (17) | throw new RuntimeException( |
| 1746 | | | "Ups, CommandLineJava doesn't support the method clone()", |
| 1747 | | | unexpected); |
| 1748 | 0 | | } |
| 1749 | | | |
| 1750 | 0 | | cmd.createVmArgument().setValue("-Xmx" + maxHeap + "m"); |
| 1751 | 0 | | return cmd; |
| 1752 | | | } |
| 1753 | | | |
| 1754 | | | |
| 1755 | | | |
| 1756 | | | |
| 1757 | | | |
| 1758 | | | @param |
| 1759 | | | @param |
| 1760 | | | |
| 1761 | | | private static void forkToolProcess (JcReportAntTask task, |
| 1762 | | | CommandlineJava cmdline, PumpStreamHandler psh) |
| 1763 | | | { |
| 1764 | 0 | (18) | final Execute execute = new Execute(psh); |
| 1765 | 0 | | execute.setCommandline(cmdline.getCommandline()); |
| 1766 | | | |
| 1767 | | | try |
| 1768 | | | { |
| 1769 | 0 | | task.logCommandLine(cmdline.getCommandline()); |
| 1770 | 0 | | final int exitCode = execute.execute(); |
| 1771 | 0 | | if (exitCode != 0) |
| 1772 | | | { |
| 1773 | 0 | | task.log("Process returned with exit code: " + exitCode); |
| 1774 | | | } |
| 1775 | | | } |
| 1776 | 0 | | catch (IOException e) |
| 1777 | | | { |
| 1778 | 0 | | throw new BuildException( |
| 1779 | | | "Process fork failed. " |
| 1780 | | | + ArraysUtil.toString(cmdline.getCommandline()), e, |
| 1781 | | | task.getLocation()); |
| 1782 | 0 | | } |
| 1783 | 0 | | } |
| 1784 | | | |
| 1785 | | | |
| 1786 | | | |
| 1787 | | | |
| 1788 | | | |
| 1789 | | | |
| 1790 | | | @param |
| 1791 | | | |
| 1792 | | | private void logCommandLine (String[] cmdLine) |
| 1793 | | | { |
| 1794 | 0 | | log("Command line: "); |
| 1795 | 0 | | for (int i = 0; i < cmdLine.length; i++) |
| 1796 | | | { |
| 1797 | 0 | | log(" " + cmdLine[i]); |
| 1798 | | | } |
| 1799 | 0 | | } |
| 1800 | | | |
| 1801 | | | |
| 1802 | | | |
| 1803 | | | |
| 1804 | | | |
| 1805 | | | |
| 1806 | | | @param |
| 1807 | | | |
| 1808 | | | public void log (String msg) |
| 1809 | | | { |
| 1810 | 0 | | if (mDebug) |
| 1811 | | | { |
| 1812 | 0 | | super.log(msg); |
| 1813 | | | } |
| 1814 | 0 | | } |
| 1815 | | | } |