summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAdrian Bienkowski <abienkow@arizona.(none)>2010-02-17 02:49:03 +0800
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2010-02-21 05:40:35 +0800
commitf6563341a8f3a9d88fe00c048156bb7e3fb44f4f (patch)
tree338dbdd0549b95b4af7d2eebb7007777c9762008 /src/main/java
parent038bb84264e37025af60a70706c9253b75e802b9 (diff)
downloadmaven-nar-plugin-f6563341a8f3a9d88fe00c048156bb7e3fb44f4f.tar.gz
maven-nar-plugin-f6563341a8f3a9d88fe00c048156bb7e3fb44f4f.tar.bz2
maven-nar-plugin-f6563341a8f3a9d88fe00c048156bb7e3fb44f4f.tar.xz
maven-nar-plugin-f6563341a8f3a9d88fe00c048156bb7e3fb44f4f.zip
Add the ability to controll arguments and environment variable when make runs; also option to skip make install step.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java54
1 files changed, 50 insertions, 4 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
index b2eae70..66fabd0 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
@@ -35,6 +35,27 @@ import org.apache.maven.plugin.MojoFailureException;
public class NarGnuMakeMojo
extends AbstractGnuMojo
{
+ /**
+ * Space delimited list of arguments to pass to make
+ *
+ * @parameter expression=""
+ */
+ private String gnuMakeArgs;
+
+ /**
+ * Comma delimited list of environment variables to setup before running make
+ *
+ * @parameter expression=""
+ */
+ private String gnuMakeEnv;
+
+ /**
+ * Boolean to control if we should run make instal after the make
+ *
+ * @parameter expression="" default-value="false"
+ */
+ private boolean gnuMakeInstallSkip;
+
public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
@@ -46,17 +67,42 @@ public class NarGnuMakeMojo
File srcDir = getGnuAOLSourceDirectory();
if ( srcDir.exists() )
{
+ String[] args= null;
+ String[] env= null;
+
+ if ( gnuMakeArgs != null )
+ {
+ args= gnuMakeArgs.split( " " );
+ }
+ if ( gnuMakeEnv != null )
+ {
+ env= gnuMakeEnv.split( "," );
+ }
+
getLog().info( "Running GNU make" );
- int result = NarUtil.runCommand( "make", null, srcDir, null, getLog() );
+ int result = NarUtil.runCommand( "make", args, srcDir, env, getLog() );
if ( result != 0 )
{
throw new MojoExecutionException( "'make' errorcode: " + result );
}
- result = NarUtil.runCommand( "make", new String[] { "install" }, srcDir, null, getLog() );
- if ( result != 0 )
+ if ( !gnuMakeInstallSkip )
{
- throw new MojoExecutionException( "'make install' errorcode: " + result );
+ getLog().info( "Running make install" );
+ if ( args != null )
+ {
+ gnuMakeArgs= gnuMakeArgs + " install";
+ args= gnuMakeArgs.split( " " );
+ }
+ else
+ {
+ args= new String[] { "install" };
+ }
+ result = NarUtil.runCommand( "make", args, srcDir, null, getLog() );
+ if ( result != 0 )
+ {
+ throw new MojoExecutionException( "'make install' errorcode: " + result );
+ }
}
}
}