Skip to content

Commit

Permalink
Fixed JENKINS-11285
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Oct 16, 2011
1 parent 7aa6bc9 commit 575e5b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jenkinsci.plugins.postbuildscript;

import hudson.Util;
import org.kohsuke.stapler.DataBoundConstructor;

/**
Expand All @@ -14,7 +13,7 @@ public class GenericScript {

@DataBoundConstructor
public GenericScript(String filePath) {
this.filePath = Util.fixEmpty(filePath);
this.filePath = filePath;
}

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
import hudson.matrix.MatrixProject;
import hudson.matrix.*;
import hudson.maven.MavenModuleSet;
import hudson.model.*;
import hudson.tasks.*;
Expand All @@ -21,7 +21,7 @@
/**
* @author Gregory Boissinot
*/
public class PostBuildScript extends Notifier {
public class PostBuildScript extends Notifier implements MatrixAggregatable {

public BuildStepMonitor getRequiredMonitorService() {
return BuildStepMonitor.BUILD;
Expand Down Expand Up @@ -49,8 +49,24 @@ public PostBuildScript(List<GenericScript> genericScriptFile,
this.buildSteps = buildStep;
}

public MatrixAggregator createAggregator(MatrixBuild build, Launcher launcher, BuildListener listener) {
return new MatrixAggregator(build, launcher, listener) {
@Override
public boolean endBuild() throws InterruptedException, IOException {
return _perform(build, launcher, listener);
}
};
}

@Override
public boolean perform(AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {
if (!(build.getProject() instanceof MatrixConfiguration)) {
return _perform(build, launcher, listener);
}
return true;
}

private boolean _perform(AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {

listener.getLogger().println("[PostBuildScript] - Execution post build scripts.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<f:entry title="${%Batch or a shell script files to execute}">
<f:nested>
<div style="padding-left:2em">
<f:repeatable var="genericScript" items="${instance.genericScriptList}"
<f:repeatable var="genericScriptFile" items="${instance.genericScriptList}"
add="${%Add a shell or a Windows batch file}">
<table width="100%">

<f:entry field="filePath" title="${%File script path}">
<f:textbox name="postBuild.genericScript.filePath"
value="${genericScript.filePath}"/>
value="${genericScriptFile.filePath}"/>
</f:entry>

<f:entry title="">
Expand Down

0 comments on commit 575e5b0

Please sign in to comment.