avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject svn commit: rev 46236 - in avalon/trunk: central/system/gump runtime tools tools/magic/etc/deliverables/templates tools/magic/src/main/org/apache/avalon/tools/tasks tools/spells tools/spells/checkstyle
Date Fri, 17 Sep 2004 06:55:57 GMT
Author: niclas
Date: Thu Sep 16 23:55:56 2004
New Revision: 46236

Added:
   avalon/trunk/tools/spells/
   avalon/trunk/tools/spells/checkstyle/
   avalon/trunk/tools/spells/checkstyle/build.xml   (contents, props changed)
Modified:
   avalon/trunk/central/system/gump/avalon-trunk.xml
   avalon/trunk/runtime/index.xml
   avalon/trunk/tools/index.xml
   avalon/trunk/tools/magic/etc/deliverables/templates/standard.xml
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/InitializeTask.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PluginTask.java
Log:
A series of patches from Stephen to make the checkstyle into a 'build strategy' plugin. We
are looking more into the concept of 'build strategy' to see how that can be abstracted properly.

Modified: avalon/trunk/central/system/gump/avalon-trunk.xml
==============================================================================
--- avalon/trunk/central/system/gump/avalon-trunk.xml	(original)
+++ avalon/trunk/central/system/gump/avalon-trunk.xml	Thu Sep 16 23:55:56 2004
@@ -166,12 +166,12 @@
     <depend project="avalon-util-configuration"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
     <depend project="avalon-logging-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -516,12 +516,12 @@
     <depend project="avalon-meta-impl"><noclasspath/></depend>
     <depend project="avalon-util-configuration"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -1284,12 +1284,12 @@
     <depend project="avalon-meta-impl"><noclasspath/></depend>
     <depend project="avalon-util-configuration"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -2316,12 +2316,12 @@
     <depend project="avalon-meta-impl"><noclasspath/></depend>
     <depend project="avalon-util-configuration"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -2441,12 +2441,12 @@
     <depend project="avalon-meta-impl"><noclasspath/></depend>
     <depend project="avalon-util-configuration"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -2999,12 +2999,12 @@
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
     <depend project="avalon-util-lifecycle"><noclasspath/></depend>
     <depend project="avalon-logging-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -3023,6 +3023,44 @@
        from="Magic Integration &lt;dev@avalon.apache.org&gt;"/>
   </project>
 
+  <project name="magic-checkstyle-plugin">
+    <license name="central/system/license/LICENSE.TXT"/>
+    <ant basedir="tools/spells/checkstyle">
+      <!-- for magic -->
+      <property name="build.sysclasspath" value="last"/> 
+      <property name="magic.home" reference="home" project="magic"/>
+      <property name="gump.signature" value="@@DATE@@"/>
+      <!-- external references -->
+      <depend property="gump.resource.checkstyle" project="checkstyle">
+        <noclasspath/>
+      </depend>
+      <depend property="gump.resource.antlr" project="antlr">
+        <noclasspath/>
+      </depend>
+      <depend property="gump.resource.bcel" project="bcel">
+        <noclasspath/>
+      </depend>
+      <depend property="gump.resource.commons-beanutils-core" project="commons-beanutils-core">
+        <noclasspath/>
+      </depend>
+      <depend property="gump.resource.commons-collections" project="commons-collections">
+        <noclasspath/>
+      </depend>
+      <depend property="gump.resource.commons-logging" project="commons-logging" id="commons-logging">
+        <noclasspath/>
+      </depend>
+      <depend property="gump.resource.regexp" project="regexp">
+        <noclasspath/>
+      </depend>
+      <!-- end for -->
+    </ant>
+    <depend project="magic" runtime="true" inherit="runtime"/> 
+    <home nested="tools/spells/checkstyle/target/deliverables"/>
+    <jar name="jars/magic-checkstyle-plugin-@@DATE@@.plugin"/>
+    <nag to="dev@avalon.apache.org"
+       from="Magic Integration &lt;dev@avalon.apache.org&gt;"/>
+  </project>
+
   <project name="avalon-tutorial-publisher-api">
     <license name="central/system/license/LICENSE.TXT"/>
     <ant basedir="planet/tutorials/composition/publisher/api">
@@ -4012,12 +4050,12 @@
     <depend project="avalon-meta-impl"><noclasspath/></depend>
     <depend project="avalon-meta-spi"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -4186,12 +4224,12 @@
     <depend project="avalon-meta-impl"><noclasspath/></depend>
     <depend project="avalon-util-configuration"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -4907,12 +4945,12 @@
     <depend project="avalon-meta-impl"><noclasspath/></depend>
     <depend project="avalon-util-configuration"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>
