avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject svn commit: rev 20909 - in avalon/trunk: central/system central/system/build runtime runtime/logging/api runtime/logging/spi runtime/repository runtime/repository/api runtime/repository/api/src/java/org/apache/avalon/repository runtime/repository/cli runtime/repository/impl runtime/repository/main runtime/repository/main/etc runtime/repository/main/etc/main runtime/repository/spi runtime/repository/test runtime/repository/test/etc runtime/repository/test/etc/test runtime/repository/test/etc/test/unit runtime/repository/test/src/test/org/apache/avalon/repository/main runtime/repository/util runtime/util tools/project/core/src/main/org/apache/avalon/tools/home tools/project/core/src/main/org/apache/avalon/tools/project tools/project/core/src/main/org/apache/avalon/tools/tasks tools/project/core/src/main/org/apache/avalon/tools/util
Date Tue, 08 Jun 2004 14:10:10 GMT
Author: mcconnell
Date: Tue Jun  8 07:10:09 2004
New Revision: 20909

Added:
   avalon/trunk/runtime/build-legacy-version.xml
      - copied unchanged from rev 20872, avalon/trunk/runtime/build.xml
   avalon/trunk/runtime/logging/api/build.xml   (contents, props changed)
   avalon/trunk/runtime/logging/spi/gump-build.xml
      - copied unchanged from rev 20872, avalon/trunk/runtime/logging/spi/build.xml
   avalon/trunk/runtime/repository/api/build.properties   (contents, props changed)
   avalon/trunk/runtime/repository/api/build.xml   (contents, props changed)
   avalon/trunk/runtime/repository/build.properties   (contents, props changed)
   avalon/trunk/runtime/repository/build.xml   (contents, props changed)
   avalon/trunk/runtime/repository/cli/build.properties   (contents, props changed)
   avalon/trunk/runtime/repository/cli/build.xml   (contents, props changed)
   avalon/trunk/runtime/repository/impl/build.properties   (contents, props changed)
   avalon/trunk/runtime/repository/impl/build.xml   (contents, props changed)
   avalon/trunk/runtime/repository/main/build.properties   (contents, props changed)
   avalon/trunk/runtime/repository/main/build.xml   (contents, props changed)
   avalon/trunk/runtime/repository/main/etc/
   avalon/trunk/runtime/repository/main/etc/main/
   avalon/trunk/runtime/repository/main/etc/main/avalon.properties   (contents, props changed)
   avalon/trunk/runtime/repository/spi/build.properties   (contents, props changed)
   avalon/trunk/runtime/repository/spi/build.xml   (contents, props changed)
   avalon/trunk/runtime/repository/test/build.properties   (contents, props changed)
   avalon/trunk/runtime/repository/test/build.xml   (contents, props changed)
   avalon/trunk/runtime/repository/test/etc/
   avalon/trunk/runtime/repository/test/etc/test/
   avalon/trunk/runtime/repository/test/etc/test/unit/
   avalon/trunk/runtime/repository/test/etc/test/unit/system.xml   (contents, props changed)
   avalon/trunk/runtime/repository/util/build.xml   (contents, props changed)
Removed:
   avalon/trunk/runtime/build.xml
   avalon/trunk/runtime/logging/spi/build.xml
Modified:
   avalon/trunk/central/system/build/standard.xml
   avalon/trunk/central/system/index.xml
   avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/Artifact.java
   avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/ArtifactURLConnection.java
   avalon/trunk/runtime/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextFactoryTestCase.java
   avalon/trunk/runtime/util/build.properties
   avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Repository.java
   avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Policy.java
   avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java
   avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/util/ElementHelper.java
Log:
Add support to get repository buildable using project tools.

Modified: avalon/trunk/central/system/build/standard.xml
==============================================================================
--- avalon/trunk/central/system/build/standard.xml	(original)
+++ avalon/trunk/central/system/build/standard.xml	Tue Jun  8 07:10:09 2004
@@ -3,11 +3,15 @@
 
   <x:home/>
 
-  <target name="clean">
+  <target name="init">
+    <x:info/>
+  </target>
+
+  <target name="clean" depends="init">
     <x:clean/>
   </target>
 
-  <target name="prepare" depends="">
+  <target name="prepare" depends="init">
     <x:prepare/>
   </target>
 

Modified: avalon/trunk/central/system/index.xml
==============================================================================
--- avalon/trunk/central/system/index.xml	(original)
+++ avalon/trunk/central/system/index.xml	Tue Jun  8 07:10:09 2004
@@ -78,6 +78,15 @@
       </info>
     </resource>
 
