Skip to Content.
Sympa Menu

notify-dpml - r1545 - in trunk/main/depot: build/src/main/net/dpml/library/console library/src/main/net/dpml/library/impl library/src/test/net/dpml/library/impl

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1545 - in trunk/main/depot: build/src/main/net/dpml/library/console library/src/main/net/dpml/library/impl library/src/test/net/dpml/library/impl
  • Date: Thu, 13 Jul 2006 08:05:57 +0200

Author: mcconnell
Date: 2006-07-13 08:05:39 +0200 (Thu, 13 Jul 2006)
New Revision: 1545

Modified:
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java

trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java

trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java

trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
Log:
resolve issue related to module dependencies (cont.)

Modified:
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
===================================================================
---
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
2006-07-13 02:51:16 UTC (rev 1544)
+++
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
2006-07-13 06:05:39 UTC (rev 1545)
@@ -70,6 +70,7 @@
private final Map m_map = new Hashtable();

private boolean m_verbose;
+ private boolean m_expand = false;

//
------------------------------------------------------------------------
// constructors
@@ -119,6 +120,7 @@

if( line.hasOption( LIST_OPTION ) )
{
+ m_expand = line.hasOption( EXPAND_OPTION );
Resource[] resources = getTargetSelection( line );
if( resources.length == 0 )
{
@@ -446,7 +448,7 @@
}
}

- Resource[] resources = resource.getProviders( Scope.BUILD, false,
true );
+ Resource[] resources = resource.getProviders( Scope.BUILD, m_expand,
true );
if( resources.length > 0 )
{
print( pad + "build phase providers: (" + resources.length + ")"
);
@@ -456,7 +458,8 @@
print( p + res );
}
}
- resources = resource.getProviders( Scope.RUNTIME, false, true );
+ resources = resource.getProviders( Scope.RUNTIME, m_expand, true );
+ //resources = resource.getClasspathProviders( Scope.RUNTIME );
if( resources.length > 0 )
{
print( pad + "runtime providers: (" + resources.length + ")" );
@@ -466,7 +469,8 @@
print( p + res );
}
}
- resources = resource.getProviders( Scope.TEST, false, true );
+ resources = resource.getProviders( Scope.TEST, m_expand, true );
+ //resources = resource.getClasspathProviders( Scope.TEST );
if( resources.length > 0 )
{
print( pad + "test providers: (" + resources.length + ")" );
@@ -583,6 +587,14 @@
.create() )
.create();

