You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/06/04 05:36:36 UTC
svn commit: rev 20807 - in avalon/trunk/tools/project/core/src: main/org/apache/avalon/tools/home main/org/apache/avalon/tools/tasks test/projects/demo test/projects/gizmo test/projects/sample test/projects/widget
Author: mcconnell
Date: Thu Jun 3 20:36:36 2004
New Revision: 20807
Added:
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/SystemTask.java
Modified:
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Context.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Home.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/InstallTask.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JarTask.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PluginTask.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PrepareTask.java
avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/XdocTask.java
avalon/trunk/tools/project/core/src/test/projects/demo/build.xml
avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties
avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml
avalon/trunk/tools/project/core/src/test/projects/sample/build.xml
avalon/trunk/tools/project/core/src/test/projects/widget/build.xml
Log:
Move common home handling functionality to an abstract system task.
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Context.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Context.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Context.java Thu Jun 3 20:36:36 2004
@@ -34,7 +34,6 @@
public class Context
{
public static final String KEY = "project.context";
- public static final String HOME_KEY = "project.home";
public static final String SRC_KEY = "project.src";
public static final String SRC_VALUE = "src";
@@ -68,22 +67,15 @@
public static Context getContext( Project project )
{
- return getContext( project, null );
- }
-
- public static Context getContext( Project project, File home )
- {
Context context = (Context) project.getReference( KEY );
if( null == context )
{
- context = new Context( project, home );
+ context = new Context( project );
project.addReference( KEY, context );
}
return context;
}
- private final File m_home;
-
private final File m_src;
private final File m_target;
private final File m_build;
@@ -94,7 +86,7 @@
private final Map m_map = new Hashtable();
private final Map m_resources = new Hashtable();
- private Context( Project project, File home )
+ private Context( Project project )
{
setupProperties( project );
@@ -118,25 +110,6 @@
m_src = setupSrc( basedir, src );
m_target = setupTarget( basedir, target );
- if( null == home )
- {
- String path = project.getProperty( HOME_KEY );
- if( null == path )
- {
- //final String error =
- // "Missing 'project.home' declaration.";
- //project.log( error );
- m_home = null;
- }
- else
- {
- m_home = new File( basedir, path );
- }
- }
- else
- {
- m_home = home;
- }
m_build =
setBuildPath( BUILD_KEY, build );
@@ -147,11 +120,6 @@
m_docs =
setBuildPath( DOCS_KEY, docs );
}
-
- //public File getHomeDirectory()
- //{
- // return m_home;
- //}
public File getSrcDirectory()
{
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Home.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Home.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/home/Home.java Thu Jun 3 20:36:36 2004
@@ -65,50 +65,21 @@
public class Home extends Sequential
{
//-------------------------------------------------------------
- // static immutable
+ // static
//-------------------------------------------------------------
- //private static Home HOME;
+ public static final String KEY = "project.home";
//-------------------------------------------------------------
- // static operations
- //-------------------------------------------------------------
-
- /*
- public static Home initialize( Task task, File index )
- {
- Project project = task.getProject();
- if( null == HOME )
- {
- try
- {
- task.log( "index: " + index, Project.MSG_INFO );
- HOME = new Home( project, index );
- }
- catch( Throwable e )
- {
- throw new BuildException( e );
- }
- }
- setHomeReference( project );
- return HOME;
- }
-
- public static Home getHome()
- {
- return HOME;
- }
- */
-
- //-------------------------------------------------------------
- // immutable state
+ // mutable state
//-------------------------------------------------------------
+ private String m_id;
private String m_key;
private Project m_project;
private Repository m_repository;
- private File m_home;
+ private File m_system;
private File m_file;
private final Hashtable m_resources = new Hashtable();
@@ -125,11 +96,6 @@
m_project = project;
}
- //private Home( Project project, File file )
- //{
- // init( project, file );
- //}
-
//-------------------------------------------------------------
// setters
//-------------------------------------------------------------
@@ -144,20 +110,38 @@
m_key = key;
}
+ public void setId( String id )
+ {
+ m_id = id;
+ }
+
//-------------------------------------------------------------
// internal
//-------------------------------------------------------------
public void execute()
{
- //m_file = file;
- //m_project = project;
- m_home = m_file.getParentFile();
+ if( null == m_file )
+ {
+ final String error =
+ "Cannot continue due to missing index attribute in task defintion ["
+ + getTaskName() + "].";
+ throw new BuildException( error );
+ }
+
+ Project project = getProject();
+ if( null == m_id )
+ {
+ project.addReference( KEY, this );
+ }
+ else
+ {
+ project.addReference( m_id, this );
+ }
- //HOME = this;
-
+ m_system = m_file.getParentFile();
Element root = ElementHelper.getRootElement( m_file );
- m_project.log( "home: " + m_home, Project.MSG_DEBUG );
+ m_project.log( "home: " + m_system, Project.MSG_DEBUG );
final Element repo = ElementHelper.getChild( root, "repository" );
final Element resources = ElementHelper.getChild( root, "resources" );
@@ -175,7 +159,6 @@
final String key = getKey();
m_definition = getDefinition( key, false );
-
m_listener = new StandardListener( this, m_definition );
super.execute();
@@ -200,7 +183,7 @@
public File getHomeDirectory()
{
- return m_home;
+ return m_system;
}
public Repository getRepository()
@@ -213,11 +196,6 @@
return m_file;
}
- public Project getProject()
- {
- return m_project;
- }
-
public Plugin getPlugin( PluginRef ref )
throws BuildException
{
@@ -372,7 +350,7 @@
{
Element element = entries[i];
Definition definition =
- XMLDefinitionBuilder.createDefinition( this, element, m_home );
+ XMLDefinitionBuilder.createDefinition( this, element, m_system );
String key = definition.getKey();
m_resources.put( key, definition );
m_project.log(
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/DeclareTask.java Thu Jun 3 20:36:36 2004
@@ -45,49 +45,14 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class DeclareTask extends ContextualTask
+public class DeclareTask extends SystemTask
{
private static final String TYPE = "plugin";
- private Home m_home;
-
- /**
- * Set the home ref id.
- * @param id a home id
- */
- public void setRefid( String id )
- {
- Object object = getProject().getReference( id );
- if( null == object )
- {
- final String error =
- "Unknown ref id '" + id + "'.";
- throw new BuildException( error );
- }
- if( object instanceof Home )
- {
- m_home = (Home) object;
- }
- else
- {
- final String error =
- "Supplied id '" + id + "' does not refer to a Home.";
- throw new BuildException( error );
- }
- }
-
public void execute() throws BuildException
{
- if( null == m_home )
- {
- final String error =
- "Required system home 'refid' attribute not set in the task definition ["
- + getTaskName() + "].";
- throw new BuildException( error );
- }
-
log( "creating plugin declaration" );
- final Definition def = m_home.getDefinition();
+ final Definition def = getHome().getDefinition();
try
{
@@ -116,7 +81,7 @@
File ants = new File( dir, TYPE + "s" );
mkDir( ants );
- Definition def = m_home.getDefinition();
+ Definition def = getHome().getDefinition();
Info info = def.getInfo();
String filename = getFilename( info );
return new File( ants, filename );
@@ -214,14 +179,15 @@
{
writer.write( "\n <classpath>" );
final String pad = " ";
- ResourceRef[] resources = m_home.getRepository().getResourceRefs( def );
+ ResourceRef[] resources = getHome().getRepository().getResourceRefs( def );
writeResourceRefs( writer, pad, resources );
writeResource( writer, pad, def );
writer.write( "\n </classpath>" );
}
- private void writeResourceRefs( final Writer writer, String pad, final ResourceRef[] resources )
- throws IOException
+ private void writeResourceRefs(
+ final Writer writer, String pad, final ResourceRef[] resources )
+ throws IOException
{
for( int i=0; i<resources.length; i++ )
{
@@ -229,14 +195,15 @@
Policy policy = ref.getPolicy();
if( policy.isRuntimeEnabled() )
{
- Resource resource = m_home.getResource( ref );
+ Resource resource = getHome().getResource( ref );
writeResource( writer, pad, resource );
}
}
}
- private void writeResource( final Writer writer, String pad, final Resource resource )
- throws IOException
+ private void writeResource(
+ final Writer writer, String pad, final Resource resource )
+ throws IOException
{
Info info = resource.getInfo();
String name = info.getName();
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/InstallTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/InstallTask.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/InstallTask.java Thu Jun 3 20:36:36 2004
@@ -33,40 +33,14 @@
import org.apache.avalon.tools.project.Definition;
/**
- * Load a goal.
+ * Install the target/deliverables content into the local repository
+ * cache.
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class InstallTask extends ContextualTask
+public class InstallTask extends SystemTask
{
- private Home m_home;
-
- /**
- * Set the home ref id.
- * @param id a home id
- */
- public void setRefid( String id )
- {
- Object object = getProject().getReference( id );
- if( null == object )
- {
- final String error =
- "Unknown ref id '" + id + "'.";
- throw new BuildException( error );
- }
- if( object instanceof Home )
- {
- m_home = (Home) object;
- }
- else
- {
- final String error =
- "Supplied id '" + id + "' does not refer to a Home.";
- throw new BuildException( error );
- }
- }
-
public void execute() throws BuildException
{
File deliverables = getContext().getDeliverablesDirectory();
@@ -82,9 +56,10 @@
fileset.setDir( deliverables );
fileset.createInclude().setName( "**/*" );
- File cache = m_home.getRepository().getCacheDirectory();
- String group = m_home.getDefinition().getInfo().getGroup();
+ File cache = getHome().getRepository().getCacheDirectory();
+ String group = getHome().getDefinition().getInfo().getGroup();
File target = new File( cache, group );
+ mkDir( target );
Copy copy = (Copy) getProject().createTask( "copy" );
copy.setPreserveLastModified( true );
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java Thu Jun 3 20:36:36 2004
@@ -43,7 +43,7 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class JUnitTestTask extends ContextualTask
+public class JUnitTestTask extends SystemTask
{
public static final String TEST_KEY = "project.test";
public static final String TEST_VALUE = "test";
@@ -64,32 +64,6 @@
public static final boolean FORK_VALUE = false;
private File m_test;
- private Home m_home;
-
- /**
- * Set the home ref id.
- * @param id a home id
- */
- public void setRefid( String id )
- {
- Object object = getProject().getReference( id );
- if( null == object )
- {
- final String error =
- "Unknown ref id '" + id + "'.";
- throw new BuildException( error );
- }
- if( object instanceof Home )
- {
- m_home = (Home) object;
- }
- else
- {
- final String error =
- "Supplied id '" + id + "' does not refer to a Home.";
- throw new BuildException( error );
- }
- }
public void init() throws BuildException
{
@@ -109,14 +83,6 @@
public void execute() throws BuildException
{
- if( null == m_home )
- {
- final String error =
- "Required system home 'refid' attribute not set in the task definition ["
- + getTaskName() + "].";
- throw new BuildException( error );
- }
-
Project project = getProject();
File build = getContext().getBuildDirectory();
@@ -127,9 +93,9 @@
{
File classes = new File( m_test, "classes" );
mkDir( classes );
- Definition definition = m_home.getDefinition();
+ Definition definition = getHome().getDefinition();
Path classpath =
- m_home.getRepository().createPath( project, definition );
+ getHome().getRepository().createPath( project, definition );
//
// add the project jar to the classpath for the compilation
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JarTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JarTask.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JarTask.java Thu Jun 3 20:36:36 2004
@@ -42,50 +42,15 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class JarTask extends ContextualTask
+public class JarTask extends SystemTask
{
public static final String MD5_EXT = "md5";
public static final String JAR_EXT = "jar";
public static final String ASC_EXT = "asc";
public static final String GPG_EXE_KEY = "project.gpg.exe";
- private Home m_home;
-
- /**
- * Set the home ref id.
- * @param id a home id
- */
- public void setRefid( String id )
- {
- Object object = getProject().getReference( id );
- if( null == object )
- {
- final String error =
- "Unknown ref id '" + id + "'.";
- throw new BuildException( error );
- }
- if( object instanceof Home )
- {
- m_home = (Home) object;
- }
- else
- {
- final String error =
- "Supplied id '" + id + "' does not refer to a Home.";
- throw new BuildException( error );
- }
- }
-
public void execute() throws BuildException
{
- if( null == m_home )
- {
- final String error =
- "Required system home 'refid' attribute not set in the task definition ["
- + getTaskName() + "].";
- throw new BuildException( error );
- }
-
File classes =
getContext().getBuildPath( JavacTask.BUILD_CLASSES_KEY );
File deliverables =
@@ -111,8 +76,8 @@
public File getJarFile( File deliverables )
{
Project project = getProject();
- Definition def = m_home.getDefinition();
- String type = m_home.getDefinition().getInfo().getType();
+ Definition def = getHome().getDefinition();
+ String type = getHome().getDefinition().getInfo().getType();
File types = new File( deliverables, type + "s" );
String filename = getJarFilename( def );
return new File( types, filename );
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/JavacTask.java Thu Jun 3 20:36:36 2004
@@ -39,7 +39,7 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class JavacTask extends ContextualTask
+public class JavacTask extends SystemTask
{
public static final String BUILD_CLASSES_KEY = "classes";
public static final String BUILD_CLASSES_PATH = "classes";
@@ -50,33 +50,6 @@
public static final String FORK_KEY = "java.compile.fork";
public static final boolean FORK_VALUE = false;
- private Home m_home;
-
- /**
- * Set the home ref id.
- * @param id a home id
- */
- public void setRefid( String id )
- {
- Object object = getProject().getReference( id );
- if( null == object )
- {
- final String error =
- "Unknown ref id '" + id + "'.";
- throw new BuildException( error );
- }
- if( object instanceof Home )
- {
- m_home = (Home) object;
- }
- else
- {
- final String error =
- "Supplied id '" + id + "' does not refer to a Home.";
- throw new BuildException( error );
- }
- }
-
public void init() throws BuildException
{
if( !isInitialized() )
@@ -93,13 +66,6 @@
public void execute() throws BuildException
{
- if( null == m_home )
- {
- final String error =
- "Required system home 'refid' value is not declared";
- throw new BuildException( error );
- }
-
Project project = getProject();
File build = getContext().getBuildDirectory();
String mainPath = project.getProperty( Context.SRC_MAIN_KEY );
@@ -111,8 +77,8 @@
mkDir( classes );
Path classpath =
- m_home.getRepository().createPath(
- getProject(), m_home.getDefinition() );
+ getHome().getRepository().createPath(
+ getProject(), getHome().getDefinition() );
compile( main, classes, classpath );
Copy copy = (Copy) getProject().createTask( "copy" );
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PluginTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PluginTask.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PluginTask.java Thu Jun 3 20:36:36 2004
@@ -48,37 +48,10 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class PluginTask extends ContextualTask
+public class PluginTask extends SystemTask
{
private String m_id;
private String m_uri;
- private Home m_home;
-
- /**
- * Set the home ref id.
- * @param id a home id
- */
- public void setRefid( String id )
- {
- Object object = getProject().getReference( id );
- if( null == object )
- {
- final String error =
- "Unknown ref id '" + id + "'.";
- throw new BuildException( error );
- }
- if( object instanceof Home )
- {
- m_home = (Home) object;
- }
- else
- {
- final String error =
- "Supplied id '" + id + "' does not refer to a Home.";
- throw new BuildException( error );
- }
- }
-
public void setArtifact( String id )
{
@@ -101,14 +74,6 @@
public void execute() throws BuildException
{
- if( null == m_home )
- {
- final String error =
- "Required system home 'refid' attribute not set in the task definition ["
- + getTaskName() + "].";
- throw new BuildException( error );
- }
-
try
{
//
@@ -120,7 +85,7 @@
Info info = Info.create( id );
Project project = getProject();
Resource resource = new Resource( info );
- File file = m_home.getRepository().getResource( project, resource );
+ File file = getHome().getRepository().getResource( project, resource );
//
// create a utility data object from the defintion
@@ -177,7 +142,7 @@
Info info = Info.create( type, value );
Resource resource = new Resource( info );
File jar =
- m_home.getRepository().getResource( project, resource );
+ getHome().getRepository().getResource( project, resource );
m_path.createPathElement().setLocation( jar );
}
}
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PrepareTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PrepareTask.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/PrepareTask.java Thu Jun 3 20:36:36 2004
@@ -45,16 +45,6 @@
private static final String SRC_FILTERED_INCLUDES_VALUE =
"**/*.java,**/*.x*,**/*.properties";
- private File m_home;
-
- /**
- * Optional setting of the project home.
- */
- public void setHome( File home )
- {
- m_home = home;
- }
-
public void init() throws BuildException
{
if( !isInitialized() )
Added: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/SystemTask.java
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/SystemTask.java Thu Jun 3 20:36:36 2004
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2004 Apache Software Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.avalon.tools.tasks;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.taskdefs.Jar;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+import org.apache.avalon.tools.home.Home;
+import org.apache.avalon.tools.home.Context;
+import org.apache.avalon.tools.project.Definition;
+
+/**
+ * Load a goal.
+ *
+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class SystemTask extends ContextualTask
+{
+ private Home m_home;
+
+ /**
+ * Set the home ref id to the system home. If not supplied the
+ * default system home 'project.home' id will apply.
+ *
+ * @param id a home id
+ */
+ public void setRefid( String id )
+ {
+ m_home = getHomeFromReference( id );
+ }
+
+ public Home getHome()
+ {
+ if( null == m_home )
+ {
+ m_home = getHomeFromReference( Home.KEY );
+ }
+ return m_home;
+ }
+
+ private Home getHomeFromReference( String id )
+ {
+ Object object = getProject().getReference( id );
+ if( null == object )
+ {
+ final String error =
+ "System home ref id '" + id + "' declared or implied in task ["
+ + getTaskName()
+ + "] is unknown with the project ["
+ + getProject().getName()
+ + "].";
+ throw new BuildException( error );
+ }
+ if( object instanceof Home )
+ {
+ return (Home) object;
+ }
+ else
+ {
+ final String error =
+ "System home ref id '" + id + "' declared or implied in task ["
+ + getTaskName()
+ + "] in the project ["
+ + getProject().getName()
+ + "] references a object that is not a system home.";
+ throw new BuildException( error );
+ }
+ }
+}
Modified: avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/XdocTask.java
==============================================================================
--- avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/XdocTask.java (original)
+++ avalon/trunk/tools/project/core/src/main/org/apache/avalon/tools/tasks/XdocTask.java Thu Jun 3 20:36:36 2004
@@ -28,7 +28,7 @@
import org.apache.avalon.tools.home.Context;
import org.apache.avalon.tools.home.Home;
-public class XdocTask extends ContextualTask
+public class XdocTask extends SystemTask
{
public static final String ORG_NAME_KEY = "project.organization.name";
public static final String ORG_NAME_VALUE = "The Apache Software Foundation";
@@ -71,9 +71,7 @@
public static final String XDOC_ANCHOR_URL_KEY = "project.xdoc.anchor.url";
- private Home m_home;
private String m_theme;
-
private File m_BaseToDir;
private File m_BaseSrcDir;
@@ -82,31 +80,6 @@
m_theme = theme;
}
- /**
- * Set the home ref id.
- * @param id a home id
- */
- public void setRefid( String id )
- {
- Object object = getProject().getReference( id );
- if( null == object )
- {
- final String error =
- "Unknown ref id '" + id + "'.";
- throw new BuildException( error );
- }
- if( object instanceof Home )
- {
- m_home = (Home) object;
- }
- else
- {
- final String error =
- "Supplied id '" + id + "' does not refer to a Home.";
- throw new BuildException( error );
- }
- }
-
public void init() throws BuildException
{
if( !isInitialized() )
@@ -131,7 +104,7 @@
private File getThemesDirectory()
{
- File home = m_home.getHomeDirectory();
+ File home = getHome().getHomeDirectory();
return new File( home, "themes" );
}
@@ -147,15 +120,7 @@
}
public void execute()
- {
- if( null == m_home )
- {
- final String error =
- "Required system home 'refid' attribute not set in the task definition ["
- + getTaskName() + "].";
- throw new BuildException( error );
- }
-
+ {
Project project = getProject();
File docs = getContext().getDocsDirectory();
Modified: avalon/trunk/tools/project/core/src/test/projects/demo/build.xml
==============================================================================
--- avalon/trunk/tools/project/core/src/test/projects/demo/build.xml (original)
+++ avalon/trunk/tools/project/core/src/test/projects/demo/build.xml Thu Jun 3 20:36:36 2004
@@ -2,7 +2,7 @@
<project name="my-demo" default="install" basedir="."
xmlns:x="antlib:org.apache.avalon.tools">
- <x:home id="system" index="../../index.xml" key="demo"/>
+ <x:home index="../../index.xml" key="demo"/>
<target name="clean">
<x:clean/>
@@ -13,20 +13,20 @@
</target>
<target name="build" depends="prepare">
- <x:declare refid="system"/>
- <x:javac refid="system"/>
+ <x:declare/>
+ <x:javac/>
</target>
<target name="package" depends="build">
- <x:jar refid="system"/>
+ <x:jar/>
</target>
<target name="test" depends="package">
- <x:junit refid="system"/>
+ <x:junit/>
</target>
<target name="install" depends="test">
- <x:install refid="system"/>
+ <x:install/>
</target>
</project>
Modified: avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties
==============================================================================
--- avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties (original)
+++ avalon/trunk/tools/project/core/src/test/projects/gizmo/build.properties Thu Jun 3 20:36:36 2004
@@ -1,5 +1,4 @@
#avalon.target = targetx
project.index = ../../index.xml
-project.home = ../..
project.gpg.exe = gpg
Modified: avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml
==============================================================================
--- avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml (original)
+++ avalon/trunk/tools/project/core/src/test/projects/gizmo/build.xml Thu Jun 3 20:36:36 2004
@@ -2,7 +2,7 @@
<project name="gizmo" default="install" basedir="."
xmlns:x="antlib:org.apache.avalon.tools">
- <x:home id="system" index="../../index.xml"/>
+ <x:home index="../../index.xml"/>
<target name="clean">
<x:clean/>
@@ -13,19 +13,19 @@
</target>
<target name="build" depends="prepare">
- <x:javac refid="system"/>
+ <x:javac/>
</target>
<target name="package" depends="build">
- <x:jar refid="system"/>
+ <x:jar/>
</target>
<target name="test" depends="package">
- <x:junit refid="system"/>
+ <x:junit/>
</target>
<target name="install" depends="test">
- <x:install refid="system"/>
+ <x:install/>
</target>
</project>
Modified: avalon/trunk/tools/project/core/src/test/projects/sample/build.xml
==============================================================================
--- avalon/trunk/tools/project/core/src/test/projects/sample/build.xml (original)
+++ avalon/trunk/tools/project/core/src/test/projects/sample/build.xml Thu Jun 3 20:36:36 2004
@@ -2,8 +2,8 @@
<project name="sample" default="install" basedir="."
xmlns:x="antlib:org.apache.avalon.tools" xmlns:d="plugin:demo/demo#1.0" >
- <x:home id="system" index="../../index.xml">
- <x:plugin refid="system" artifact="plugin:demo/demo#1.0"/>
+ <x:home index="../../index.xml">
+ <x:plugin artifact="plugin:demo/demo#1.0"/>
</x:home>
<target name="clean">
@@ -15,20 +15,20 @@
</target>
<target name="build" depends="prepare">
- <x:javac refid="system"/>
+ <x:javac/>
<d:hello/>
</target>
<target name="package" depends="build">
- <x:jar refid="system"/>
+ <x:jar/>
</target>
<target name="test" depends="package">
- <x:junit refid="system"/>
+ <x:junit/>
</target>
<target name="install" depends="test">
- <x:install refid="system"/>
+ <x:install/>
</target>
</project>
Modified: avalon/trunk/tools/project/core/src/test/projects/widget/build.xml
==============================================================================
--- avalon/trunk/tools/project/core/src/test/projects/widget/build.xml (original)
+++ avalon/trunk/tools/project/core/src/test/projects/widget/build.xml Thu Jun 3 20:36:36 2004
@@ -2,7 +2,7 @@
<project name="widget" default="install" basedir="."
xmlns:x="antlib:org.apache.avalon.tools">
- <x:home id="system" index="../../index.xml"/>
+ <x:home index="../../index.xml"/>
<target name="clean">
<x:clean/>
@@ -13,19 +13,19 @@
</target>
<target name="build" depends="prepare">
- <x:javac refid="system"/>
+ <x:javac/>
</target>
<target name="package" depends="build">
- <x:jar refid="system"/>
+ <x:jar/>
</target>
<target name="test" depends="package">
- <x:junit refid="system"/>
+ <x:junit/>
</target>
<target name="install" depends="test">
- <x:install refid="system"/>
+ <x:install/>
</target>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org