ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From darr...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant Ant1CompatProject.java
Date Thu, 28 Mar 2002 11:56:44 GMT
darrell     02/03/28 03:56:44

  Modified:    proposal/myrmidon antlib.xml
               proposal/myrmidon/src/ant1compat/org/apache/tools/ant
                        Ant1CompatProject.java
  Log:
  * Ant1CompatProject now provides a hacked "java.class.path" property,
    which includes the ant1compat.atl file. This is closer to what's expected
    by Ant1 build files.
  * antlib.xml typedefs everything it needs, in preparation for building with
    myrmidon.
  
  Revision  Changes    Path
  1.10      +11 -0     jakarta-ant/proposal/myrmidon/antlib.xml
  
  Index: antlib.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/antlib.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- antlib.xml	26 Mar 2002 02:17:05 -0000	1.9
  +++ antlib.xml	28 Mar 2002 11:56:44 -0000	1.10
  @@ -19,6 +19,7 @@
       <property name="build.dir" value="build"/>
       <property name="build.lib" value="${build.dir}/lib"/>
       <property name="build.custom-tasks" value="${build.dir}/tasks"/>
  +    <property name="build.classes" value="${build.dir}/classes"/>
   
       <property name="src.base" value="src"/>
       <property name="java.dir" value="${src.base}/java"/>
  @@ -42,6 +43,16 @@
           <pathelement path="${build.classes}" />
           <pathelement path="${build.custom-tasks}" />
       </path>
  +
  +    <taskdef name="antlib-jar"
  +             classname="org.apache.myrmidon.build.AntlibJarTask">
  +        <classpath location="${build.custom-tasks}"/>
  +    </taskdef>
  +
  +    <taskdef name="antlib-descriptor"
  +             classname="org.apache.myrmidon.build.AntlibDescriptorTask">
  +        <classpath refid="project.class.path"/>
  +    </taskdef>
   
       <!-- Main target -->
       <target name="main" depends="antlib-jar" />
  
  
  
  1.8       +35 -8     jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/Ant1CompatProject.java
  
  Index: Ant1CompatProject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/ant1compat/org/apache/tools/ant/Ant1CompatProject.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Ant1CompatProject.java	24 Mar 2002 07:53:54 -0000	1.7
  +++ Ant1CompatProject.java	28 Mar 2002 11:56:44 -0000	1.8
  @@ -10,6 +10,7 @@
   import java.io.File;
   import java.io.IOException;
   import java.io.InputStream;
  +import java.net.URL;
   import java.util.Enumeration;
   import java.util.HashSet;
   import java.util.Hashtable;
  @@ -35,17 +36,30 @@
    * Ant1 original, this class contains the extensions.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.7 $ $Date: 2002/03/24 07:53:54 $
  + * @version $Revision: 1.8 $ $Date: 2002/03/28 11:56:44 $
    */
   public class Ant1CompatProject extends Project
   {
       public static final String ANT1_TASK_PREFIX = "ant1.";
   
  +    private static String javaclasspath;
  +
  +    static
  +    {
  +        URL ant1jar =
  +            Ant1CompatProject.class.getProtectionDomain().getCodeSource().getLocation();
  +        String ant1classpath = ant1jar.getFile().toString();
  +        javaclasspath = System.getProperty( "java.class.path" ) +
  +            File.pathSeparator +
  +            ant1classpath;
  +    }
  +
       private final PropertyResolver m_ant1PropertyResolver;
       private final Converter m_converter;
   
       private Set m_userProperties = new HashSet();
       private TaskContext m_context;
  +    private TaskContext m_underlyingContext;
   
       /**
        * Create an Ant1 project.
  @@ -55,7 +69,8 @@
           throws TaskException
       {
           super();
  -        m_context = context;
  +        recontextulize( context );
  +
           setBaseDir( m_context.getBaseDirectory() );
           String projectName = (String)
               m_context.getProperty( org.apache.myrmidon.interfaces.model.Project.PROJECT
);
  @@ -64,9 +79,9 @@
               setName( projectName );
           }
   
  -        m_converter = (Converter)context.getService( Converter.class );
  +        m_converter = (Converter)m_context.getService( Converter.class );
   
  -        TypeManager typeManager = (TypeManager)context.getService( TypeManager.class );
  +        TypeManager typeManager = (TypeManager)m_context.getService( TypeManager.class
);
           try
           {
               TypeFactory factory = typeManager.getFactory( PropertyResolver.ROLE );
  @@ -76,7 +91,6 @@
           {
               throw new TaskException( "Failed to create PropertyResolver.", e );
           }
  -
       }
   
       /**
  @@ -84,8 +98,21 @@
        * @param context The TaskContext for the currently executing Task.
        */
       void recontextulize( TaskContext context )
  +        throws TaskException
       {
  -        m_context = context;
  +        // Only reset the context if it is a different instance.
  +        if( m_underlyingContext == 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.
  +        m_context = context.createSubContext( "ant1-overrides" );
  +        m_context.setProperty( "java.class.path", javaclasspath );
       }
   
       /**
  @@ -360,7 +387,7 @@
       }
   
       /**
  -     * Sets a property value in the context, wrapping exceptions as
  +     * Sets a property value in the underlying context, wrapping exceptions as
        * Ant1 BuildExceptions.
        * @param name property name
        * @param value property value
  @@ -369,7 +396,7 @@
       {
           try
           {
  -            m_context.setProperty( name, value );
  +            m_underlyingContext.setProperty( name, value );
           }
           catch( TaskException e )
           {
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message