1. /*
  2. * Copyright 2000,2002,2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant;
  18. import java.util.EventListener;
  19. /**
  20. * Instances of classes that implement this interface can register
  21. * to be notified when things happened during a build.
  22. *
  23. * @see BuildEvent
  24. * @see Project#addBuildListener(BuildListener)
  25. *
  26. */
  27. public interface BuildListener extends EventListener {
  28. /**
  29. * Signals that a build has started. This event
  30. * is fired before any targets have started.
  31. *
  32. * @param event An event with any relevant extra information.
  33. * Must not be <code>null</code>.
  34. */
  35. void buildStarted(BuildEvent event);
  36. /**
  37. * Signals that the last target has finished. This event
  38. * will still be fired if an error occurred during the build.
  39. *
  40. * @param event An event with any relevant extra information.
  41. * Must not be <code>null</code>.
  42. *
  43. * @see BuildEvent#getException()
  44. */
  45. void buildFinished(BuildEvent event);
  46. /**
  47. * Signals that a target is starting.
  48. *
  49. * @param event An event with any relevant extra information.
  50. * Must not be <code>null</code>.
  51. *
  52. * @see BuildEvent#getTarget()
  53. */
  54. void targetStarted(BuildEvent event);
  55. /**
  56. * Signals that a target has finished. This event will
  57. * still be fired if an error occurred during the build.
  58. *
  59. * @param event An event with any relevant extra information.
  60. * Must not be <code>null</code>.
  61. *
  62. * @see BuildEvent#getException()
  63. */
  64. void targetFinished(BuildEvent event);
  65. /**
  66. * Signals that a task is starting.
  67. *
  68. * @param event An event with any relevant extra information.
  69. * Must not be <code>null</code>.
  70. *
  71. * @see BuildEvent#getTask()
  72. */
  73. void taskStarted(BuildEvent event);
  74. /**
  75. * Signals that a task has finished. This event will still
  76. * be fired if an error occurred during the build.
  77. *
  78. * @param event An event with any relevant extra information.
  79. * Must not be <code>null</code>.
  80. *
  81. * @see BuildEvent#getException()
  82. */
  83. void taskFinished(BuildEvent event);
  84. /**
  85. * Signals a message logging event.
  86. *
  87. * @param event An event with any relevant extra information.
  88. * Must not be <code>null</code>.
  89. *
  90. * @see BuildEvent#getMessage()
  91. * @see BuildEvent#getPriority()
  92. */
  93. void messageLogged(BuildEvent event);
  94. }