Skip to content
Permalink
Browse files

Fix JENKINS-9538

  • Loading branch information...
gboissinot committed May 13, 2012
1 parent 24fc1df commit ec9433305ba96440292aa6b9e1cc8898407cf356
@@ -147,7 +147,7 @@ private boolean performTask(boolean dryRun, AbstractBuild<?, ?> build, Launcher
ai = ai.forEnvironment(env);
String exe;
if (useWrapper) {
exe = ai.getWrapperExecutable(launcher, build);
exe = ai.getWrapperExecutable(build);
} else {
exe = ai.getExecutable(launcher);
}
@@ -3,6 +3,7 @@
import hudson.*;
import hudson.model.*;
import hudson.remoting.Callable;
import hudson.remoting.VirtualChannel;
import hudson.slaves.NodeSpecific;
import hudson.tools.ToolDescriptor;
import hudson.tools.ToolInstallation;
@@ -68,13 +69,15 @@ public String call() throws IOException {
});
}

public String getWrapperExecutable(Launcher launcher, final AbstractBuild<?, ?> build)
public String getWrapperExecutable(final AbstractBuild<?, ?> build)
throws IOException, InterruptedException {
return launcher.getChannel().call(new Callable<String, IOException>() {
public String call() throws IOException {
File exe = getWrapperExeFile(build);
if (exe.exists()) {
return exe.getPath();
return build.getModuleRoot().act(new FilePath.FileCallable<String>() {
@Override
public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
String execName = (Functions.isWindows()) ? WINDOWS_GRADLE_WRAPPER_COMMAND : UNIX_GRADLE_WRAPPER_COMMAND;
File execFile = new File(f, execName);
if (execFile.exists()) {
return execFile.getPath();
}
return null;
}
@@ -87,13 +90,6 @@ private File getExeFile() {
return new File(antHome, "bin/" + execName);
}

private File getWrapperExeFile(AbstractBuild<?, ?> build) {
String execName = (Functions.isWindows()) ? WINDOWS_GRADLE_WRAPPER_COMMAND : UNIX_GRADLE_WRAPPER_COMMAND;
return new File(build.getModuleRoot().getRemote(), execName);
}

private static final long serialVersionUID = 1L;

public GradleInstallation forEnvironment(EnvVars environment) {
return new GradleInstallation(getName(), environment.expand(gradleHome), getProperties().toList());
}

0 comments on commit ec94333

Please sign in to comment.
You can’t perform that action at this time.