At glance.
==========
1) Here is enclosed patch for the JavaC dependency tracking.
2) Also this patch allows using multiple source location in the JAVAC srcdir
option.
3) Implemented new JAVAC option SOURCEPATH.

Full description
================
1) Dependency tracking.
   To switch on this feature you have to use dependence="on" JAVAC option.

   Algorithm performs class files analyzing and backward dependency tracking.
   Example:
     a) A.java depends on B.java. With applied patch if we change B.java, ANT
automatically
     recompiles A.java. In current realization compile list contains only
B.java.
     b) If we will change Task.java in the ant sources, current ant realization
     recompiles only one file. In new realization compile list contains >= 33
files
     (the number of files depends on your own Task extensions).

   For this functionality you have to modify manifest.mf. It is necessary to
include
   lib.jar to the Class-path.

   In next few weeks I'll comment lib.jar source, make proper indentation and
   send sources to the community. Also it is possible to include lib.jar code
   to the ant.jar. If anybody wants to view the sources immediately I'll send
   them on first demand directly to he or she.

2) With applied patch it is possible to use such src dirs:
                <property   name="src.dir"
                                        value= "com/company/progr/mainprogr;
                                                        
com/company/utils/protocol;
                                                        com/company/utils/db;
                                                        com/company/utils/diag;
                                                        com/company/utils/html;
                                                        com/company/utils/sort;
                                                        
com/company/utils/string;
                                                        
com/company/utils/thread;
                                                        com/company/utils/test;
                                                        com/company/utils/timer
                />
   All paths must be separated by semicolon ( I estimate Unix users indignation,
but now current
   approach easily extended to usage semicolon on NT platform and colon on
Unix).

3) For every project it is necessary to specify sourcepath option. This option
will be passed
directly to javac. This functionality is follows from multiple src paths. Now
you can
specify not root of all packages in the srcdir option. Root dir has to be
specified in
sourcepath option.
For our project this functionality is very useful, cause we have many reusable
utilities and
want to distribute parts of them with different projects. All utilities classes
are stored
in one upper-level package com.company.utils. For every project we have to
select from 3 to 10
lower-level packages and include them to the distribution. Approach with
multiple srcdirs makes
build file easiest and better understandable.

We'llbe glad to answer all of your questions.

Regards,
Vitaly Stulsky
mailto:[EMAIL PROTECTED]
<?xml version="1.0"?>

<!-- ======================================================================= -->
<!-- Ant own build file                                                      -->
<!-- ======================================================================= -->

<project name="Ant" default="main" basedir=".">

  <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="src/main"/>
  <property name="lib.dir" value="lib"/>
  <property name="docs.dir" value="docs"/>
  <property name="build.dir" value="../build/ant"/>
  <property name="build.classes" value="${build.dir}/classes"/>
  <property name="build.javadocs" value="${build.dir}/javadocs"/>
  <property name="ant.dist.dir" value="../dist/ant"/>

  <property name="classpath" value=""/>
  <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" />

  <!-- =================================================================== -->
  <!-- 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" />
  </target>

  <!-- =================================================================== -->
  <!-- Prepares the build directory                                        -->
  <!-- =================================================================== -->
  <target name="prepare">
    <mkdir dir="${build.dir}"/>
  </target>

  <!-- =================================================================== -->
  <!-- Compiles the source code                                            -->
  <!-- =================================================================== -->
  <target name="compile" depends="prepare,check_for_optional_packages">
    <mkdir dir="${build.classes}"/>

    <javac srcdir="${src.dir}"
           sourcepath="${src.path}"
           destdir="${build.classes}"
           classpath="${classpath}"
           debug="on"
           deprecation="off"
           optimize="on" >
      <exclude name="**/Script.java" unless="bsf.present" />
      <exclude name="**/NetRexxC.java" unless="netrexx.present" />
    </javac>
 
    <copydir src="${src.dir}" dest="${build.classes}">
      <include name="**/defaultManifest.mf" />
      <include name="**/*.properties" />
    </copydir>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the jar archive                                             -->
  <!-- =================================================================== -->
  <target name="jar" depends="compile">
    <mkdir dir="${lib.dir}"/>
    <jar jarfile="${lib.dir}/${name}.jar"
         basedir="${build.classes}"
         includes="org/**"
         manifest="${manifest}"
    />
  </target>

  <!-- =================================================================== -->
  <!-- Creates the binary structure                                        -->
  <!-- =================================================================== -->
  <target name="main" depends="jar">
     <mkdir dir="${bin.dir}"/>
     <copydir src="${src.bin.dir}" dest="${bin.dir}"/>
     <chmod perm="+x" src="${bin.dir}/ant"/>
     <chmod perm="+x" src="${bin.dir}/antRun"/>
     <fixcrlf srcdir="${bin.dir}" includes="ant,antRun" cr="remove"/>
     <fixcrlf srcdir="${bin.dir}" includes="*.bat" cr="add"/>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the API documentation                                       -->
  <!-- =================================================================== -->
  <target name="javadocs" depends="prepare">
    <mkdir dir="${build.javadocs}"/>
    <javadoc packagenames="${packages}"
             sourcepath="${basedir}/${src.dir}"
             destdir="${build.javadocs}"
             author="true"
             version="true"
             windowtitle="${Name} API"
             doctitle="${Name}"
             bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved."
    />
  </target>

  <!-- =================================================================== -->
  <!-- Creates the distribution                                            -->
  <!-- =================================================================== -->
  <target name="dist" depends="main,jar,javadocs">
     <mkdir dir="${ant.dist.dir}"/>
     <mkdir dir="${ant.dist.dir}/bin"/>
     <mkdir dir="${ant.dist.dir}/lib"/>
     <mkdir dir="${ant.dist.dir}/docs"/>
     <mkdir dir="${ant.dist.dir}/docs/api"/>
     <mkdir dir="${ant.dist.dir}/src"/>

     <copydir src="${src.dir}" dest="${ant.dist.dir}/src"/>
     <copydir src="${lib.dir}" dest="${ant.dist.dir}/lib"/>

     <copyfile src="build.xml" dest="${ant.dist.dir}/lib/build.xml"/>
     <copydir src="src/bin" dest="${ant.dist.dir}/bin"/>
     <copydir src="${docs.dir}" dest="${ant.dist.dir}/docs"/>
     <copydir src="${build.javadocs}" dest="${ant.dist.dir}/docs/api"/>

     <chmod perm="+x" src="${ant.dist.dir}/bin/ant"/>
     <chmod perm="+x" src="${ant.dist.dir}/bin/antRun"/>

     <copyfile src="README" dest="${ant.dist.dir}/README"/>
     <copyfile src="TODO" dest="${ant.dist.dir}/TODO"/>
     <copyfile src="LICENSE" dest="${ant.dist.dir}/LICENSE"/>
  </target>

  <!-- =================================================================== -->
  <!-- Packages the distribution with ZIP                                  -->
  <!-- =================================================================== -->
  <target name="dist-zip" depends="dist">
    <zip zipfile="${Name}-${version}.zip" basedir="${ant.dist.dir}" includes="**"/>
  </target>

  <!-- =================================================================== -->
  <!-- Packages the distribution with TAR-GZIP                             -->
  <!-- =================================================================== -->
  <target name="dist-tgz" depends="dist">
    <tar tarfile="${Name}-${version}.tar" basedir="${ant.dist.dir}" includes="**"/>
    <gzip zipfile="${Name}-${version}.tar.gz" src="${Name}-${version}.tar"/>
  </target>

  <!-- =================================================================== -->
  <!-- Cleans up generated stuff                                           -->
  <!-- =================================================================== -->
  <target name="clean">
    <deltree dir="${build.dir}"/>
    <deltree dir="${ant.dist.dir}"/>
  </target>

  <!-- =================================================================== -->
  <!-- Total cleanup                                                       -->
  <!-- =================================================================== -->
  <target name="total-clean" depends="clean">
    <deltree dir="${bin.dir}"/>
    <delete file="${lib.dir}/${name}.jar"/>
    <delete file="${Name}-${version}.zip"/>
    <delete file="${Name}-${version}.tar"/>
    <delete file="${Name}-${version}.tar.gz"/>
  </target>

  <!-- in progress ! (may not work) -->

  <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>

  <target name="make.snapshot">
    <cvs cvsRoot=":pserver:[EMAIL PROTECTED]:/home/cvspublic"
         package="jakarta-ant"
         dest="."  />
    <zip zipfile="/www/jakarta.apache.org/builds/tmp/ant/ant.src.zip" basedir="." includes="jakarta-ant/**"/>
  </target>

</project>

Attachment: build.xml.diff
Description: Binary data

Attachment: Javac.java
Description: Binary data

Attachment: lib.jar
Description: Binary data

Attachment: Javac.java.diff
Description: Binary data

Reply via email to