@@ -5404,12 +5442,12 @@
     <depend project="avalon-meta-impl"><noclasspath/></depend>
     <depend project="avalon-util-configuration"><noclasspath/></depend>
     <depend project="avalon-util-extension-impl"><noclasspath/></depend>
-    <depend project="avalon-test-dynamics"><noclasspath/></depend>
-    <depend project="avalon-test-includes"><noclasspath/></depend>
-    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testa"><noclasspath/></depend>
     <depend project="avalon-test-testb"><noclasspath/></depend>
     <depend project="avalon-test-testc"><noclasspath/></depend>
+    <depend project="avalon-test-dynamics"><noclasspath/></depend>
+    <depend project="avalon-test-includes"><noclasspath/></depend>
+    <depend project="avalon-test-playground"><noclasspath/></depend>
     <depend project="avalon-test-testd"><noclasspath/></depend>
     <depend project="avalon-test-teste"><noclasspath/></depend>
     <depend project="avalon-test-testcyclic"><noclasspath/></depend>

Modified: avalon/trunk/runtime/index.xml
==============================================================================
--- avalon/trunk/runtime/index.xml	(original)
+++ avalon/trunk/runtime/index.xml	Thu Sep 16 23:55:56 2004
@@ -702,6 +702,9 @@
       <include key="avalon-util-extension-impl"/>
       <include key="avalon-util-lifecycle"/>
       <include key="avalon-logging-impl" build="false" test="true"/>
+      <include key="avalon-test-testa" build="false" runtime="false" test="false"/>
+      <include key="avalon-test-testb" build="false" runtime="false" test="false"/>
+      <include key="avalon-test-testc" build="false" runtime="false" test="false"/>
       <include key="avalon-test-dynamics" build="false" runtime="false" test="false"/>
       <include key="avalon-test-includes" build="false" runtime="false" test="true"/>
       <include key="avalon-test-testcyclic" build="false" runtime="false" test="false"/>

Modified: avalon/trunk/tools/index.xml
==============================================================================
--- avalon/trunk/tools/index.xml	(original)
+++ avalon/trunk/tools/index.xml	Thu Sep 16 23:55:56 2004
@@ -117,6 +117,18 @@
     </info>
   </resource>
   
+  <resource>
+    <info>
+      <group>junit</group>
+      <name>junit</name>
+      <version>3.8.1</version>
+      <type>jar</type>
+    </info>
+    <gump>
+      <classpath/>
+    </gump>
+  </resource>
+
   <!--
   Avalon Tools.
   -->
@@ -132,7 +144,6 @@
       <include key="junit"/>
       <include key="ant-junit"/>
       <include key="ant-nodeps"/>
-      <include key="checkstyle"/>
     </dependencies>
   </project>
 
@@ -147,17 +158,19 @@
     </dependencies>
   </project>
 
-  <resource>
+  <plugin basedir="spells/checkstyle">
     <info>
-      <group>junit</group>
-      <name>junit</name>
-      <version>3.8.1</version>
-      <type>jar</type>
+      <group>avalon/tools</group>
+      <name>magic-checkstyle-plugin</name>
+      <type>plugin</type>
     </info>
-    <gump>
-      <classpath/>
-    </gump>
-  </resource>
+    <dependencies>
+      <include key="checkstyle"/>
+    </dependencies>
+    <tasks>
+      <taskdef name="checkstyle" class="com.puppycrawl.tools.checkstyle.CheckStyleTask"/>
+    </tasks>
+  </plugin>
 
   <!--
   Avalon eXternal Supplemental.

Modified: avalon/trunk/tools/magic/etc/deliverables/templates/standard.xml
==============================================================================
--- avalon/trunk/tools/magic/etc/deliverables/templates/standard.xml	(original)
+++ avalon/trunk/tools/magic/etc/deliverables/templates/standard.xml	Thu Sep 16 23:55:56 2004
@@ -30,25 +30,6 @@
     <x:clean/>
   </target>
 
-  <target name="checkstyle" depends="info" unless="project.checkstyle.disable" >
-    <taskdef resource="checkstyletask.properties" >
-      <classpath>
-        <x:path key="checkstyle" resolve="true" />
-      </classpath>
-    </taskdef>
-           
-    <mkdir dir="target/checkstyle-errors/"/>
-    <mkdir dir="target/checkstyle-reports/"/>
-    <checkstyle config="${magic.templates}/checkstyle/metro-checkstyle.xml">
-      <fileset dir="${project.src}/${project.src.main}" includes="**/*.java"/>
-      <formatter type="xml" toFile="target/checkstyle/checkstyle_errors.xml"/>
-    </checkstyle>
-    <style in="target/checkstyle-errors/checkstyle_errors.xml" 
-           out="target/checkstyle-reports/checkstyle_report.html"
-           style="${magic.templates}/checkstyle/checkstyle-frames.xsl"
-    />
-  </target>
-
   <target name="prepare" depends="init">
     <x:prepare/>
   </target>
