@@ -51,6 +51,7 @@ public int Run(IFlubuSession flubuSession)
5151
5252 try
5353 {
54+ BeforeBuildExecution ( flubuSession ) ;
5455 RunBuild ( flubuSession ) ;
5556 flubuSession . Complete ( ) ;
5657 AfterBuildExecution ( flubuSession ) ;
@@ -137,7 +138,6 @@ public static (List<string> targetsToRun, bool unknownTarget, List<string> notFo
137138
138139 private void RunBuild ( IFlubuSession flubuSession )
139140 {
140- BeforeBuildExecution ( flubuSession ) ;
141141 flubuSession . TargetTree . ResetTargetTree ( ) ;
142142 ConfigureDefaultProps ( flubuSession ) ;
143143 ConfigureBuildProperties ( flubuSession ) ;
@@ -149,7 +149,7 @@ private void RunBuild(IFlubuSession flubuSession)
149149 _targetCreator . CreateTargetFromMethodAttributes ( this , flubuSession ) ;
150150
151151 ConfigureTargets ( flubuSession ) ;
152-
152+ OnBuildInitialized ( flubuSession ) ;
153153 if ( ! flubuSession . Args . InteractiveMode )
154154 {
155155 var targetsInfo = ParseCmdLineArgs ( flubuSession . Args . MainCommands , flubuSession . TargetTree ) ;
@@ -215,7 +215,9 @@ private void ExecuteTarget(IFlubuSession flubuSession, (List<string> targetsToRu
215215 BeforeTargetExecution ( flubuSession ) ;
216216 foreach ( var targetToRun in targetsInfo . targetsToRun )
217217 {
218+ BeforeEachTargetExecution ( flubuSession ) ;
218219 flubuSession . TargetTree . RunTarget ( flubuSession , targetToRun ) ;
220+ AfterEachTargetExecution ( flubuSession ) ;
219221 }
220222
221223 AfterTargetExecution ( flubuSession ) ;
@@ -250,18 +252,58 @@ private void ExecuteTarget(IFlubuSession flubuSession, (List<string> targetsToRu
250252 AssertAllTargetDependenciesWereExecuted ( flubuSession ) ;
251253 }
252254
255+ /// <summary>
256+ /// Event that happens before all targets get executed.
257+ /// </summary>
258+ /// <param name="context"></param>
253259 protected virtual void BeforeTargetExecution ( ITaskContext context )
254260 {
255261 }
256262
263+ /// <summary>
264+ /// Event that happens after all targets get executed.
265+ /// </summary>
266+ /// <param name="context"></param>
257267 protected virtual void AfterTargetExecution ( ITaskContext context )
258268 {
259269 }
260270
271+ /// <summary>
272+ /// Event that happens before each target get executed.
273+ /// </summary>
274+ /// <param name="context"></param>
275+ protected virtual void BeforeEachTargetExecution ( ITaskContext context )
276+ {
277+ }
278+
279+ /// <summary>
280+ /// Event that happens after each target get executed.
281+ /// </summary>
282+ /// <param name="context"></param>
283+ protected virtual void AfterEachTargetExecution ( ITaskContext context )
284+ {
285+ }
286+
287+ /// <summary>
288+ /// Event that happens before build is executed. Target's and properties are not yet configured.
289+ /// </summary>
290+ /// <param name="context"></param>
261291 protected virtual void BeforeBuildExecution ( ITaskContext context )
262292 {
263293 }
264294
295+ /// <summary>
296+ /// Event that happens when build is initialized. Target's and properties are configured.
297+ /// </summary>
298+ /// <param name="context"></param>
299+ protected virtual void OnBuildInitialized ( ITaskContext context )
300+ {
301+ }
302+
303+ /// <summary>
304+ /// Event that happens when build is finished.
305+ /// </summary>
306+ /// <param name="context"></param>
265307 protected virtual void AfterBuildExecution ( IFlubuSession session )
266308 {
267309 if ( session . Args . GenerateContinousIntegrationConfigs != null &&
@@ -273,6 +315,11 @@ protected virtual void AfterBuildExecution(IFlubuSession session)
273315 session . TargetTree . LogBuildSummary ( session ) ;
274316 }
275317
318+ /// <summary>
319+ /// Event that happends when build has failed.
320+ /// </summary>
321+ /// <param name="session"></param>
322+ /// <param name="ex"></param>
276323 protected virtual void OnBuildFailed ( IFlubuSession session , Exception ex )
277324 {
278325 }
0 commit comments