Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed bug. refs JENKINS-14345
  • Loading branch information
kiy0taka committed Jul 18, 2012
1 parent b4c5e66 commit a54cbb2
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/java/com/g2one/hudson/grails/GrailsBuilder.java
Expand Up @@ -155,7 +155,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
if (targetsToRun.size() > 0) {
String execName;
if (useWrapper) {
FilePath wrapper = new FilePath(build.getModuleRoot(), launcher.isUnix() ? "grailsw" : "grailsw.bat");
FilePath wrapper = new FilePath(getBasePath(build), launcher.isUnix() ? "grailsw" : "grailsw.bat");
execName = wrapper.getRemote();
} else {
execName = launcher.isUnix() ? "grails" : "grails.bat";
Expand Down Expand Up @@ -220,14 +220,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
}

try {
final FilePath basePath;
FilePath moduleRoot = build.getModuleRoot();
if (projectBaseDir != null && !"".equals(projectBaseDir.trim())) {
basePath = new FilePath(moduleRoot, projectBaseDir);
} else {
basePath = moduleRoot;
}
int r = launcher.launch().cmds(args).envs(env).stdout(listener).pwd(basePath).join();
int r = launcher.launch().cmds(args).envs(env).stdout(listener).pwd(getBasePath(build)).join();
if (r != 0) return false;
} catch (IOException e) {
Util.displayIOException(e, listener);
Expand All @@ -242,6 +235,17 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
return true;
}

private FilePath getBasePath(AbstractBuild<?, ?> build) {
FilePath basePath;
FilePath moduleRoot = build.getModuleRoot();
if (projectBaseDir != null && !"".equals(projectBaseDir.trim())) {
basePath = new FilePath(moduleRoot, projectBaseDir);
} else {
basePath = moduleRoot;
}
return basePath;
}

/**
* Method based on work from Kenji Nakamura
*
Expand Down

0 comments on commit a54cbb2

Please sign in to comment.