summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-20 15:01:39 +0200
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-10-20 15:01:39 +0200
commit843b6c6c003b00eff916eb047995ff59ba28cf66 (patch)
treeef6cd8834f0c89c1895f6d05e812fd46ef0acb15 /src/main
parent4ba318d57ce48513d9e1d2501d4adbb4cb25de83 (diff)
downloadmaven-nar-plugin-843b6c6c003b00eff916eb047995ff59ba28cf66.tar.gz
maven-nar-plugin-843b6c6c003b00eff916eb047995ff59ba28cf66.tar.bz2
maven-nar-plugin-843b6c6c003b00eff916eb047995ff59ba28cf66.tar.xz
maven-nar-plugin-843b6c6c003b00eff916eb047995ff59ba28cf66.zip
Moved output of gnu goals to target/nar/gnu; Fixed NAR-77
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java20
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java3
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java3
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java3
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java21
5 files changed, 43 insertions, 7 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java b/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java
index 639dda2..9be1d44 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java
@@ -32,6 +32,14 @@ public abstract class AbstractGnuMojo
extends AbstractResourcesMojo
{
/**
+ * Use GNU goals on Windows
+ *
+ * @parameter expresssion="nar.gnu.useonwindows" default-value="false"
+ * @required
+ */
+ private boolean gnuUseOnWindows;
+
+ /**
* Source directory for GNU style project
*
* @parameter expression="${basedir}/src/gnu"
@@ -40,7 +48,7 @@ public abstract class AbstractGnuMojo
protected File gnuSourceDirectory;
/**
- * @parameter expression="${project.build.directory}/gnu"
+ * @parameter expression="${project.build.directory}/nar/gnu"
* @required
*/
private File gnuTargetDirectory;
@@ -74,5 +82,13 @@ public abstract class AbstractGnuMojo
{
return new File( gnuTargetDirectory, getAOL().toString() );
}
-
+
+ /**
+ * Returns true if we do not want to use GNU on Windows
+ *
+ * @return
+ */
+ protected boolean useGnu() {
+ return (gnuUseOnWindows || !NarUtil.getOS( null ).equals( OS.WINDOWS ));
+ }
}
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 082a9f5..697dcf1 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
@@ -61,6 +61,9 @@ public class NarGnuConfigureMojo
if ( shouldSkip() )
return;
+ if ( !useGnu() )
+ return;
+
if ( gnuSourceDirectory.exists() )
{
getLog().info( "Copying GNU sources" );
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 f7b2f48..1500c60 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
@@ -41,6 +41,9 @@ public class NarGnuMakeMojo
if ( shouldSkip() )
return;
+ if ( !useGnu() )
+ return;
+
File srcDir = getGnuAOLSourceDirectory();
if ( srcDir.exists() )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
index e232895..2b9336f 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
@@ -40,6 +40,9 @@ public class NarGnuProcess
{
if ( shouldSkip() )
return;
+
+ if ( !useGnu() )
+ return;
File srcDir = getGnuAOLTargetDirectory();
if ( srcDir.exists() )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
index 927ba3c..ebdb104 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
@@ -38,6 +38,13 @@ import org.codehaus.plexus.util.SelectorUtils;
public class NarResourcesMojo
extends AbstractResourcesMojo
{
+ /**
+ * Use given AOL only. If false, copy for all available AOLs.
+ *
+ * @parameter expression="${nar.resources.copy.aol}" default-value="true"
+ * @required
+ */
+ private boolean resourcesCopyAOL;
/**
* Directory for nar resources. Defaults to src/nar/resources
@@ -57,14 +64,18 @@ public class NarResourcesMojo
File aolDir = new File( resourceDirectory, "aol" );
if ( aolDir.exists() )
{
- String[] aols = aolDir.list();
- for ( int i = 0; i < aols.length; i++ )
+ String[] aol = aolDir.list();
+ for ( int i = 0; i < aol.length; i++ )
{
+ // copy onky resources of current AOL
+ if ( resourcesCopyAOL && ( !aol[i].equals( getAOL().toString() ) ) )
+ continue;
+
boolean ignore = false;
for ( Iterator j = FileUtils.getDefaultExcludesAsList().iterator(); j.hasNext(); )
{
String exclude = (String) j.next();
- if ( SelectorUtils.matchPath( exclude.replace( '/', File.separatorChar ), aols[i] ) )
+ if ( SelectorUtils.matchPath( exclude.replace( '/', File.separatorChar ), aol[i] ) )
{
ignore = true;
break;
@@ -72,8 +83,8 @@ public class NarResourcesMojo
}
if ( !ignore )
{
- File aol = new File( aolDir, aols[i] );
- copyResources( aol, aol.getName() );
+ File aolFile = new File( aolDir, aol[i] );
+ copyResources( aolFile, aolFile.getName() );
}
}
}