summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-01 21:55:04 +0100
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-01 21:55:04 +0100
commit4f5f88c356ed02b8135c7b4b03a816dbe8f975b8 (patch)
tree13bad0a12a2c342897d8638eeaa21740ab223155 /src/main
parent3eff363d20e095c82a5a57220e681ed9c7c0cf65 (diff)
downloadmaven-nar-plugin-4f5f88c356ed02b8135c7b4b03a816dbe8f975b8.tar.gz
maven-nar-plugin-4f5f88c356ed02b8135c7b4b03a816dbe8f975b8.tar.bz2
maven-nar-plugin-4f5f88c356ed02b8135c7b4b03a816dbe8f975b8.tar.xz
maven-nar-plugin-4f5f88c356ed02b8135c7b4b03a816dbe8f975b8.zip
Fixed target part (include) for NAR-90
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java3
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/DefaultNarLayout.java13
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java5
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarLayout.java13
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java29
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java2
6 files changed, 46 insertions, 19 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java b/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
index b98a8cb..9e624db 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
@@ -81,8 +81,7 @@ public abstract class AbstractResourcesMojo
File includeDir = new File( srcDir, resourceIncludeDir );
if ( includeDir.exists() )
{
- // FIXME NAR-90
- File includeDstDir = new File( getTargetDirectory(), "include" );
+ File includeDstDir = getLayout().getIncludeDirectory( getTargetDirectory() );
getLog().debug( "Copying includes from " + includeDir + " to " + includeDstDir );
copied += NarUtil.copyDirectoryStructure( includeDir, includeDstDir, null, NarUtil.DEFAULT_EXCLUDES );
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/DefaultNarLayout.java b/src/main/java/org/apache/maven/plugin/nar/DefaultNarLayout.java
index cf77e08..719e906 100644
--- a/src/main/java/org/apache/maven/plugin/nar/DefaultNarLayout.java
+++ b/src/main/java/org/apache/maven/plugin/nar/DefaultNarLayout.java
@@ -32,7 +32,7 @@ public class DefaultNarLayout
return new File( baseDir, "aol" );
}
- private File getNoarchDirectory( File baseDir )
+ public File getNoarchDirectory( File baseDir )
{
return new File( baseDir, "noarch" );
}
@@ -44,6 +44,17 @@ public class DefaultNarLayout
/*
* (non-Javadoc)
+ * @see org.apache.maven.plugin.nar.NarLayout#getIncludeDirectory(java.io.File)
+ */
+ public File getIncludeDirectory( File baseDir )
+ {
+ File dir = getNoarchDirectory( baseDir );
+ dir = new File( dir, "include" );
+ return dir;
+ }
+
+ /*
+ * (non-Javadoc)
* @see org.apache.maven.plugin.nar.NarLayout#getLibDir(org.apache.maven.plugin.nar.AOL, java.lang.String)
*/
public File getLibDirectory( File baseDir, String aol, String type )
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 cefc224..88f7267 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
@@ -84,7 +84,7 @@ public class NarCompileMojo
try
{
// FIXME, should the include paths be defined at a higher level ?
- getCpp().copyIncludeFiles( getMavenProject(), new File( getTargetDirectory(), "include" ) );
+ getCpp().copyIncludeFiles( getMavenProject(), getLayout().getIncludeDirectory( getTargetDirectory() ) );
}
catch ( IOException e )
{
@@ -142,6 +142,7 @@ public class NarCompileMojo
outDir.mkdirs();
// outFile
+ // FIXME NAR-90 we could get the final name from layout
File outFile;
if ( type.equals( Library.EXECUTABLE ) )
{
@@ -264,7 +265,7 @@ public class NarCompileMojo
File dir = new File( getNarManager().getNarFile( dependency ).getParentFile(), "nar" );
// FIXME NAR-90
// dir = getLayout().getLibDirectory( dir, aol, binding );
- dir = new File(dir, "lib/"+aol.toString()+"/"+binding);
+ dir = new File( dir, "lib/" + aol.toString() + "/" + binding );
getLog().debug( "Looking for Library Directory: " + dir );
if ( dir.exists() )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarLayout.java b/src/main/java/org/apache/maven/plugin/nar/NarLayout.java
index 5c722a1..fe1a5e4 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarLayout.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarLayout.java
@@ -31,6 +31,13 @@ import java.io.File;
public interface NarLayout
{
/**
+ * Specified wgere the noarch specific includes are unpacked
+ *
+ * @return
+ */
+ public File getNoarchDirectory( File baseDir );
+
+ /**
* Specifies where the aol specific libs are unpacked
*
* @return
@@ -43,4 +50,10 @@ public interface NarLayout
* @return
*/
public File getLibDirectory(File baseDir, String aol, String type);
+
+ /**
+ * Specifies where includes are stored
+ * @return
+ */
+ public File getIncludeDirectory( File targetDirectory );
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
index 6937a4b..fcecec9 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
@@ -59,11 +59,16 @@ public class NarPackageMojo
getMavenProject().getArtifact().setArtifactHandler( new NarArtifactHandler() );
// noarch
- // FIXME NAR-90
- String include = "include";
- if ( new File( getTargetDirectory(), include ).exists() )
+ File noarchDir = getLayout().getNoarchDirectory( getTargetDirectory() );
+ if ( noarchDir.exists() )
{
- attachNarOld( "include", null, NAR_NO_ARCH );
+ String type = noarchDir.getName();
+ attachNar( noarchDir, type );
+ getNarInfo().setNar(
+ null,
+ type,
+ getMavenProject().getGroupId() + ":" + getMavenProject().getArtifactId() + ":"
+ + NAR_TYPE + ":" + type );
}
// create nar with binaries
@@ -90,7 +95,12 @@ public class NarPackageMojo
String[] subDirs = aolDirectory.list();
for ( int j = 0; j < ( subDirs != null ? subDirs.length : 0 ); j++ )
{
- attachNar( new File( aolDirectory, subDirs[j] ), subDirs[j], type );
+ attachNar( new File( aolDirectory, subDirs[j] ), subDirs[j] );
+ getNarInfo().setNar(
+ null,
+ type,
+ getMavenProject().getGroupId() + ":" + getMavenProject().getArtifactId() + ":"
+ + NAR_TYPE + ":" + "${aol}-" + type );
}
}
@@ -118,26 +128,19 @@ public class NarPackageMojo
}
}
- private String getNarReference( String type )
- {
- return getMavenProject().getGroupId() + ":" + getMavenProject().getArtifactId() + ":" + NAR_TYPE + ":"
- + "${aol}-" + type;
- }
-
/**
* @param file
* @param string
* @param type
* @throws MojoExecutionException
*/
- private void attachNar( File dir, String string, String type )
+ private void attachNar( File dir, String string )
throws MojoExecutionException
{
String aolType = dir.getName();
File narFile = new File( getOutputDirectory(), getFinalName() + "-" + dir.getName() + "." + NAR_EXTENSION );
nar( narFile, dir );
projectHelper.attachArtifact( getMavenProject(), NAR_TYPE, aolType, narFile );
- getNarInfo().setNar( null, type, getNarReference( type ) );
}
private void attachNarOld( String dir, String aol, String type )
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 2b1d95a..34514d1 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
@@ -130,7 +130,7 @@ public class NarTestCompileMojo
// FIXME hardcoded values
String libName = getFinalName();
- File includeDir = new File( getMavenProject().getBuild().getDirectory(), "nar/include" );
+ File includeDir = getLayout().getIncludeDirectory( super.getTargetDirectory() );
File libDir = getLayout().getLibDirectory( super.getTargetDirectory(), getAOL().toString(), test.getLink() );
// copy shared library