+    <resource>
+      <info>
+        <group>commons-cli</group>
+        <name>commons-cli</name>
+        <version>1.0</version>
+        <type>jar</type>
+      </info>
+    </resource>
+
   </resources>
 
   <!--
@@ -292,6 +301,106 @@
         <taskdef name="meta" class="org.apache.avalon.meta.info.MetaTask"/>
       </tasks>
     </plugin>
+
+    <!--
+    Avalon Repository.
+    -->
+
+    <project basedir="../../runtime/repository/api">
+      <info>
+        <group>avalon/repository</group>
+        <name>avalon-repository-api</name>
+        <version>2.0.0</version>
+      </info>
+    </project>
+
+    <project basedir="../../runtime/repository/spi">
+      <info>
+        <group>avalon/repository</group>
+        <name>avalon-repository-spi</name>
+        <version>2.0.0</version>
+      </info>
+      <dependencies>
+        <projects>
+          <projectref key="avalon-repository-api"/>
+        </projects>
+      </dependencies>
+    </project>
+
+    <project basedir="../../runtime/repository/util">
+      <info>
+        <group>avalon/repository</group>
+        <name>avalon-repository-util</name>
+        <version>2.0.0</version>
+      </info>
+      <dependencies>
+        <projects>
+          <projectref key="avalon-repository-api"/>
+        </projects>
+      </dependencies>
+    </project>
+
+    <project basedir="../../runtime/repository/impl">
+      <info>
+        <group>avalon/repository</group>
+        <name>avalon-repository-impl</name>
+        <version>2.0.0</version>
+      </info>
+      <dependencies>
+        <projects>
+          <projectref key="avalon-repository-main" runtime="false"/>
+        </projects>
+      </dependencies>
+    </project>
+
+    <project basedir="../../runtime/repository/main">
+      <info>
+        <group>avalon/repository</group>
+        <name>avalon-repository-main</name>
+        <version>2.0.0</version>
+      </info>
+      <dependencies>
+        <projects>
+          <projectref key="avalon-repository-spi"/>
+          <projectref key="avalon-repository-util"/>
+          <projectref key="avalon-util-exception"/>
+          <projectref key="avalon-util-env"/>
+          <projectref key="avalon-util-i18n"/>
+          <projectref key="avalon-util-criteria"/>
+          <projectref key="avalon-util-defaults"/>
+        </projects>
+      </dependencies>
+    </project>
+
+    <project basedir="../../runtime/repository/cli">
+      <info>
+        <group>avalon/repository</group>
+        <name>avalon-repository-cli</name>
+        <version>2.0.0</version>
+      </info>
+      <dependencies>
+        <projects>
+          <projectref key="avalon-repository-main"/>
+        </projects>
+        <resources>
+          <resourceref key="commons-cli"/>
+        </resources>
+      </dependencies>
+    </project>
+
+    <project basedir="../../runtime/repository/test">
+      <info>
+        <group>avalon/repository</group>
+        <name>avalon-repository-test</name>
+        <version>2.0.0</version>
+      </info>
+      <dependencies>
+        <projects>
+          <projectref key="avalon-repository-main"/>
+          <projectref key="avalon-framework-impl"/>
+        </projects>
+      </dependencies>
+    </project>
 
     <!--
     Avalon Logging.

Added: avalon/trunk/runtime/logging/api/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/logging/api/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-logging-api" default="dist" basedir=".">
+  <property file="build.properties"/>
+  <import file="${project.home}/build/standard.xml"/>
+</project>

Added: avalon/trunk/runtime/repository/api/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/api/build.properties	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,3 @@
+project.name = avalon-repository-api
+project.src.main = java
+project.home = ../../../central/system

Added: avalon/trunk/runtime/repository/api/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/api/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-repository-api" default="dist" basedir=".">
+  <property file="build.properties"/>
+  <import file="${project.home}/build/standard.xml"/>
+</project>

Modified: avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/Artifact.java
==============================================================================
--- avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/Artifact.java
(original)
+++ avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/Artifact.java
Tue Jun  8 07:10:09 2004
@@ -142,7 +142,7 @@
     private Artifact( 
       final String group, final String name, 
       final String version, final String type ) 
