Skip to content

Commit

Permalink
[maven] SARL Maven compiler supports submodules.
Browse files Browse the repository at this point in the history
see #219

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Oct 19, 2014
1 parent c670b25 commit 30223e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Expand Up @@ -128,36 +128,49 @@ public final void execute() throws MojoExecutionException, MojoFailureException
*/
protected abstract void executeMojo() throws MojoExecutionException, MojoFailureException;

/** Make absolute the given filename, relatively to the project's folder.
*
* @param file - the file to convert.
* @return the absolute filename.
*/
protected File makeAbsolute(File file) {
if (!file.isAbsolute()) {
File basedir = this.mavenHelper.getSession().getCurrentProject().getBasedir();
return new File(basedir, file.getPath()).getAbsoluteFile();
}
return file;
}

/** Replies the input folder.
*
* @return the input folder.
*/
protected File getInput() {
return (this.input == null) ? new File(DEFAULT_INPUT) : this.input;
return makeAbsolute((this.input == null) ? new File(DEFAULT_INPUT) : this.input);
}

/** Replies the output folder.
*
* @return the output folder.
*/
protected File getOutput() {
return (this.output == null) ? new File(DEFAULT_OUTPUT) : this.output;
return makeAbsolute((this.output == null) ? new File(DEFAULT_OUTPUT) : this.output);
}

/** Replies the test input folder.
*
* @return the test input folder.
*/
protected File getTestInput() {
return (this.testInput == null) ? new File(DEFAULT_TEST_INPUT) : this.testInput;
return makeAbsolute((this.testInput == null) ? new File(DEFAULT_TEST_INPUT) : this.testInput);
}

/** Replies the test output folder.
*
* @return the test output folder.
*/
protected File getTestOutput() {
return (this.testOutput == null) ? new File(DEFAULT_TEST_OUTPUT) : this.testOutput;
return makeAbsolute((this.testOutput == null) ? new File(DEFAULT_TEST_OUTPUT) : this.testOutput);
}

/** Execute another MOJO.
Expand Down
Expand Up @@ -79,7 +79,7 @@ private void compileSARL() throws MojoExecutionException, MojoFailureException {
this.source,
this.target,
this.encoding,
getOutput()),
getOutput().getAbsolutePath()),
dependencies);
}

Expand Down

0 comments on commit 30223e2

Please sign in to comment.