hudson.model
Class AbstractBuild.AbstractBuildExecution

java.lang.Object
  extended by hudson.model.Run.RunExecution
      extended by hudson.model.Run.Runner
          extended by hudson.model.AbstractBuild.AbstractBuildExecution
Direct Known Subclasses:
AbstractBuild.AbstractRunner, MatrixBuild.MatrixBuildExecution
Enclosing class:
AbstractBuild<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>

public abstract class AbstractBuild.AbstractBuildExecution
extends Run.Runner


Field Summary
protected  Launcher launcher
          Since configuration can be changed while a build is in progress, create a launcher once and stick to it for the entire build duration.
protected  BuildListener listener
          Output/progress of this build goes here.
 
Constructor Summary
AbstractBuild.AbstractBuildExecution()
           
 
Method Summary
 void cleanUp(BuildListener listener)
          Performs final clean up action.
protected  Launcher createLauncher(BuildListener listener)
          Creates a Launcher that this build will use.
protected  WorkspaceList.Lease decideWorkspace(Node n, WorkspaceList wsl)
          Allocates the workspace from WorkspaceList.
 void defaultCheckout()
           
protected abstract  Result doRun(BuildListener listener)
          The portion of a build that is specific to a subclass of AbstractBuild goes here.
protected  Node getCurrentNode()
          Returns the current Node on which we are building.
 Launcher getLauncher()
           
 BuildListener getListener()
           
protected  boolean perform(BuildStep bs, BuildListener listener)
          Calls a build step.
protected  void performAllBuildStep(BuildListener listener, Iterable<? extends BuildStep> buildSteps, boolean phase)
          Deprecated. as of 1.356 Use performAllBuildSteps(BuildListener, Iterable, boolean)
protected  void performAllBuildStep(BuildListener listener, Map<?,? extends BuildStep> buildSteps, boolean phase)
          Deprecated. as of 1.356 Use performAllBuildSteps(BuildListener, Map, boolean)
protected  boolean performAllBuildSteps(BuildListener listener, Iterable<? extends BuildStep> buildSteps, boolean phase)
          Runs all the given build steps, even if one of them fail.
protected  boolean performAllBuildSteps(BuildListener listener, Map<?,? extends BuildStep> buildSteps, boolean phase)
           
 void post(BuildListener listener)
          Performs the post-build action.
protected abstract  void post2(BuildListener listener)
           
protected  boolean preBuild(BuildListener listener, Collection<? extends BuildStep> steps)
           
protected  boolean preBuild(BuildListener listener, Iterable<? extends BuildStep> steps)
           
protected  boolean preBuild(BuildListener listener, Map<?,? extends BuildStep> steps)
           
 Result run(BuildListener listener)
          Performs the main build and returns the status code.
 
Methods inherited from class hudson.model.Run.RunExecution
getAttributes, getBuild, getProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

launcher

protected Launcher launcher
Since configuration can be changed while a build is in progress, create a launcher once and stick to it for the entire build duration.


listener

protected BuildListener listener
Output/progress of this build goes here.

Constructor Detail

AbstractBuild.AbstractBuildExecution

public AbstractBuild.AbstractBuildExecution()
Method Detail

getCurrentNode

protected final Node getCurrentNode()
Returns the current Node on which we are building.


getLauncher

public Launcher getLauncher()

getListener

public BuildListener getListener()

decideWorkspace

protected WorkspaceList.Lease decideWorkspace(Node n,
                                              WorkspaceList wsl)
                                       throws InterruptedException,
                                              IOException
Allocates the workspace from WorkspaceList.

Parameters:
n - Passed in for the convenience. The node where the build is running.
wsl - Passed in for the convenience. The returned path must be registered to this object.
Throws:
InterruptedException
IOException

run

public Result run(BuildListener listener)
           throws Exception
Description copied from class: Run.RunExecution
Performs the main build and returns the status code.

