notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r1563 - in development/main/magic/core/src/main/net/dpml/magic: . model tasks
- From: mcconnell AT netcompartner.com
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r1563 - in development/main/magic/core/src/main/net/dpml/magic: . model tasks
- Date: Sun, 23 Jan 2005 15:36:50 +0100
Author: mcconnell
Date: Sun Jan 23 15:36:49 2005
New Revision: 1563
Modified:
development/main/magic/core/src/main/net/dpml/magic/Index.java
development/main/magic/core/src/main/net/dpml/magic/model/Info.java
development/main/magic/core/src/main/net/dpml/magic/tasks/ModuleTask.java
Log:
Fix a bug related to module dependency uri handling.
Modified: development/main/magic/core/src/main/net/dpml/magic/Index.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/Index.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/Index.java Sun
Jan 23 15:36:49 2005
@@ -588,7 +588,7 @@
throw new BuildException( mess );
}
- Info info = Info.create( moduleUri );
+ Info info = createInfo( moduleUri );
String key = info.getName();
if( m_resources.containsKey( key ) )
@@ -601,7 +601,11 @@
else
{
final String error =
- "Source index or module [" + source + "] declares the key
[" + key + "] that is already bound.";
+ "Source index or module ["
+ + source
+ + "] declares the key ["
+ + key
+ + "] that is already bound.";
throw new BuildException( error );
}
}
@@ -633,11 +637,23 @@
Module module = new Module( this, key, info, refs, "key:NULL",
header, children );
m_resources.put( key, module );
- log( "resource: " + module, Project.MSG_VERBOSE );
+ log( "module: " + module, Project.MSG_VERBOSE );
return module;
}
+ private Info createInfo( String uri )
+ {
+ try
+ {
+ return Info.create( uri );
+ }
+ catch( Exception e )
+ {
+ throw new BuildException( e );
+ }
+ }
+
private File resolveIndex( File file )
{
if( file.isDirectory() )
Modified: development/main/magic/core/src/main/net/dpml/magic/model/Info.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Info.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Info.java Sun
Jan 23 15:36:49 2005
@@ -17,7 +17,10 @@
package net.dpml.magic.model;
+import java.net.URISyntaxException;
+
import net.dpml.lang.NullArgumentException;
+import net.dpml.transit.artifact.Artifact;
import org.apache.tools.ant.BuildException;
@@ -45,8 +48,16 @@
* @param id the artiact identifier
* @return the immutable info descriptor
*/
- public static Info create( final String id )
+ public static Info create( final String id ) throws URISyntaxException
{
+ Artifact artifact = Artifact.createArtifact( id );
+ final String group = artifact.getGroup();
+ final String name = artifact.getName();
+ final String version = artifact.getVersion();
+ final String type = artifact.getType();
+ return create( group, name, version, type,
SNAPSHOT.equalsIgnoreCase( version ) );
+
+ /*
final int i = id.indexOf( ":" );
if( i<0 )
{
@@ -57,6 +68,7 @@
final String protocol = id.substring( 0, i );
final String spec = id.substring( i+1 );
return Info.create( protocol, spec );
+ */
}
/**
@@ -66,6 +78,7 @@
* @param id the artiact identifier
* @return the immutable info descriptor
*/
+ /*
public static Info create( final String type, final String id )
{
final int n = getGroupIndex( id );
@@ -76,6 +89,7 @@
group, name, version, type,
SNAPSHOT.equalsIgnoreCase( version ) );
}
+ */
/**
* Creation of a new info instance relative to a supplied set of
parameters.
Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/ModuleTask.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/tasks/ModuleTask.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/tasks/ModuleTask.java
Sun Jan 23 15:36:49 2005
@@ -278,7 +278,7 @@
/**
* Add the resource referenced by the ref to the list and for all of the
- * runtime dependencies of the resource, axpand them into the list.
+ * runtime dependencies of the resource, expand them into the list.
*
* @param definition the current module definition
* @param reference the resource reference to expand
@@ -288,12 +288,37 @@
private void expand( Definition definition, ResourceRef reference, List
list, List modules )
{
Resource resource = getPrivateIndex().getResource( reference );
- String module = resource.getModule();
- if(( null != module ) && !"".equals( module ) && !modules.contains(
module ) )
+ if( "module".equals( resource.getInfo().getType() ) )
{
- if( !module.equals( definition.getInfo().getURI() ) )
+ String uri = resource.getInfo().getURI();
+ if( !modules.contains( uri ) )
{
- modules.add( module );
+ modules.add( uri );
+ }
+ }
+ else
+ {
+ String module = resource.getModule();
+ if(( null != module ) && !"".equals( module ) &&
!modules.contains( module ) )
+ {
+ if( !module.equals( definition.getInfo().getURI() ) )
+ {
+ modules.add( module );
+ ResourceRef[] refs =
+ resource.getResourceRefs();
+ for( int i=0; i<refs.length; i++ )
+ {
+ ResourceRef ref = refs[i];
+ if( ref.getPolicy().matches( Policy.RUNTIME ) )
+ {
+ expand( definition, ref, list, modules );
+ }
+ }
+ }
+ }
+ else if( !(resource instanceof Definition ) && !list.contains(
resource ) )
+ {
+ list.add( resource );
ResourceRef[] refs =
resource.getResourceRefs();
for( int i=0; i<refs.length; i++ )
@@ -306,20 +331,6 @@
}
}
}
- else if( !(resource instanceof Definition ) && !list.contains(
resource ) )
- {
- list.add( resource );
- ResourceRef[] refs =
- resource.getResourceRefs();
- for( int i=0; i<refs.length; i++ )
- {
- ResourceRef ref = refs[i];
- if( ref.getPolicy().matches( Policy.RUNTIME ) )
- {
- expand( definition, ref, list, modules );
- }
- }
- }
}
/**
- svn commit: r1563 - in development/main/magic/core/src/main/net/dpml/magic: . model tasks, mcconnell, 01/23/2005
Archive powered by MHonArc 2.6.24.