+ private static final Option EXPAND_OPTION =
+ OPTION_BUILDER
+ .withShortName( "expand" )
+ .withShortName( "e" )
+ .withDescription( "Expand dependencies." )
+ .withRequired( false )
+ .create();
+
private static final Option CONSUMERS_OPTION =
OPTION_BUILDER
.withShortName( "consumers" )
@@ -629,6 +641,7 @@
GROUP_BUILDER
.withMinimum( 0 )
.withOption( LIST_OPTION )
+ .withOption( EXPAND_OPTION )
.withOption( CONSUMERS_OPTION )
.create();


Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-07-13 02:51:16 UTC (rev 1544)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-07-13 06:05:39 UTC (rev 1545)
@@ -434,7 +434,7 @@
DefaultResource[] getLocalDefaultProviders( final Scope scope, final
Category category )
{
DefaultResource[] local = super.getLocalDefaultProviders( scope,
category );
- if( Scope.RUNTIME.equals( scope ) )
+ if( Scope.BUILD.equals( scope ) )
{
ArrayList stack = new ArrayList();
for( int i=0; i<local.length; i++ )
@@ -442,6 +442,16 @@
DefaultResource resource = local[i];
stack.add( resource );
}
+ return expandLocalDefaultProviders( stack );
+ }
+ else if( Scope.RUNTIME.equals( scope ) )
+ {
+ ArrayList stack = new ArrayList();
+ for( int i=0; i<local.length; i++ )
+ {
+ DefaultResource resource = local[i];
+ stack.add( resource );
+ }

DefaultResource[] resources = getDefaultResources();
for( int i=0; i<resources.length; i++ )
@@ -452,8 +462,7 @@
stack.add( resource );
}
}
-
- return expandLocalDefaultProviders( stack );
+ return (DefaultResource[]) stack.toArray( new DefaultResource[0]
);
}
else
{
@@ -470,13 +479,18 @@
if( resource instanceof DefaultModule )
{
DefaultModule module = (DefaultModule) resource;
- DefaultResource[] providers =
module.expandLocalDefaultProviders( stack );
- for( int j=0; j<providers.length; j++ )
+ String path = module.getResourcePath();
+ if( !path.startsWith( getResourcePath() ) )
+ //if( !getResourcePath().startsWith( path ) )
{
- DefaultResource r = providers[j];
- if( !stack.contains( r ) )
+ DefaultResource[] providers =
module.expandLocalDefaultProviders( stack );
+ for( int j=0; j<providers.length; j++ )
{
- stack.add( r );
+ DefaultResource r = providers[j];
+ if( !stack.contains( r ) )
+ {
+ stack.add( r );
+ }
}
}
}
@@ -498,9 +512,14 @@
if( !resource.isAnonymous() )
{
DefaultModule parent = resource.getDefaultParent();
- if( !stack.contains( parent ) && !this.equals( parent ) )
+ if( null != parent )
{
- stack.add( parent );
+ String path = parent.getResourcePath();
+ if( !getResourcePath().startsWith( path ) &&
!stack.contains( parent ) )
+ if( !path.startsWith( getResourcePath() ) &&
!stack.contains( parent ) )
+ {
+ stack.add( parent );
+ }
}
}
}

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-07-13 02:51:16 UTC (rev 1544)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-07-13 06:05:39 UTC (rev 1545)
@@ -634,10 +634,17 @@
*/
public Resource[] getClasspathProviders( final Scope scope )
{
- final boolean expanded = true;
- final boolean sorted = true;
- final boolean filtered = true;
- return getAggregatedDefaultProviders( scope, expanded, sorted,
filtered );
+ DefaultResource[] result = getAggregatedDefaultProviders( scope,
true, true, true );
+ List stack = new ArrayList();
+ for( int i=0; i<result.length; i++ )
+ {
+ DefaultResource resource = result[i];
+ if( resource.isa( "jar" ) )
+ {
+ stack.add( resource );
+ }
+ }
+ return (DefaultResource[]) stack.toArray( new DefaultResource[0] );
}

