Skip to content

Commit

Permalink
Merge pull request #8 from normanmaurer/netty_needs
Browse files Browse the repository at this point in the history
Allow to also use generate mojo with existing native src files
  • Loading branch information
chirino committed Feb 12, 2014
2 parents c27b5a0 + b3f8609 commit 175faf0
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 175faf0

Please sign in to comment.