You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MultiProjTestBuildProgressMonitor.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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
  17. * woven as well as whether or not the build was a full build. Will print
  18. * progress information to the screen if VERBOSE is true.
  19. */
  20. public class MultiProjTestBuildProgressMonitor implements IBuildProgressMonitor {
  21. public boolean VERBOSE = false;
  22. private List compiledFiles=new ArrayList();
  23. private List wovenClasses=new ArrayList();
  24. private long starttime = 0;
  25. private long totaltimetaken = 0;
  26. private boolean wasFullBuild = true;
  27. public void finish(boolean wasFullBuild) {
  28. log("IBuildProgressMonitor.finish(" + wasFullBuild + ")");
  29. this.wasFullBuild = wasFullBuild;
  30. totaltimetaken=(System.currentTimeMillis()-starttime);
  31. }
  32. public boolean isCancelRequested() {
  33. log("IBuildProgressMonitor.isCancelRequested()");
  34. return false;
  35. }
  36. public void setProgress(double percentDone) {
  37. log("IBuildProgressMonitor.setProgress("+percentDone+")");
  38. }
  39. public void setProgressText(String text) {
  40. log("BuildProgressMonitor.setProgressText("+text+")");
  41. if (text.startsWith("compiled: ")) {
  42. compiledFiles.add(text.substring(10));
  43. } else if (text.startsWith("woven class ")) {
  44. wovenClasses.add(text.substring(12));
  45. } else if (text.startsWith("woven aspect ")) {
  46. wovenClasses.add(text.substring(13));
  47. }
  48. }
  49. public void begin() {
  50. starttime = System.currentTimeMillis();
  51. log("IBuildProgressMonitor.start()");
  52. }
  53. public List getCompiledFiles() { return compiledFiles;}
  54. public List getWovenClasses() { return wovenClasses; }
  55. public void log(String s) {
  56. if (VERBOSE) System.out.println(s);
  57. }
  58. public long getTimeTaken() {
  59. return totaltimetaken;
  60. }
  61. public boolean wasFullBuild() {
  62. return wasFullBuild;
  63. }
  64. public void reset() {
  65. wasFullBuild=true;
  66. compiledFiles.clear();
  67. wovenClasses.clear();
  68. }
  69. }