Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
</developer>
</developers>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

<scm>
<connection>scm:git:git://github.com/jenkinsci/rake-plugin.git</connection>
<developerConnection>scm:git:[email protected]:jenkinsci/rake-plugin.git</developerConnection>
Expand Down
19 changes: 18 additions & 1 deletion src/main/java/hudson/plugins/rake/Rake.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException;
import org.jenkinsci.plugins.tokenmacro.TokenMacro;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
Expand Down Expand Up @@ -83,7 +85,22 @@ private Launcher getLastBuiltLauncher(AbstractBuild build, Launcher launcher, Bu
@Override
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException {
ArgumentListBuilder args = new ArgumentListBuilder();
String normalizedTasks = tasks.replaceAll("[ \r\n]+"," ");
String normalizedTasks = "";

try {
String env = build.getEnvironment(listener).expand(tasks);
env = Util.replaceMacro(env, build.getBuildVariableResolver());
String tokenized = TokenMacro.expand(build, listener, env);
normalizedTasks = tokenized.replaceAll("[ \r\n]+"," ");
}
catch (MacroEvaluationException mee) {
System.err.println("MacroEvaluationException: " + mee.getMessage());
normalizedTasks = tasks.replaceAll("[ \r\n]+"," ");
}
catch (IOException ioe){
normalizedTasks = tasks.replaceAll("[ \r\n]+"," ");

}

Launcher lastBuiltLauncher = getLastBuiltLauncher(build, launcher, listener);

Expand Down