/**
@@ -904,10 +911,10 @@
}

DefaultResource[] getAggregatedDefaultProviders(
- final Scope scope, final boolean expanded, final boolean sort, final
boolean filtered )
+ final Scope scope, final boolean expanded, final boolean sort, final
boolean flag )
{
DefaultResource[] resources =
- getAggregatedDefaultProviders( scope, expanded, filtered );
+ getAggregatedDefaultProviders( scope, expanded, flag );
if( sort )
{
return sortDefaultResources( resources, scope );
@@ -920,10 +927,10 @@
}

DefaultResource[] getAggregatedDefaultProviders(
- final Scope scope, final boolean expanded, final boolean filtered )
+ final Scope scope, final boolean expanded, final boolean flag )
{
ArrayList list = new ArrayList();
- if( !filtered )
+ if( !flag )
{
aggregateProviders( list, Scope.BUILD );
}
@@ -943,23 +950,10 @@
for( int i=0; i<result.length; i++ )
{
DefaultResource resource = result[i];
- processDefaultResource( visited, stack, scope, true,
resource );
+ expandDefaultResource( visited, stack, scope, resource );
}
result = (DefaultResource[]) stack.toArray( new
DefaultResource[0] );
}
- if( filtered )
- {
- List stack = new ArrayList();
- for( int i=0; i<result.length; i++ )
- {
- DefaultResource resource = result[i];
- if( resource.isa( "jar" ) )
- {
- stack.add( resource );
- }
- }
- result = (DefaultResource[]) stack.toArray( new
DefaultResource[0] );
- }
return result;
}

@@ -1002,9 +996,9 @@
DefaultResource provider = providers[i];
if( expand )
{
- processDefaultResource( visited, stack, scope, false,
provider );
+ expandDefaultResource( visited, stack, scope, provider );
}
- else
+ else if( !stack.contains( provider ) )
{
stack.add( provider );
}
@@ -1112,9 +1106,8 @@
}
}

- private void processDefaultResource(
- final List visited, final List stack, final Scope scope, final boolean
expand,
- final DefaultResource resource )
+ private void expandDefaultResource(
+ final List visited, final List stack, final Scope scope, final
DefaultResource resource )
{
if( visited.contains( resource ) )
{
@@ -1123,10 +1116,12 @@
else
{
visited.add( resource );
- DefaultResource[] providers =
resource.getAggregatedDefaultProviders( scope, false, false );
+ boolean flag = !scope.equals( Scope.BUILD );
+ DefaultResource[] providers =
resource.getAggregatedDefaultProviders( scope, false, flag );
for( int i=0; i<providers.length; i++ )
{
- processDefaultResource( visited, stack, scope, expand,
providers[i] );
+ DefaultResource provider = providers[i];
+ expandDefaultResource( visited, stack, scope, provider );
}
stack.add( resource );
}
@@ -1268,9 +1263,9 @@
for( int i=0; i<resources.length; i++ )
{
DefaultResource resource = resources[i];
- if( !list.contains( resource ) )
+ if( resource.isa( "jar" ) && !list.contains( resource ) )
{
- stack.add( resources[i] );
+ stack.add( resource );
}
}


Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java
2006-07-13 02:51:16 UTC (rev 1544)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java
2006-07-13 06:05:39 UTC (rev 1545)
@@ -122,8 +122,10 @@
try
{
String path = "dpml";
- doProviderTest( path, false, 0, 9, 0 );
- doProviderTest( path, true, 0, 39, 0 );
+ //doProviderTest( path, false, 8, 4, 0 );
+ //doProviderTest( path, true, 8, 39, 0 );
+ doProviderTest( path, false );
+ doProviderTest( path, true );
}
catch( Exception e )
{
@@ -132,8 +134,10 @@
try
{
String path = "dpml/transit";
- doProviderTest( path, false, 0, 4, 0 );
- doProviderTest( path, true, 0, 8, 0 );
+ //doProviderTest( path, false, 2, 2, 0 );
+ //doProviderTest( path, true, 2, 4, 0 );
+ doProviderTest( path, false );
+ doProviderTest( path, true );
}
catch( Exception e )
{

Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
2006-07-13 02:51:16 UTC (rev 1544)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
2006-07-13 06:05:39 UTC (rev 1545)
@@ -199,8 +199,10 @@
try
{
String path = "dpml/metro/dpml-composition-runtime";
- doProviderTest( path, false, 0, 6, 0 );
- doProviderTest( path, true, 0, 12, 0 );
+ //doProviderTest( path, false, 0, 6, 0 );
+ //doProviderTest( path, true, 0, 12, 0 );
+ doProviderTest( path, false );
+ doProviderTest( path, true );
}
catch( Exception e )
{
@@ -209,8 +211,10 @@
try
{
String path = "dpml/transit/dpml-transit-tools";
- doProviderTest( path, false, 0, 2, 1 );
- doProviderTest( path, true, 0, 3, 4 );
+ //doProviderTest( path, false, 0, 2, 1 );
+ //doProviderTest( path, true, 0, 3, 4 );
+ doProviderTest( path, false );
+ doProviderTest( path, true );
}
catch( Exception e )
{
@@ -219,8 +223,10 @@
try
{
String path = "dpml/metro/dpml-component-model";
- doProviderTest( path, false, 0, 4, 4 );
- doProviderTest( path, true, 0, 5, 11 );
+ //doProviderTest( path, false, 0, 4, 4 );
+ //doProviderTest( path, true, 0, 5, 11 );
+ doProviderTest( path, false );
+ doProviderTest( path, true );
}
catch( Exception e )
{




  • r1545 - in trunk/main/depot: build/src/main/net/dpml/library/console library/src/main/net/dpml/library/impl library/src/test/net/dpml/library/impl, mcconnell at BerliOS, 07/13/2006

Archive powered by MHonArc 2.6.24.

Top of Page