summaryrefslogtreecommitdiff
path: root/src/main/java/org/apache/maven
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-20 10:11:49 +0200
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-20 10:11:49 +0200
commit4ba318d57ce48513d9e1d2501d4adbb4cb25de83 (patch)
tree4da82d2164d80d7790027bfa886a42e5a2b0970c /src/main/java/org/apache/maven
parent7d5edebffcec8004a9fb84a3f82c7c489beab6fe (diff)
downloadmaven-nar-plugin-4ba318d57ce48513d9e1d2501d4adbb4cb25de83.tar.gz
maven-nar-plugin-4ba318d57ce48513d9e1d2501d4adbb4cb25de83.tar.bz2
maven-nar-plugin-4ba318d57ce48513d9e1d2501d4adbb4cb25de83.tar.xz
maven-nar-plugin-4ba318d57ce48513d9e1d2501d4adbb4cb25de83.zip
Fixed NAR-75
Diffstat (limited to 'src/main/java/org/apache/maven')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java46
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java13
2 files changed, 47 insertions, 12 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 2f32094..082a9f5 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
@@ -43,10 +43,18 @@ public class NarGnuConfigureMojo
* @parameter expression="${nar.gnu.autogen.skip}" default-value="false"
*/
private boolean gnuAutogenSkip;
-
- private static String autogen = "autogen.sh";
- private static String configure = "configure";
-
+
+ /**
+ * Skip running of configure and therefore also autogen.sh
+ *
+ * @parameter expression="${nar.gnu.configure.skip}" default-value="false"
+ */
+ private boolean gnuConfigureSkip;
+
+ private static final String AUTOGEN = "autogen.sh";
+
+ private static final String CONFIGURE = "configure";
+
public void execute()
throws MojoExecutionException, MojoFailureException
{
@@ -68,14 +76,32 @@ public class NarGnuConfigureMojo
throw new MojoExecutionException( "Failed to copy GNU sources", e );
}
- if ((!gnuAutogenSkip) && new File(targetDir, "autogen.sh").exists()) {
- getLog().info( "Running GNU "+autogen );
- NarUtil.runCommand( "sh ./"+autogen, null, targetDir, null, getLog() );
+ File autogen = new File( targetDir, AUTOGEN );
+ if ( !gnuConfigureSkip && !gnuAutogenSkip && autogen.exists() )
+ {
+ getLog().info( "Running GNU " + AUTOGEN );
+ NarUtil.makeExecutable( autogen, getLog() );
+ int result = NarUtil.runCommand( "./" + autogen.getName(), null, targetDir, null, getLog() );
+ if ( result != 0 )
+ {
+ System.err.println( targetDir );
+ throw new MojoExecutionException( "'"+AUTOGEN+"' errorcode: " + result );
+ }
}
- getLog().info( "Running GNU "+configure );
- NarUtil.runCommand( "sh ./"+configure, new String[] { "--disable-ccache", "--prefix="
- + getGnuAOLTargetDirectory().getAbsolutePath() }, targetDir, null, getLog() );
+ File configure = new File( targetDir, CONFIGURE );
+ if ( !gnuConfigureSkip && configure.exists() )
+ {
+ getLog().info( "Running GNU " + CONFIGURE );
+ NarUtil.makeExecutable( configure, getLog() );
+ int result =
+ NarUtil.runCommand( "./" + configure.getName(), new String[] { "--disable-ccache",
+ "--prefix=" + getGnuAOLTargetDirectory().getAbsolutePath() }, targetDir, null, getLog() );
+ if ( result != 0 )
+ {
+ throw new MojoExecutionException( "'"+CONFIGURE+"' errorcode: " + result );
+ }
+ }
}
}
}
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 e04e3a9..f7b2f48 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
@@ -45,8 +45,17 @@ public class NarGnuMakeMojo
if ( srcDir.exists() )
{
getLog().info( "Running GNU make" );
- NarUtil.runCommand( "make", null, srcDir, null, getLog() );
- NarUtil.runCommand( "make", new String[] { "install" }, srcDir, null, getLog() );
+ int result = NarUtil.runCommand( "make", null, srcDir, null, getLog() );
+ if ( result != 0 )
+ {
+ throw new MojoExecutionException( "'make' errorcode: " + result );
+ }
+
+ result = NarUtil.runCommand( "make", new String[] { "install" }, srcDir, null, getLog() );
+ if ( result != 0 )
+ {
+ throw new MojoExecutionException( "'make install' errorcode: " + result );
+ }
}
}
}