-    {
+    {
         m_group = group;
         m_name = name;
         m_version = version;
@@ -302,30 +302,12 @@
     * @return the string representation
     */
     public String toString()
-    {
-        if( "block".equals( getType() ) )
-        {
-            return "block:" + getSpecification();
-        }
-        else if( "jar".equals( getType() ) )
-        {
-            return "artifact:" + getSpecification();
-        }
-        else
-        {
-            String path = "artifact:" + getGroup() + "/" + getName();
-            if( getVersion() != null )
-            { 
-                path = path + "#" + getVersion();
-                if( getType() != null ) path = path + "&type=" + getType();
-                return path;
-            }
-            else
-            {
-                if( getType() != null ) path = path + "?type=" + getType();
-                return path;
-            }
-        }
+    {
+        StringBuffer buffer = new StringBuffer( "artifact:" );
+        buffer.append( getType() );
+        buffer.append( ":" );
+        buffer.append( getSpecification() );
+        return buffer.toString();
     }
 
     // ------------------------------------------------------------------------

Modified: avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/ArtifactURLConnection.java
==============================================================================
--- avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/ArtifactURLConnection.java
(original)
+++ avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/ArtifactURLConnection.java
Tue Jun  8 07:10:09 2004
@@ -54,7 +54,7 @@
      {
          try
          {
-             final String path = getURL().getPath();
+             final String path = getPath( url );
              final int i = path.lastIndexOf( "/" );
              final String group = path.substring( 0, i );
              final String name = path.substring( i+1 );
@@ -68,11 +68,34 @@
                "Unexpected exception while resolving url [" + getURL() + "].";
              throw new CascadingIOException( error );
          }
+     }
+
+     private final String getPath( URL url )
+     {
+         final String path = getURL().getPath();
+         int n = path.indexOf( ":" );
+         if( n > -1 )
+         {
+             return path.substring( n+1 );
+         }
+         else
+         {
+             return path;
+         }
      }
 
      private String getType( URL url, String type )
      {
-         return getQueryField( url, "type", type );
+         final String path = getURL().getPath();
+         int n = path.indexOf( ":" );
+         if( n > -1 )
+         {
+             return path.substring( 0, n );
+         }
+         else
+         {
+             return getQueryField( url, "type", type );
+         }
      }
 
 

Added: avalon/trunk/runtime/repository/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/build.properties	Tue Jun  8 07:10:09 2004
@@ -0,0 +1 @@
+project.home = ../../central/system

Added: avalon/trunk/runtime/repository/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="repository" default="build" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <property file="build.properties"/>
+
+  <path id="targets">
+    <fileset dir="." includes="**/build.xml" excludes="build.xml"/>
+  </path>
+
+  <target name="build" depends="">
+    <x:home/>
+    <x:reactor>
+      <path refid="targets"/>
+    </x:reactor>
+  </target>
+
+  <target name="clean" depends="">
+    <subant inheritAll="false" 
+       genericantfile="${project.home}/build/standard.xml" target="clean"
+       buildpathref="targets"/>
+  </target>
+
+</project>

Added: avalon/trunk/runtime/repository/cli/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/cli/build.properties	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,3 @@
+project.name = avalon-repository-cli
+project.src.main = java
+project.home = ../../../central/system

Added: avalon/trunk/runtime/repository/cli/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/cli/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-repository-cli" default="dist" basedir=".">
+  <property file="build.properties"/>
+  <import file="${project.home}/build/standard.xml"/>
+</project>

Added: avalon/trunk/runtime/repository/impl/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/impl/build.properties	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,7 @@
+
+project.name = avalon-repository-impl
+project.src.main = java
+project.home = ../../../central/system
+
+avalon.artifact.factory = org.apache.avalon.repository.impl.DefaultFactory
+avalon.artifact.export = org.apache.avalon.repository.Repository

Added: avalon/trunk/runtime/repository/impl/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/impl/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-repository-impl" default="dist" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <property file="build.properties"/>
+  <import file="${project.home}/build/standard.xml"/>
+
+  <target name="package" depends="standard.package">
+    <x:artifact/>
+  </target>
+
+</project>

Added: avalon/trunk/runtime/repository/main/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/main/build.properties	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,8 @@
+
+project.name = avalon-repository-main
+project.src.main = java
+project.home = ../../../central/system
+
+dpml.url = http://www.dpml.net
+maven.url = http://www.ibiblio.org/maven
+repository.hosts = ${dpml.url},${maven.url}

Added: avalon/trunk/runtime/repository/main/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/main/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-repository-main" default="dist" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <property file="build.properties"/>
+  <import file="${project.home}/build/standard.xml"/>
+  <target name="init" depends="standard.init">
+    <filter token="REPOSITORY_HOSTS" value="${repository.hosts}"/>
+    <x:filter key="avalon-repository-impl" feature="uri" 
+       token="REPOSITORY_IMPLEMENTATION"/>
+  </target>
+
+</project>

Added: avalon/trunk/runtime/repository/main/etc/main/avalon.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/main/etc/main/avalon.properties	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,7 @@
+#===================================================================#
+# Default repository implementation artifact identifier.            #
+#===================================================================#
+
+avalon.repository.implementation = @REPOSITORY_IMPLEMENTATION@
+avalon.repository.hosts = @REPOSITORY_HOSTS@
+

Added: avalon/trunk/runtime/repository/spi/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/spi/build.properties	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,3 @@
+project.name = avalon-repository-spi
+project.src.main = java
+project.home = ../../../central/system

Added: avalon/trunk/runtime/repository/spi/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/spi/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-repository-spi" default="dist" basedir=".">
+  <property file="build.properties"/>
+  <import file="${project.home}/build/standard.xml"/>
+</project>

Added: avalon/trunk/runtime/repository/test/build.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/test/build.properties	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,3 @@
+project.name = avalon-repository-test
+project.src.main = java
+project.home = ../../../central/system

Added: avalon/trunk/runtime/repository/test/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/test/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-repository-test" default="dist" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <property file="build.properties"/>
+  <import file="${project.home}/build/standard.xml"/>
+
+  <target name="init" depends="standard.init">
+    <x:filter key="avalon-repository-impl" feature="uri" 
+       token="REPOSITORY_IMPLEMENTATION"/>
+  </target>
+
+  <target name="install" depends="test"/>
+
+</project>

Added: avalon/trunk/runtime/repository/test/etc/test/unit/system.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/test/etc/test/unit/system.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,8 @@
+<!--
+Configuration used by the DefaultInitialContextFactoryTest to validate the 
+populatation of registered artifacts with the initial context.
+-->
+
+<system>
+  <artifact spec="@REPOSITORY_IMPLEMENTATION@"/>
+</system>
\ No newline at end of file

Modified: avalon/trunk/runtime/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextFactoryTestCase.java
==============================================================================
--- avalon/trunk/runtime/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextFactoryTestCase.java
(original)
+++ avalon/trunk/runtime/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextFactoryTestCase.java
Tue Jun  8 07:10:09 2004
@@ -89,8 +89,8 @@
         // we will override the system cach with the local maven 
         // repository.
         //
-
-        File repo = getMavenRepositoryDirectory();
+
+        File repo = getRepositoryCache();
         factory.setCacheDirectory( repo );
 
         //
@@ -99,7 +99,7 @@
         //
 
         Artifact[] artifacts = 
-          getArtifactsToRegister( "src/test/conf/system.xml" );
+          getArtifactsToRegister( "system.xml" );
         factory.setFactoryArtifacts( artifacts );
 
         //
@@ -144,7 +144,7 @@
           context.getRepository().getCandidates( Repository.class );
         for( int i=0; i<candidates.length; i++ )
         {
-            System.out.println( "  artifact: " + candidates[i] );
+            System.out.println( "  " + candidates[i] );
         }
 
         //
@@ -163,6 +163,19 @@
             System.out.println( "  instance: " + exampleRepository );
             System.out.println( "" );
         }
+    }
+
+    private File getRepositoryCache()
+    {
+        String cache = System.getProperty( "project.repository.cache.path" );
+        if( null != cache )
+        {
+            return new File( cache );
+        }
+        else
+        {
+            return getMavenRepositoryDirectory();
+        }
     }
 
     private Artifact[] getArtifactsToRegister( String path ) throws Exception
@@ -175,11 +188,17 @@
         for( int i=0; i<children.length; i++ )
         {
             Configuration child = children[i];
-            String spec = child.getAttribute( "spec" );
-            Artifact artifact = Artifact.createArtifact( "artifact:" + spec );
+            String spec = getSpec( child.getAttribute( "spec" ) );
+            Artifact artifact = Artifact.createArtifact( spec );
             artifacts[i] = artifact;
         }
         return artifacts;
+    }
+
+    private String getSpec( String spec )
+    {
+        if( spec.startsWith( "artifact:" ) ) return spec;
+        return "artifact:" + spec;
     }
 
     private static File getMavenRepositoryDirectory()

