Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 17825 invoked from network); 8 May 2002 13:40:33 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 8 May 2002 13:40:33 -0000 Received: (qmail 1026 invoked by uid 97); 8 May 2002 13:40:27 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 1010 invoked by uid 97); 8 May 2002 13:40:27 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 999 invoked by uid 97); 8 May 2002 13:40:26 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 8 May 2002 13:40:21 -0000 Message-ID: <20020508134021.45695.qmail@icarus.apache.org> From: darrell@apache.org To: jakarta-ant-myrmidon-cvs@apache.org Subject: cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder ConvertingProjectBuilder.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N darrell 02/05/08 06:40:21 Modified: ant1compat/src/conf ant-descriptor.xml ant1compat/src/java/org/apache/tools/ant Ant1CompatProject.java container/src/java/org/apache/myrmidon/components/builder ConvertingProjectBuilder.java Log: * Revived ant1 compatibility layer, and modified to use "ant1" namespace, rather than prefixing all type names. Revision Changes Path 1.2 +149 -149 jakarta-ant-myrmidon/ant1compat/src/conf/ant-descriptor.xml Index: ant-descriptor.xml =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/conf/ant-descriptor.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ant-descriptor.xml 14 Apr 2002 12:38:40 -0000 1.1 +++ ant-descriptor.xml 8 May 2002 13:40:21 -0000 1.2 @@ -2,313 +2,313 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.4 +14 -15 jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/Ant1CompatProject.java Index: Ant1CompatProject.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/Ant1CompatProject.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Ant1CompatProject.java 28 Apr 2002 05:04:48 -0000 1.3 +++ Ant1CompatProject.java 8 May 2002 13:40:21 -0000 1.4 @@ -17,6 +17,7 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.HashMap; import org.apache.aut.converter.Converter; import org.apache.aut.converter.ConverterException; import org.apache.myrmidon.api.TaskContext; @@ -34,7 +35,7 @@ * Ant1 original, this class contains the extensions. * * @author Darrell DeBoer - * @version $Revision: 1.3 $ $Date: 2002/04/28 05:04:48 $ + * @version $Revision: 1.4 $ $Date: 2002/05/08 13:40:21 $ */ public class Ant1CompatProject extends Project @@ -52,7 +53,7 @@ private Set m_userProperties = new HashSet(); private TaskContext m_context; - private TaskContext m_underlyingContext; + private Map m_ant1overrides = new HashMap(); /** * Create an Ant1 project. @@ -73,6 +74,9 @@ } m_converter = (Converter)m_context.getService( Converter.class ); + + // These are properties which must be overridden for ant1 tasks. + m_ant1overrides.put( "java.class.path", javaclasspath ); } /** @@ -83,21 +87,11 @@ throws TaskException { // Only reset the context if it is a different instance. - if( m_underlyingContext == context ) + if( m_context == context ) { return; } - - // Need the underlying context for setting properties which - // should be propogated to other Tasks. - m_underlyingContext = context; - - // The main context allows Ant1 specific property overrides. - - //FIXME: Temporarily disable this while in transition to ExecutionFrame - //Subcontexts etc - //m_context = context.createSubContext( "ant1-overrides" ); - m_context.setProperty( "java.class.path", javaclasspath ); + m_context = context; } /** @@ -381,7 +375,7 @@ { try { - m_underlyingContext.setProperty( name, value ); + m_context.setProperty( name, value ); } catch( TaskException e ) { @@ -400,6 +394,11 @@ */ public String getProperty( String name ) { + if ( m_ant1overrides.containsKey( name ) ) + { + return (String)m_ant1overrides.get( name ); + } + Object value = m_context.getProperty( name ); if( value == null ) 1.5 +11 -28 jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/ConvertingProjectBuilder.java Index: ConvertingProjectBuilder.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/ConvertingProjectBuilder.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ConvertingProjectBuilder.java 20 Apr 2002 07:32:39 -0000 1.4 +++ ConvertingProjectBuilder.java 8 May 2002 13:40:21 -0000 1.5 @@ -18,7 +18,7 @@ * configuration into a Myrmidon one. * * @author Darrell DeBoer - * @version $Revision: 1.4 $ $Date: 2002/04/20 07:32:39 $ + * @version $Revision: 1.5 $ $Date: 2002/05/08 13:40:21 $ * * @ant.type type="project-builder" name="xml" * @ant.type type="project-builder" name="ant" @@ -60,6 +60,13 @@ omitAttributes.add( VERSION_ATTRIBUTE ); copyAttributes( originalConfig, newConfig, omitAttributes ); + // Add a "typelib" task for the ant1compat stuff + DefaultConfiguration typelibDeclaration = + new DefaultConfiguration( "typelib", originalConfig.getLocation() ); + typelibDeclaration.setAttribute( "library", "myrmidon-ant1-compat" ); + typelibDeclaration.setAttribute( "namespace", "ant1" ); + newConfig.addChild( typelibDeclaration ); + // Now copy/convert the children final Configuration[] children = originalConfig.getChildren(); for( int i = 0; i < children.length; i++ ) @@ -72,7 +79,7 @@ } else { - newConfig.addChild( convertTask( child ) ); + newConfig.addChild( child ); } } @@ -118,12 +125,8 @@ containerElement = unlessElement; } - // Now copy in converted tasks. - final Configuration[] tasks = originalTarget.getChildren(); - for( int i = 0; i < tasks.length; i++ ) - { - containerElement.addChild( convertTask( tasks[ i ] ) ); - } + // Now copy in all tasks. + copyChildren( originalTarget, containerElement ); return newTarget; } @@ -172,26 +175,6 @@ ifElement.addChild( conditionElement ); return ifElement; - } - - /** - * Converts Configuration for an Ant1 Task into a Myrmidon version. - * @param originalTask The Ant1 Task - * @return the converted task - */ - private Configuration convertTask( final Configuration originalTask ) - { - // Create a new configuration with the "ant1." prefix. - final String newTaskName = "ant1." + originalTask.getName(); - final DefaultConfiguration newTask = - new DefaultConfiguration( newTaskName, originalTask.getLocation() ); - - // Copy all attributes, elements, and value of the task. - copyAttributes( originalTask, newTask, new HashSet() ); - copyChildren( originalTask, newTask ); - newTask.setValue( originalTask.getValue( null ) ); - - return newTask; } /** -- To unsubscribe, e-mail: For additional commands, e-mail: