ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant ProjectHelper.java
Date Sat, 01 Apr 2000 12:44:52 GMT
rubys       00/04/01 04:44:51

  Modified:    .        build.xml
               src/main/org/apache/tools/ant ProjectHelper.java
  Log:
  Restore the ability to define properties and taskdefs outside the scope
  of any target.
  
  Revision  Changes    Path
  1.15      +32 -29    jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- build.xml	2000/03/19 17:57:03	1.14
  +++ build.xml	2000/04/01 12:44:50	1.15
  @@ -6,47 +6,50 @@
   
   <project name="Ant" default="main" basedir=".">
   
  -  <target name="init">
  -    <property name="Name" value="Ant"/>
  -    <property name="name" value="ant"/>
  -    <property name="version" value="1.0-rc1"/>
  -
  -    <property name="ant.home" value="."/>
  -    <property name="bin.dir" value="bin"/>
  -    <property name="src.bin.dir" value="src/bin"/>
  -    <property name="src.dir" value="${basedir}/src/main"/>
  -    <property name="lib.dir" value="lib"/>
  -    <property name="docs.dir" value="docs"/>
  -    <property name="build.dir" value="build"/>
  -    <property name="build.classes" value="build/classes"/>
  -    <property name="build.javadocs" value="build/javadocs"/>
  -    <property name="ant.dist.dir" value="dist"/>
  -
  -    <property name="classpath" value="lib/xml.jar"/>
  -    <property name="packages" value="org.apache.tools.*"/>
  -    <property name="manifest" value="src/etc/manifest"/>
  +  <property name="Name" value="Ant"/>
  +  <property name="name" value="ant"/>
  +  <property name="version" value="1.0-rc1"/>
  +
  +  <property name="ant.home" value="."/>
  +  <property name="bin.dir" value="bin"/>
  +  <property name="src.bin.dir" value="src/bin"/>
  +  <property name="src.dir" value="${basedir}/src/main"/>
  +  <property name="lib.dir" value="lib"/>
  +  <property name="docs.dir" value="docs"/>
  +  <property name="build.dir" value="build"/>
  +  <property name="build.classes" value="build/classes"/>
  +  <property name="build.javadocs" value="build/javadocs"/>
  +  <property name="ant.dist.dir" value="dist"/>
  +
  +  <property name="classpath" value="lib/xml.jar"/>
  +  <property name="packages" value="org.apache.tools.*"/>
  +  <property name="manifest" value="src/etc/manifest"/>
  +
  +  <property name="build.compiler" value="classic"/>
  +
  +  <!-- Give user a chance to override without editing this file 
  +       (and without typing -D each time it compiles it -->
  +  <property file="${user.home}/.ant.properties" />
   
  -    <property name="build.compiler" value="classic"/>
  -
  +  <!-- =================================================================== -->
  +  <!-- Check to see what optional dependencies are available               -->
  +  <!-- =================================================================== -->
  +  <target name="check_for_optional_packages">
       <available property="bsf.present" classname="com.ibm.bsf.BSFManager" />
       <available property="netrexx.present" classname="netrexx.lang.Rexx" />
  -
  -    <!-- Give user a chance to override without editing this file 
  -         (and without typing -D each time it compiles it -->
  -    <property file="${user.home}/.ant.properties" />
     </target>
   
     <!-- =================================================================== -->
     <!-- Prepares the build directory                                        -->
     <!-- =================================================================== -->
  -  <target name="prepare" depends="init">
  +  <target name="prepare">
       <mkdir dir="${build.dir}"/>
     </target>
   
     <!-- =================================================================== -->
     <!-- Compiles the source code                                            -->
     <!-- =================================================================== -->
  -  <target name="compile" depends="prepare">
  +  <target name="compile" depends="prepare,check_for_optional_packages">
       <mkdir dir="${build.classes}"/>
       <javac srcdir="${src.dir}"
              destdir="${build.classes}"
  @@ -143,7 +146,7 @@
     <!-- =================================================================== -->
     <!-- Cleans up generated stuff                                           -->
     <!-- =================================================================== -->
  -  <target name="clean" depends="init">
  +  <target name="clean">
       <deltree dir="${build.dir}"/>
       <deltree dir="${ant.dist.dir}"/>
     </target>
  @@ -161,7 +164,7 @@
   
     <!-- in progress ! (may not work) -->
   
  -  <target name="get.snapshot" depends="init">
  +  <target name="get.snapshot">
       <get src="http://jakarta.apache.org/build/tmp/ant/ant.src.zip" dest="ant-src.zip"
/>
       <expand src="ant-src.zip" dest="." />
     </target>
  
  
  
  1.10      +28 -9     jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
  
  Index: ProjectHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ProjectHelper.java	2000/03/19 20:27:44	1.9
  +++ ProjectHelper.java	2000/04/01 12:44:50	1.10
  @@ -61,6 +61,7 @@
   import java.util.*;
   import org.xml.sax.SAXException;
   import org.w3c.dom.*;
  +import org.apache.tools.ant.taskdefs.*;
   
   /**
    * Configures a Project (complete with Targets and Tasks) based on
  @@ -129,15 +130,33 @@
   
           //      configureTaskDefs(project, root);
   
  -        // set up the targets into the project
  -        configureTargets(project, root);
  +        // set up the taskdefs, properties, and targets into the project
  +        configureProject(project, root);
       }
   
  -    private static void configureTargets(Project project, Element root)
  +    private static void configureProject(Project project, Element root)
           throws BuildException
       {
  +        // configure taskdefs
  +        NodeList list = root.getElementsByTagName("taskdef");
  +        for (int i = 0; i < list.getLength(); i++) {
  +            Taskdef taskdef = new Taskdef();
  +            configure(project, taskdef, (Element)list.item(i));
  +            taskdef.setProject(project);
  +            taskdef.init();
  +        }
  +
  +        // configure properties
  +        list = root.getElementsByTagName("property");
  +        for (int i = 0; i < list.getLength(); i++) {
  +            Property property = new Property();
  +            configure(project, property, (Element)list.item(i));
  +            property.setProject(project);
  +            property.init();
  +        }
  +
           // configure targets
  -        NodeList list = root.getElementsByTagName("target");
  +        list = root.getElementsByTagName("target");
           for (int i = 0; i < list.getLength(); i++) {
               Element element = (Element)list.item(i);
               String targetName = element.getAttribute("name");
  @@ -199,8 +218,7 @@
                   // get the attributes of this element and reflect them
                   // into the task
   
  -                NamedNodeMap nodeMap = element.getAttributes();
  -                configure(project, task, nodeMap);
  +                configure(project, task, element);
                   task.init();
                   task.setTarget(target);
                   target.addTask(task);
  @@ -253,8 +271,7 @@
                           targetClass.getMethod(methodName, new Class[]{});
                       Object child = addProp.invoke(target, new Object[] {});
   
  -                    NamedNodeMap nodeMap = element.getAttributes();
  -                    configure(project, child, nodeMap);
  +                    configure(project, child, element);
   
                       processNestedProperties(project, child, element);
                   } catch (NoSuchMethodException nsme) {
  @@ -272,9 +289,11 @@
   
       private static void configure(Project project,
                                     Object target,
  -                                  NamedNodeMap nodeMap)
  +                                  Element element)
           throws BuildException
       {
  +        NamedNodeMap nodeMap = element.getAttributes();
  +
           if( target instanceof TaskAdapter )
               target=((TaskAdapter)target).getProxy();
   
  
  
  

Mime
View raw message