Specified by:
run in class Run.RunExecution
Throws:
Exception - exception will be recorded and the build will be considered a failure.

createLauncher

protected Launcher createLauncher(BuildListener listener)
                           throws IOException,
                                  InterruptedException
Creates a Launcher that this build will use. This can be overridden by derived types to decorate the resulting Launcher.

Parameters:
listener - Always non-null. Connected to the main build output.
Throws:
IOException
InterruptedException

defaultCheckout

public void defaultCheckout()
                     throws IOException,
                            InterruptedException
Throws:
IOException
InterruptedException

doRun

protected abstract Result doRun(BuildListener listener)
                         throws Exception,
                                Run.RunnerAbortedException
The portion of a build that is specific to a subclass of AbstractBuild goes here.

Returns:
null to continue the build normally (that means the doRun method itself run successfully) Return a non-null value to abort the build right there with the specified result code.
Throws:
Exception
Run.RunnerAbortedException

post2

protected abstract void post2(BuildListener listener)
                       throws Exception
Throws:
Exception
See Also:
post(BuildListener)

post

public final void post(BuildListener listener)
                throws Exception
Description copied from class: Run.RunExecution
Performs the post-build action.

This method is called after the main portion of the build is completed. This is a good opportunity to do notifications based on the result of the build. When this method is called, the build is not really finalized yet, and the build is still considered in progress --- for example, even if the build is successful, this build still won't be picked up by Job.getLastSuccessfulBuild().

Specified by:
post in class Run.RunExecution
Throws:
Exception

cleanUp

public void cleanUp(BuildListener listener)
             throws Exception
Description copied from class: Run.RunExecution
Performs final clean up action.

This method is called after Run.RunExecution.post(BuildListener), after the build result is fully finalized. This is the point where the build is already considered completed.

Among other things, this is often a necessary pre-condition before invoking other builds that depend on this build.

Specified by:
cleanUp in class Run.RunExecution
Throws:
Exception

performAllBuildStep

protected final void performAllBuildStep(BuildListener listener,
                                         Map<?,? extends BuildStep> buildSteps,
                                         boolean phase)
                                  throws InterruptedException,
                                         IOException
Deprecated. as of 1.356 Use performAllBuildSteps(BuildListener, Map, boolean)

Throws:
InterruptedException
IOException

performAllBuildSteps

protected final boolean performAllBuildSteps(BuildListener listener,
                                             Map<?,? extends BuildStep> buildSteps,
                                             boolean phase)
                                      throws InterruptedException,
                                             IOException
Throws:
InterruptedException
IOException

performAllBuildStep

protected final void performAllBuildStep(BuildListener listener,
                                         Iterable<? extends BuildStep> buildSteps,
                                         boolean phase)
                                  throws InterruptedException,
                                         IOException
Deprecated. as of 1.356 Use performAllBuildSteps(BuildListener, Iterable, boolean)

Throws:
InterruptedException
IOException

performAllBuildSteps

protected final boolean performAllBuildSteps(BuildListener listener,
                                             Iterable<? extends BuildStep> buildSteps,
                                             boolean phase)
                                      throws InterruptedException,
                                             IOException
Runs all the given build steps, even if one of them fail.

Parameters:
phase - true for the post build processing, and false for the final "run after finished" execution.
Throws:
InterruptedException
IOException

perform

protected final boolean perform(BuildStep bs,
                                BuildListener listener)
                         throws InterruptedException,
                                IOException
Calls a build step.

Throws:
InterruptedException
IOException

preBuild

protected final boolean preBuild(BuildListener listener,
                                 Map<?,? extends BuildStep> steps)

preBuild

protected final boolean preBuild(BuildListener listener,
                                 Collection<? extends BuildStep> steps)

preBuild

protected final boolean preBuild(BuildListener listener,
                                 Iterable<? extends BuildStep> steps)


Copyright © 2004-2013. All Rights Reserved.