Skip to content

Commit

Permalink
Allow to also use generate mojo with existing native src files
Browse files Browse the repository at this point in the history
  • Loading branch information
Norman Maurer committed Feb 12, 2014
1 parent c27b5a0 commit b3f8609
Showing 1 changed file with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ public class GenerateMojo extends AbstractMojo {
*/
protected MavenProject project;

/**
* The directory where the native source files are located.
*
* @parameter
*/
private File nativeSourceDirectory;

/**
* The directory where the generated native source files are located.
*
Expand Down Expand Up @@ -169,8 +176,20 @@ public class GenerateMojo extends AbstractMojo {
public void execute() throws MojoExecutionException {
cli.verbose = verbose;
cli.log = getLog();
generateNativeSourceFiles();
generateBuildSystem();
if (nativeSourceDirectory == null) {
generateNativeSourceFiles();
} else {
copyNativeSourceFiles();
}
generateBuildSystem();
}

private void copyNativeSourceFiles() throws MojoExecutionException {
try {
FileUtils.copyDirectory(nativeSourceDirectory, generatedNativeSourceDirectory);
} catch (Exception e) {
throw new MojoExecutionException("Copy of Native source failed: "+e, e);
}
}

private void generateNativeSourceFiles() throws MojoExecutionException {
Expand Down Expand Up @@ -295,7 +314,7 @@ private FilterWrapper[] filters(boolean filter) throws IOException {
if( !filter ) {
return new FilterWrapper[0];
}

final String startExp = "@";
final String endExp = "@";
final String escapeString = "\\";
Expand Down

0 comments on commit b3f8609

Please sign in to comment.