}
// add library of this package
if ( libDir.exists() )
{
LibrarySet libSet = new LibrarySet();
libSet.setProject( antProject );
libSet.setLibs( new CUtil.StringArrayBuilder( libName ) );
LibraryTypeEnum libType = new LibraryTypeEnum();
libType.setValue( test.getLink() );
libSet.setType( libType );
libSet.setDir( libDir );
task.addLibset( libSet );
}
// add dependency libraries
List depLibOrder = getDependencyLibOrder();
List depLibs = getNarManager().getNarDependencies( "test" );
// reorder the libraries that come from the nar dependencies
// to comply with the order specified by the user
if ( ( depLibOrder != null ) && !depLibOrder.isEmpty() )
{
List tmp = new LinkedList();
for ( Iterator i = depLibOrder.iterator(); i.hasNext(); )
{
String depToOrderName = (String) i.next();
for ( Iterator j = depLibs.iterator(); j.hasNext(); )
{
NarArtifact dep = (NarArtifact) j.next();
String depName = dep.getGroupId() + ":" + dep.getArtifactId();
if ( depName.equals( depToOrderName ) )
{
tmp.add( dep );
j.remove();
}
}
}
tmp.addAll( depLibs );
depLibs = tmp;
}
for ( Iterator i = depLibs.iterator(); i.hasNext(); )
{
NarArtifact dependency = (NarArtifact) i.next();
// 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 ) )
{
// check if it exists in the normal unpack directory
File dir =
getLayout().getLibDirectory( getUnpackDirectory(), dependency.getArtifactId(),
dependency.getVersion(), aol.toString(), binding );
getLog().debug( "Looking for Library Directory: " + dir );
if ( !dir.exists() )
{
getLog().debug( "Library Directory " + dir + " does NOT exist." );
// otherwise try the test unpack directory
dir = getLayout().getLibDirectory( getTestUnpackDirectory(), 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
{