@@ -81,5 +62,18 @@
 
   <target name="dist" depends="checkstyle,install,site"/>
   
+  <target name="checkstyle" depends="info" unless="project.checkstyle.disable" >
+    <x:plugin name="checkstyle" uri="plugin:avalon/tools/magic-checkstyle-plugin"/>
+    <mkdir dir="target/checkstyle/"/>
+    <mkdir dir="target/reports/checkstyle"/>
+    <checkstyle config="${magic.templates}/checkstyle/metro-checkstyle.xml">
+      <fileset dir="${project.src}/${project.src.main}" includes="**/*.java"/>
+      <formatter type="xml" toFile="target/checkstyle/checkstyle_errors.xml"/>
+    </checkstyle>
+    <style in="target/checkstyle/checkstyle_errors.xml" 
+           out="target/reports/checkstyle/checkstyle_report.html"
+           style="${magic.templates}/checkstyle/checkstyle-frames.xsl"/>
+  </target>
+
 </project>
 

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/InitializeTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/InitializeTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/InitializeTask.java	Thu
Sep 16 23:55:56 2004
@@ -69,7 +69,7 @@
             final PluginTask task = new PluginTask();
             task.setTaskName( "plugin" );
             task.setProject( project );
-            task.setArtifact( path );
+            task.setUri( path );
             task.init();
             task.execute();
         }

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PluginTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PluginTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PluginTask.java	Thu Sep
16 23:55:56 2004
@@ -46,8 +46,14 @@
 public class PluginTask extends SystemTask
 {
     private String m_id;
+    private String m_name;
 
-    public void setArtifact( final String id )
+    public void setName( final String name )
+    {
+        m_name = name;
+    }
+
+    public void setUri( final String id )
     {
         m_id = id;
     }
@@ -89,7 +95,8 @@
 
             final AntClassLoader classloader = project.createClassLoader( data.getPath()
);
             final String spec = data.getInfo().getSpec();
-            final String uri = "plugin:" + spec.substring( 0, spec.indexOf( "#" ) );
+            final String uri = getURI( spec );
+
             log( "Install \"" + uri + "\"" );
 
             //
@@ -99,13 +106,23 @@
             final ComponentHelper helper =
               ComponentHelper.getComponentHelper( project );
             final TaskDef[] defs = data.getTaskDefs();
-            for( int i=0; i<defs.length; i++ )
+            if(( defs.length == 1 ) && ( null != m_name ))
             {
-                final TaskDef def = defs[i];
+                final TaskDef def = defs[0];
                 final Class taskClass = classloader.loadClass( def.getClassname() );
-                final String name = uri + ":" + def.getName();
-                helper.addTaskDefinition( name, taskClass );
-                log( "Task \"" + name + "\"" );
+                helper.addTaskDefinition( m_name, taskClass );
+                log( "Task \"" + m_name + "\"" );
+            }
+            else
+            {
+                for( int i=0; i<defs.length; i++ )
+                {
+                    final TaskDef def = defs[i];
+                    final Class taskClass = classloader.loadClass( def.getClassname() );
+                    final String name = uri + ":" + def.getName();
+                    helper.addTaskDefinition( name, taskClass );
+                    log( "Task \"" + name + "\"" );
+                }
             }
 
             //
@@ -124,6 +141,18 @@
         catch( Throwable e )
         {
             throw new BuildException( e );
+        }
+    }
+
+    private String getURI( String spec )
+    { 
+        if( spec.indexOf( "#" ) > -1 )
+        {
+            return "plugin:" + spec.substring( 0, spec.indexOf( "#" ) );
+        }
+        else
+        {
+            return "plugin:" + spec;
         }
     }
 

Added: avalon/trunk/tools/spells/checkstyle/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/spells/checkstyle/build.xml	Thu Sep 16 23:55:56 2004
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="magic-checkstyle-plugin" default="install" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <x:home/>
+  <import file="${magic.templates}/standard.xml"/>
+  <target name="build" depends="standard.build">
+    <x:declare/>
+  </target>
+
+</project>

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


Mime
View raw message