summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-12-16 09:23:14 +0100
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-12-16 09:23:14 +0100
commitd1ac55c70b41dca59afde48caf49138fe06878c2 (patch)
tree44710a1da54d2fb8b9a6ef2e0f3ca00066a51c9b
parent54c4c84888b840be561565f79654e59f80766ecc (diff)
downloadmaven-nar-plugin-d1ac55c70b41dca59afde48caf49138fe06878c2.tar.gz
maven-nar-plugin-d1ac55c70b41dca59afde48caf49138fe06878c2.tar.bz2
maven-nar-plugin-d1ac55c70b41dca59afde48caf49138fe06878c2.tar.xz
maven-nar-plugin-d1ac55c70b41dca59afde48caf49138fe06878c2.zip
Cleanup up; FIxed NAR-10
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java7
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java1
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarLayout21.java39
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java2
5 files changed, 28 insertions, 23 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
index d0718f7..7ffc0d8 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
@@ -284,12 +284,11 @@ public class NarCompileMojo
getLog().debug( "Looking for " + narDependency + " found binding " + binding );
if ( !binding.equals( Library.JNI ) )
{
- // FIXED NAR-90
File unpackDirectory = getNarManager().getUnpackDirectory( narDependency );
File include =
getLayout().getIncludeDirectory( unpackDirectory, narDependency.getArtifactId(),
narDependency.getVersion() );
- getLog().info( "Looking for include directory: " + include );
+ getLog().debug( "Looking for include directory: " + include );
if ( include.exists() )
{
task.createIncludePath().setPath( include.getPath() );
@@ -355,13 +354,11 @@ public class NarCompileMojo
{
File unpackDirectory = getNarManager().getUnpackDirectory( dependency );
- // FIXED NAR-90
File dir =
getLayout().getLibDirectory( unpackDirectory, dependency.getArtifactId(),
dependency.getVersion(), aol.toString(), binding );
- // dir = new File( dir, "lib/" + aol.toString() + "/" + binding );
- getLog().info( "Looking for Library Directory: " + dir );
+ getLog().debug( "Looking for Library Directory: " + dir );
if ( dir.exists() )
{
LibrarySet libSet = new LibrarySet();
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
index d6c9c87..a905a77 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
@@ -1018,7 +1018,6 @@ public class NarIntegrationTestMojo
String binding = bindings[j];
if ( !binding.equals( Library.STATIC ) )
{
- // FIXED NAR-90
File depLibPathEntry =
getLayout().getLibDirectory( getNarManager().getUnpackDirectory( dependency ),
dependency.getArtifactId(), dependency.getVersion(),
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarLayout21.java b/src/main/java/org/apache/maven/plugin/nar/NarLayout21.java
index 090e83e..ddfc3c2 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarLayout21.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarLayout21.java
@@ -1,6 +1,7 @@
package org.apache.maven.plugin.nar;
import java.io.File;
+import java.io.IOException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -46,7 +47,7 @@ public class NarLayout21
extends AbstractNarLayout
{
private NarFileLayout fileLayout;
-
+
public NarLayout21( Log log )
{
super( log );
@@ -99,7 +100,7 @@ public class NarLayout21
public final File getBinDirectory( File baseDir, String artifactId, String version, String aol )
{
File dir = getAolDirectory( baseDir, artifactId, version, aol, Library.EXECUTABLE );
- dir = new File(dir, fileLayout.getBinDirectory( aol ));
+ dir = new File( dir, fileLayout.getBinDirectory( aol ) );
return dir;
}
@@ -124,24 +125,26 @@ public class NarLayout21
String[] subDirs = baseDir.list();
for ( int i = 0; ( subDirs != null ) && ( i < subDirs.length ); i++ )
{
- String artifactIdVersion = project.getArtifactId()+"-"+project.getVersion();
-
+ String artifactIdVersion = project.getArtifactId() + "-" + project.getVersion();
+
// skip entries not belonging to this project
- if (!subDirs[i].startsWith( artifactIdVersion )) continue;
-
- String classifier = subDirs[i].substring( artifactIdVersion.length()+1 );
- System.err.println("*** "+classifier);
+ if ( !subDirs[i].startsWith( artifactIdVersion ) )
+ continue;
+
+ String classifier = subDirs[i].substring( artifactIdVersion.length() + 1 );
+
// skip noarch here
- if (classifier.equals( NarConstants.NAR_NO_ARCH )) continue;
-
+ if ( classifier.equals( NarConstants.NAR_NO_ARCH ) )
+ continue;
+
File dir = new File( baseDir, subDirs[i] );
attachNar( archiverManager, projectHelper, project, classifier, dir, "*/**" );
int lastDash = classifier.lastIndexOf( '-' );
- String type = classifier.substring( lastDash+1);
- AOL aol = new AOL(classifier.substring( 0, lastDash-1 ));
+ String type = classifier.substring( lastDash + 1 );
+ AOL aol = new AOL( classifier.substring( 0, lastDash - 1 ) );
- if (type.equals( Library.EXECUTABLE ))
+ if ( type.equals( Library.EXECUTABLE ) )
{
if ( narInfo.getBinding( aol, null ) == null )
{
@@ -178,6 +181,7 @@ public class NarLayout21
File dir = new File( narLocation, FileUtils.basename( file.getPath(), "." + NarConstants.NAR_EXTENSION ) );
boolean process = false;
+
if ( !narLocation.exists() )
{
narLocation.mkdirs();
@@ -189,6 +193,15 @@ public class NarLayout21
}
else if ( file.lastModified() > dir.lastModified() )
{
+ try
+ {
+ FileUtils.deleteDirectory( dir );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Could not delete directory: " + dir, e );
+ }
+
process = true;
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
index 6e27b5c..a2f36db 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
@@ -140,7 +140,6 @@ public class NarTestCompileMojo
// add dependency include paths
for ( Iterator i = getNarManager().getNarDependencies( "test" ).iterator(); i.hasNext(); )
{
- // FIXED NAR-90
Artifact artifact = (Artifact) i.next();
File include =
getLayout().getIncludeDirectory( getNarManager().getUnpackDirectory( artifact ),
@@ -235,7 +234,6 @@ public class NarTestCompileMojo
Artifact dependency = (Artifact) i.next();
// FIXME: this should be preferred binding
- // FIXED NAR-90
File libDirectory =
getLayout().getLibDirectory( getNarManager().getUnpackDirectory( dependency ),
dependency.getArtifactId(), dependency.getVersion(), getAOL().toString(),
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
index 0498b18..c39feca 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
@@ -73,7 +73,6 @@ public class NarTestMojo
// run if requested
if ( test.shouldRun() )
{
- // FIXME NAR-90
String name = getTestTargetDirectory().getPath() + "/bin/" + getAOL() + "/" + test.getName();
getLog().info( "Running test " + name );
@@ -155,7 +154,6 @@ public class NarTestMojo
// of getBaseVersion, called in pathOf.
dependency.isSnapshot();
- // FIXED NAR-90
File libDirectory =
getLayout().getLibDirectory( getNarManager().getUnpackDirectory( dependency ),
dependency.getArtifactId(), dependency.getVersion(), getAOL().toString(),