jvanzyl 2004/01/10 06:26:49
Modified: maven-core/src/java/org/apache/maven/jelly/tags/ant
AntTagLibrary.java
Log:
o starting the scrub down so that i will know _exactly_ what is going on between
jelly and ant.
Revision Changes Path
1.2 +12 -48
maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/AntTagLibrary.java
Index: AntTagLibrary.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/AntTagLibrary.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AntTagLibrary.java 8 Jan 2004 22:20:52 -0000 1.1
+++ AntTagLibrary.java 10 Jan 2004 14:26:49 -0000 1.2
@@ -1,9 +1,6 @@
-/*
- * $Header$
- * $Revision$
- * $Date$
- *
- * ====================================================================
+package org.apache.maven.jelly.tags.ant;
+
+/* ====================================================================
*
* The Apache Software License, Version 1.1
*
@@ -56,10 +53,7 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
- *
- * $Id$
*/
-package org.apache.maven.jelly.tags.ant;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.Converter;
@@ -69,8 +63,6 @@
import org.apache.commons.jelly.TagLibrary;
import org.apache.commons.jelly.impl.TagFactory;
import org.apache.commons.jelly.impl.TagScript;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.maven.grant.GrantProject;
import org.apache.tools.ant.BuildLogger;
import org.apache.tools.ant.NoBannerLogger;
@@ -87,18 +79,10 @@
*/
public class AntTagLibrary extends TagLibrary
{
-
- /** The Log to which logging calls will be made. */
- private static final Log log = LogFactory.getLog( AntTagLibrary.class );
-
public static final String PROJECT_CONTEXT_HANDLE =
"org.apache.commons.jelly.ant.Project";
static
{
-
- // register standard converters for Ant types
-
-
ConvertUtils.register(
new Converter()
{
@@ -142,60 +126,47 @@
*/
}
-
- /**
- * A helper method which will attempt to find a project in the current context
- * or install one if need be.
- *
- * #### this method could move to an AntUtils class.
- */
public static Project getProject( JellyContext context )
{
Project project = (Project) context.findVariable( PROJECT_CONTEXT_HANDLE );
+
if ( project == null )
{
project = createProject( context );
+
context.setVariable( PROJECT_CONTEXT_HANDLE, project );
}
return project;
}
- /**
- * Sets the Ant Project to be used for this JellyContext.
- *
- * #### this method could move to an AntUtils class.
- */
public static void setProject( JellyContext context, Project project )
{
context.setVariable( PROJECT_CONTEXT_HANDLE, project );
}
- /**
- * A helper method to create a new project
- *
- * #### this method could move to an AntUtils class.
- */
public static Project createProject( JellyContext context )
{
GrantProject project = new GrantProject();
+
project.setPropsHandler( new JellyPropsHandler( context ) );
BuildLogger logger = new NoBannerLogger();
logger.setMessageOutputLevel( org.apache.tools.ant.Project.MSG_INFO );
+
logger.setOutputPrintStream( System.out );
+
logger.setErrorPrintStream( System.err );
project.addBuildListener( logger );
project.init();
+
project.getBaseDir();
return project;
}
-
- /** Creates a new script to execute the given tag name and attributes */
public TagScript createTagScript( String name, Attributes attributes ) throws
JellyException
{
TagScript answer = createCustomTagScript( name, attributes );
@@ -214,12 +185,8 @@
return answer;
}
- /**
- * @return a new TagScript for any custom, statically defined tags, like
'fileScanner'
- */
public TagScript createCustomTagScript( String name, Attributes attributes )
throws JellyException
{
- // custom Ant tags
if ( name.equals( "fileScanner" ) )
{
return new TagScript(
@@ -247,18 +214,15 @@
return null;
}
- /**
- * A helper method which creates an AntTag instance for the given element name
- */
public Tag createTag( String name, Attributes attributes ) throws JellyException
{
AntTag tag = new AntTag( name );
+
if ( name.equals( "echo" ) )
{
tag.setTrim( false );
}
+
return tag;
}
-
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]