選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

MultiProjTestBuildProgressMonitor.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /********************************************************************
  2. * Copyright (c) 2007 Contributors. All rights reserved.
  3. * This program and the accompanying materials are made available
  4. * under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution and is available at
  6. * http://eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: IBM Corporation - initial API and implementation
  9. * Helen Hawkins - initial version (bug 148190)
  10. *******************************************************************/
  11. package org.aspectj.systemtest.incremental.tools;
  12. import java.util.ArrayList;
  13. import java.util.List;
  14. import org.aspectj.ajde.core.IBuildProgressMonitor;
  15. /**
  16. * IBuildProgressMonitor that records how many files were compiled and woven as well as whether or not the build was a full build.
  17. * Will print progress information to the screen if VERBOSE is true.
  18. */
  19. public class MultiProjTestBuildProgressMonitor implements IBuildProgressMonitor {
  20. public boolean VERBOSE = false;
  21. private List<String> compiledFiles = new ArrayList<String>();
  22. private List<String> wovenClasses = new ArrayList<String>();
  23. private long starttime = 0;
  24. private long totaltimetaken = 0;
  25. private boolean wasFullBuild = true;
  26. public void finish(boolean wasFullBuild) {
  27. log("IBuildProgressMonitor.finish(" + wasFullBuild + ")");
  28. this.wasFullBuild = wasFullBuild;
  29. totaltimetaken = (System.currentTimeMillis() - starttime);
  30. }
  31. public boolean isCancelRequested() {
  32. log("IBuildProgressMonitor.isCancelRequested()");
  33. return false;
  34. }
  35. public void setProgress(double percentDone) {
  36. log("IBuildProgressMonitor.setProgress(" + percentDone + ")");
  37. }
  38. public void setProgressText(String text) {
  39. log("BuildProgressMonitor.setProgressText(" + text + ")");
  40. if (text.startsWith("compiled: ")) {
  41. compiledFiles.add(text.substring(10));
  42. } else if (text.startsWith("woven class ")) {
  43. wovenClasses.add(text.substring(12));
  44. } else if (text.startsWith("woven aspect ")) {
  45. wovenClasses.add(text.substring(13));
  46. }
  47. }
  48. public void begin() {
  49. starttime = System.currentTimeMillis();
  50. log("IBuildProgressMonitor.start()");
  51. }
  52. public List<String> getCompiledFiles() {
  53. return compiledFiles;
  54. }
  55. public List<String> getWovenClasses() {
  56. return wovenClasses;
  57. }
  58. public void log(String s) {
  59. if (VERBOSE) {
  60. System.out.println(s);
  61. }
  62. }
  63. public long getTimeTaken() {
  64. return totaltimetaken;
  65. }
  66. public boolean wasFullBuild() {
  67. return wasFullBuild;
  68. }
  69. public void reset() {
  70. wasFullBuild = true;
  71. compiledFiles.clear();
  72. wovenClasses.clear();
  73. }
  74. }