summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErnesto Novillo <enovillo@tvpdeskloan01.(none)>2010-03-15 10:24:36 -0400
committerMark Donszelmann <duns@macserver.donszelmann.org>2010-05-14 00:33:31 +0200
commitd070a872d4a8e38caae516da5247208be2fd74ef (patch)
tree36fef66357affa1b32a4b4de1990406ff6e5678d /src
parent58325fbf5ba4989d8430fdce52dd4eaa47aa404c (diff)
downloadmaven-nar-plugin-d070a872d4a8e38caae516da5247208be2fd74ef.tar.gz
maven-nar-plugin-d070a872d4a8e38caae516da5247208be2fd74ef.tar.bz2
maven-nar-plugin-d070a872d4a8e38caae516da5247208be2fd74ef.tar.xz
maven-nar-plugin-d070a872d4a8e38caae516da5247208be2fd74ef.zip
Added support for buildconf arguments.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java49
1 files changed, 41 insertions, 8 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
index ad4a875..1389a4d 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
@@ -53,12 +53,19 @@ public class NarGnuConfigureMojo
private boolean gnuConfigureSkip;
/**
- * Skip running of configure and therefore also autogen.sh
+ * Arguments to pass to GNU configure.
*
* @parameter expression="${nar.gnu.configure.args}" default-value=""
*/
private String gnuConfigureArgs;
+ /**
+ * Arguments to pass to GNU buildconf.
+ *
+ * @parameter expression="${nar.gnu.buildconf.args}" default-value=""
+ */
+ private String gnuBuildconfArgs;
+
private static final String AUTOGEN = "autogen.sh";
private static final String BUILDCONF = "buildconf";
@@ -96,10 +103,15 @@ public class NarGnuConfigureMojo
if ( autogen.exists() )
{
getLog().info( "Running GNU " + AUTOGEN );
- runAutogen(autogen, targetDir);
+ runAutogen(autogen, targetDir, null);
} else if ( buildconf.exists() ) {
getLog().info( "Running GNU " + BUILDCONF );
- runAutogen(buildconf, targetDir);
+ String gnuBuildconfArgsArray[] = null;
+ if (gnuBuildconfArgs != null)
+ {
+ gnuBuildconfArgsArray = gnuBuildconfArgs.split("\\s");
+ }
+ runAutogen(buildconf, targetDir, gnuBuildconfArgsArray);
}
}
@@ -111,11 +123,12 @@ public class NarGnuConfigureMojo
NarUtil.makeExecutable( configure, getLog() );
String[] args = null;
- // create the array to hold constant and additional args
+ // create the array to hold constant and additional args
if ( gnuConfigureArgs != null )
{
String[] a = gnuConfigureArgs.split( " " );
args = new String[a.length + 2];
+
for ( int i = 0; i < a.length; i++ )
{
args[i+2] = a[i];
@@ -140,17 +153,37 @@ public class NarGnuConfigureMojo
}
}
- private void runAutogen(File autogen, File targetDir)
+ private void runAutogen(final File autogen, final File targetDir, final String args[])
throws MojoExecutionException, MojoFailureException
{
// fix missing config directory
- File configDir = new File(targetDir, "config");
+ final File configDir = new File(targetDir, "config");
if (!configDir.exists()) {
configDir.mkdirs();
}
-
+
NarUtil.makeExecutable( autogen, getLog() );
- int result = NarUtil.runCommand( "./" + autogen.getName(), null, targetDir, null, getLog() );
+ getLog().debug("running sh ./" + autogen.getName());
+
+ String arguments[] = null;
+ if (args != null)
+ {
+ arguments = new String[2 + args.length];
+ for (int i = 0; i < args.length; ++i)
+ {
+ arguments[i+2] = args[i];
+ }
+ }
+ else
+ {
+ arguments = new String[2];
+ }
+ arguments[0] = "./";
+ arguments[1] = autogen.getName();
+
+ getLog().info( "args: " + Arrays.toString(arguments) );
+
+ final int result = NarUtil.runCommand( "sh", arguments, targetDir, null, getLog() );
if ( result != 0 )
{
throw new MojoExecutionException( "'" + autogen.getName() + "' errorcode: " + result );