Added: avalon/trunk/runtime/repository/util/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/util/build.xml	Tue Jun  8 07:10:09 2004
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-repository-util" default="dist" basedir=".">
+  <property file="build.properties"/>
+  <import file="${project.home}/build/standard.xml"/>
+</project>

Modified: avalon/trunk/runtime/util/build.properties
==============================================================================
--- avalon/trunk/runtime/util/build.properties	(original)
+++ avalon/trunk/runtime/util/build.properties	Tue Jun  8 07:10:09 2004
@@ -1 +1,2 @@
 project.home = ../../central/system
+project.test.compile.fork = true
\ No newline at end of file

Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Repository.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Repository.java
(original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Repository.java
Tue Jun  8 07:10:09 2004
@@ -50,6 +50,7 @@
 import org.apache.avalon.tools.project.ResourceRef;
 import org.apache.avalon.tools.project.ProjectRef;
 import org.apache.avalon.tools.project.Resource;
+import org.apache.avalon.tools.project.Policy;
 
 /**
  *
@@ -94,12 +95,17 @@
 
     public ResourceRef[] getResourceRefs( Definition def )
     {
+        return getResourceRefs( def, Policy.ANY );
+    }
+
+    public ResourceRef[] getResourceRefs( Definition def, int mode )
+    {
         ArrayList list = new ArrayList();
-        getResourceRefs( def, list );
+        getResourceRefs( def, list, mode );
         return (ResourceRef[]) list.toArray( new ResourceRef[0] );
     }
 
-    private void getResourceRefs( Definition def, List list )
+    private void getResourceRefs( Definition def, List list, int mode )
     {
         ResourceRef[] refs = def.getResourceRefs();
         for( int i=0; i<refs.length; i++ )
@@ -107,7 +113,11 @@
             ResourceRef ref = refs[i];
             if( !list.contains( ref ) )
             {
-                list.add( ref );
+                Policy policy = ref.getPolicy();
+                if( policy.matches( mode ) )
+                {
+                    list.add( ref );
+                }
             }
         }
 
@@ -117,9 +127,13 @@
             ProjectRef ref = projects[i];
             if( !list.contains( ref ) )
             {
-                Definition defintion = m_home.getDefinition( ref );
-                getResourceRefs( defintion, list );
-                list.add( ref );
+                Policy policy = ref.getPolicy();
+                if( policy.matches( mode ) )
+                {
+                    Definition defintion = m_home.getDefinition( ref );
+                    getResourceRefs( defintion, list, mode );
+                    list.add( ref );
+                }
             }
         }
     }

Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Policy.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Policy.java	(original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/project/Policy.java	Tue
Jun  8 07:10:09 2004
@@ -26,6 +26,11 @@
  */
 public class Policy 
 {
+    public static final int ANY = -1;
+    public static final int BUILD = 0;
+    public static final int TEST = 1;
+    public static final int RUNTIME = 2;
+
     public static final boolean ENABLED = true;
     public static final boolean DISABLED = false;
 
@@ -58,6 +63,26 @@
     public boolean isRuntimeEnabled()
     {
         return m_runtime;
+    }
+
+    public boolean matches( int mode )
+    {
+        if( mode == BUILD )
+        {
+            return isBuildEnabled();
+        }
+        else if( mode == TEST )
+        {
+            return isTestEnabled();
+        }
+        else if( mode == RUNTIME )
+        {
+            return isRuntimeEnabled();
+        }
+        else
+        {
+            return true;
+        }
     }
 
     public boolean equals( Object other )

Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java
(original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java
Tue Jun  8 07:10:09 2004
@@ -233,7 +233,8 @@
     private ResourceRef[] getRuntimeRefs( final Definition def )
     {
         ArrayList list = new ArrayList();
-        ResourceRef[] resources = getHome().getRepository().getResourceRefs( def );
+        ResourceRef[] resources = 
+          getHome().getRepository().getResourceRefs( def, Policy.RUNTIME );
         for( int i=0; i<resources.length; i++ )
         {
             ResourceRef ref = resources[i];

Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/util/ElementHelper.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/util/ElementHelper.java
(original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/util/ElementHelper.java
Tue Jun  8 07:10:09 2004
@@ -171,7 +171,7 @@
         if( value.equals( "true" ) ) return true;
         if( value.equals( "false" ) ) return false;
         final String error = 
-          "Boolean argument [" + value + "] not regiconized.";
+          "Boolean argument [" + value + "] not recognized.";
         throw new BuildException( error );
     }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message