Skip to content
Permalink
Browse files
[JENKINS-27203] eliminated double variable expansion
  • Loading branch information
15knots committed Jun 19, 2015
1 parent c0dbeff commit e7759457e509c1c2b5c26dc2803381e1d7811d8a
Showing with 9 additions and 16 deletions.
  1. +9 −13 src/main/java/hudson/plugins/cmake/CmakeBuilder.java
  2. +0 −3 src/main/java/hudson/plugins/cmake/CmakeLauncher.java
@@ -145,13 +145,12 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
listener.getLogger().println(ioe.getMessage());
return false;
}
String theBuildType = prepareBuildType();

listener.getLogger().println("Build dir : " + theBuildDir.toString());
listener.getLogger().println("Source dir : " + theSourceDir.toString());
listener.getLogger().println("Install dir : " + theInstallDir.toString());
String cmakeCall = prepareCmakeCall(build, listener, envs,
theSourceDir, theInstallDir, theBuildType);
theSourceDir, theInstallDir);
listener.getLogger().println("CMake call : " + cmakeCall);

final CmakeLauncher cmakeLauncher =
@@ -162,11 +161,11 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
return false;
}

if (!cmakeLauncher.launchMake(getMakeCommand())) {
if (!cmakeLauncher.launchMake( Util.replaceMacro(getMakeCommand(), envs))) {
return false;
}

return cmakeLauncher.launchInstall(installDir, getInstallCommand());
return cmakeLauncher.launchInstall(installDir, Util.replaceMacro(getInstallCommand(), envs));
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException ie) {
@@ -177,21 +176,18 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen

private String prepareCmakeCall(AbstractBuild<?, ?> build,
BuildListener listener, EnvVars envs, String theSourceDir,
String theInstallDir, String theBuildType) throws IOException,
String theInstallDir) throws IOException,
InterruptedException {
String cmakeBin = checkCmake(build.getBuiltOn(), listener, envs);
String cmakeCall =
builderImpl.buildCMakeCall(cmakeBin,
this.generator,
this.preloadScript,
Util.replaceMacro(this.generator, envs),
Util.replaceMacro(this.preloadScript,envs),
theSourceDir,
theInstallDir,
theBuildType, Util.replaceMacro(cmakeArgs, envs));
return Util.replaceMacro(cmakeCall, envs);
}

private String prepareBuildType() {
return this.buildType;
Util.replaceMacro(this.buildType, envs),
Util.replaceMacro(cmakeArgs, envs));
return cmakeCall;
}

private String prepareInstallDir(BuildListener listener, EnvVars envs,
@@ -3,7 +3,6 @@
import hudson.EnvVars;
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
import hudson.model.BuildListener;

import java.io.IOException;
@@ -39,7 +38,6 @@ public boolean launchMake(String makeCommand) throws IOException, InterruptedExc
if (makeCommand.trim().isEmpty()) {
return true;
}
makeCommand = Util.replaceMacro(makeCommand, envs);
int result = launcher.launch().stdout(listener).cmdAsSingleString(makeCommand).envs(this.envs)
.pwd(new FilePath(this.workSpace, this.buildDir)).join();
return (result == 0);
@@ -51,7 +49,6 @@ public boolean launchInstall(String installDir, String installCommand) throws IO
if (!doInstall) {
return true;
}
installCommand = Util.replaceMacro(installCommand, this.envs);
int result = launcher.launch().stdout(listener).cmdAsSingleString(installCommand).envs(this.envs)
.pwd(new FilePath(this.workSpace, this.buildDir)).join();
return (result == 0);

0 comments on commit e775945

Please sign in to comment.