summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorVolker Schumacher <volker@antenna500.local>2010-01-05 08:43:32 +0800
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2010-01-08 00:13:05 +0800
commit54f79a2d6b0227fa6116f0b6d8ead5094f4b7e02 (patch)
tree5d77f238b2666a48034ffb4cbf0a838f5eb7c8ac /src/main
parent742f18fe81440725ed04a29455f04ea9af7341b3 (diff)
downloadmaven-nar-plugin-54f79a2d6b0227fa6116f0b6d8ead5094f4b7e02.tar.gz
maven-nar-plugin-54f79a2d6b0227fa6116f0b6d8ead5094f4b7e02.tar.bz2
maven-nar-plugin-54f79a2d6b0227fa6116f0b6d8ead5094f4b7e02.tar.xz
maven-nar-plugin-54f79a2d6b0227fa6116f0b6d8ead5094f4b7e02.zip
made linking of tests more similar to linking of main binaries.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java77
1 files changed, 64 insertions, 13 deletions
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 921aef7..266adfc 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
@@ -27,11 +27,14 @@ import java.util.List;
import net.sf.antcontrib.cpptasks.CCTask;
import net.sf.antcontrib.cpptasks.CUtil;
import net.sf.antcontrib.cpptasks.CompilerDef;
+import net.sf.antcontrib.cpptasks.LinkerDef;
import net.sf.antcontrib.cpptasks.OutputTypeEnum;
import net.sf.antcontrib.cpptasks.RuntimeType;
import net.sf.antcontrib.cpptasks.SubsystemEnum;
import net.sf.antcontrib.cpptasks.types.LibrarySet;
import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
+import net.sf.antcontrib.cpptasks.types.LinkerArgument;
+import net.sf.antcontrib.cpptasks.types.SystemLibrarySet;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
@@ -150,7 +153,9 @@ public class NarTestCompileMojo
}
// add linker
- task.addConfiguredLinker( getLinker().getLinker( this, antProject, getOS(), getAOL().getKey() + "linker.", type ) );
+ LinkerDef linkerDefinition =
+ getLinker().getLinker( this, antProject, getOS(), getAOL().getKey() + ".linker.", type );
+ task.addConfiguredLinker( linkerDefinition );
// FIXME hardcoded values
String libName = getFinalName();
@@ -230,20 +235,66 @@ public class NarTestCompileMojo
for ( Iterator i = depLibs.iterator(); i.hasNext(); )
{
+ NarArtifact dependency = (NarArtifact) i.next();
- Artifact dependency = (Artifact) i.next();
- // FIXME: this should be preferred binding
- File libDirectory =
- getLayout().getLibDirectory( getUnpackDirectory(), dependency.getArtifactId(), dependency.getVersion(),
- getAOL().toString(), test.getLink() );
- if ( libDirectory.exists() )
+ // FIXME no handling of "local"
+
+ // FIXME, no way to override this at this stage
+ String binding = dependency.getNarInfo().getBinding( getAOL(), Library.NONE );
+ getLog().debug( "Using Binding: " + binding );
+ AOL aol = getAOL();
+ aol = dependency.getNarInfo().getAOL( getAOL() );
+ getLog().debug( "Using Library AOL: " + aol.toString() );
+
+ if ( !binding.equals( Library.JNI ) && !binding.equals( Library.NONE ) )
{
- LibrarySet libset = new LibrarySet();
- libset.setProject( antProject );
- libset.setLibs( new CUtil.StringArrayBuilder( dependency.getArtifactId() + "-"
- + dependency.getVersion() ) );
- libset.setDir( libDirectory );
- task.addLibset( libset );
+ File unpackDirectory = getUnpackDirectory();
+
+ File dir =
+ getLayout().getLibDirectory( unpackDirectory, dependency.getArtifactId(),
+ dependency.getVersion(), aol.toString(), binding );
+
+ getLog().debug( "Looking for Library Directory: " + dir );
+ if ( dir.exists() )
+ {
+ LibrarySet libSet = new LibrarySet();
+ libSet.setProject( antProject );
+
+ // FIXME, no way to override
+ String libs = dependency.getNarInfo().getLibs( getAOL() );
+ if ( ( libs != null ) && !libs.equals( "" ) )
+ {
+ getLog().debug( "Using LIBS = " + libs );
+ libSet.setLibs( new CUtil.StringArrayBuilder( libs ) );
+ libSet.setDir( dir );
+ task.addLibset( libSet );
+ }
+ }
+ else
+ {
+ getLog().debug( "Library Directory " + dir + " does NOT exist." );
+ }
+
+ // FIXME, look again at this, for multiple dependencies we may need to remove duplicates
+ String options = dependency.getNarInfo().getOptions( getAOL() );
+ if ( ( options != null ) && !options.equals( "" ) )
+ {
+ getLog().debug( "Using OPTIONS = " + options );
+ LinkerArgument arg = new LinkerArgument();
+ arg.setValue( options );
+ linkerDefinition.addConfiguredLinkerArg( arg );
+ }
+
+ String sysLibs = dependency.getNarInfo().getSysLibs( getAOL() );
+ if ( ( sysLibs != null ) && !sysLibs.equals( "" ) )
+ {
+ getLog().debug( "Using SYSLIBS = " + sysLibs );
+ SystemLibrarySet sysLibSet = new SystemLibrarySet();
+ sysLibSet.setProject( antProject );
+
+ sysLibSet.setLibs( new CUtil.StringArrayBuilder( sysLibs ) );
+ task.addSyslibset( sysLibSet );
+ }
}
}