Hi! 
I have a problem that I think some of you probably have encountered (and
solved?).
We have a build template that we use for all our buildfiles, each buildfile
is responsible for building its own jar and launching all other buildfiles
below this level in the directory tree. This is so that every developer in
this way is responsible for his own builds.
Since we use the template, all properties have the same name in each
buildfile which lead me to the conclusion that I had to use
inheritAll="false"
to avoid that the properties of the current file would prevent the buildfile
in the subproject to get the same properties. 
This is all fine, but if someone then wants to debug compile we use a
property debug withe the -D option on the command line call. When I use the
inheritAll="false" alternative this property wont either be inherited
ofcourse.

How can I do this in a smooth way, I can add multipple targets that uses the
debug option for all the targets that includes debug.

Any suggestion?  

/Johan Adelöw


<?xml version="1.0" encoding="UTF-8"?>
<!--
****************************************************************************

File: build.xml
Purpose: Compilation of Java-files and make JAR package

CVSrcsfile:   $RCSfile: build_template.xml,v $
CVSrevision:  $Revision: 1.5 $
CVSdate:      $Date: 2001/11/26 16:41:49 $
CVSauthor:    $Author: jad $
****************************************************************************
-->

<!--
***************************************************************************
*  Template usage
***************************************************************************
In most cases all you have to do is to alter the definitions section. 
Usually, it is enough to alter the following properties in the definitions
section:
 - the path to install_corus_utv.properties
 - packagename
 - project_dir_rel
 - jarfile
alsoedit in the tasks section:
 - Edit the sub_projects_xyz target at the end of this script if there are 
   any sub projects. Observe that each buildfile is responsible for 
   compiling and building everything below this point in the directory tree.
- the clean all calls to sub projects that should be deleted
-->

<project basedir="." default="all" name="build">

    <!--
 
***************************************************************************
    *  Definitions
 
***************************************************************************
    -->

    <property file="../../../utv/inst/install_corus_utv.properties"/>

    <!-- Name of the package used for display purposes -->
    <property name="packagename" value="se.corus.dbj"/>

    <!-- The relative path to the directory where the source code 
         can be found for this project. -->
    <property name="project_dir_rel" value="se/corus/dbj"/>

    <!-- The absolute path to the directory where the source code 
         can be found for this project -->
    <property name="project_dir_abs"
value="${CORUS_DIR}/${project_dir_rel}"/>
    
    <!-- Jarfile that is to be created by this buildfile -->
    <property name="jarfile" value="${CORUS_DIR}/classes/dbj.jar"/>

    <!-- Files to be included in jar -->
    <patternset id="project.jar.includes">
        <include name="${project_dir_rel}/*.class"/>
    </patternset>

    <!-- The path where source files can be found for compilation.
          Should point at the place where you find the package root -->
    <path id="project.javac.source.path">
        <pathelement location="${CORUS_DIR}"/>
    </path>

    <!-- Files on the source path to compile. -->
    <patternset id="project.javac.source.includes">
        <include name="${project_dir_rel}/*.java"/>
    </patternset>

    <!-- The files to delete in a clean. -->
    <fileset id="project.clean.files" dir="${project_dir_abs}">
        <!-- The file name pattern of files to delete in a clean. -->    
        <patternset id="project.clean.files.includes">
            <include name="*.class"/>
        </patternset>
    </fileset>

    <!-- The class path used for compilation. -->
    <path id="project.javac.class.path">
        <pathelement location="${CORUS_DIR}"/>
        <pathelement location="${NAVAJO_DIR}"/>
        <pathelement location="${ORACLE_HOME}/Apache/Jsdk/lib/jsdk.jar"/>
        <pathelement location="${CORUS_DIR}/lib/classes12.zip"/>
        <pathelement location="${CORUS_DIR}/lib/classgen.jar"/>
        <pathelement location="${CORUS_DIR}/lib/xerces.jar"/>
        <pathelement location="${CORUS_DIR}/lib/xmlparserv2.jar"/>
        <pathelement location="${CORUS_DIR}/classes/lwscorus.jar"/>
        <pathelement location="${ORACLE_HOME}/sqlj/lib/runtime.zip"/>
        <pathelement location="${JAVA_HOME}/lib/tools.jar"/>
    </path>

    <!--
 
***************************************************************************
    *  Targets
 
***************************************************************************
    -->

    
    <!--
 
***************************************************************************
    * All, Compile and create the jar with this target
 
***************************************************************************
    -->
    <target name="all">
        <antcall target="sub_projects_pre"/>
        <echo
message="-------------------------------------------------------"/>
        <echo message="                    make ${packagename}
"/>
        <echo
message="-------------------------------------------------------"/>
        <antcall target="debug"/>
        <antcall target="compile"/>
        <antcall target="build"/>
        <antcall target="sign"/>
        <antcall target="sub_projects_post"/>
    </target>

    <!--
 
***************************************************************************
    * build jarfile
 
***************************************************************************
    -->
    <target name="build">
        <echo message=" ** Building ${jarfile} **"/>
        <jar jarfile="${jarfile}" basedir="${CORUS_DIR}">
            <patternset refid="project.jar.includes"/>
        </jar>
    </target>

   <!--
 
***************************************************************************
    * sign jarfile
 
***************************************************************************
    -->
    <target name="sign">
<!--
        <echo message=" ** signing ${jarfile} **"/>
        <echo message=" ** Signing ${jarfile} with Corus 1024 bit DSA key
**"/>
        <signjar jar="${jarfile}"
           alias="coruskey"
           storepass="E56WQ99B20A74K51"
           keystore="${CORUS_DIR}/utv/certificates/coruskeystore"
           keypass="24TR20BZ56q74ZX51H"
        />
-->
    </target>

    <!--
 
***************************************************************************
    * debug compile
 
***************************************************************************
    -->
    <target name="debug" if="DEBUG">
        <echo message="Debug compiling all Java-files in directory
${project_dir_abs}"/>
        <javac debug="on">
            <src         refid="project.javac.source.path"/>
            <patternset  refid="project.javac.source.includes"/>
            <classpath   refid="project.javac.class.path"/>
        </javac>
    </target>


    <!--
 
***************************************************************************
    * compile
 
***************************************************************************
    -->
    <target name="compile"  unless="DEBUG">
        <echo message="Compiling all Java-files in directory
${project_dir_abs}"/>
        <javac debug="off">
            <src         refid="project.javac.source.path"/>
            <patternset  refid="project.javac.source.includes"/>
            <classpath   refid="project.javac.class.path"/>
        </javac>
    </target>


    <!--
 
***************************************************************************
    * clean
 
***************************************************************************
    -->
    <target name="clean">
        <echo message="Deleting all class-files in directory
${project_dir_abs}"/>        
        <delete>
            <fileset refid="project.clean.files"/>
        </delete>
        <delete file="${jarfile}"/>
    </target>
    
    <!--
 
***************************************************************************
    * clean all
 
***************************************************************************
    -->
    <target name="clean_all">
        <antcall target="clean"/>
<!--    <ant inheritAll="false" antfile="./project_dir/build.xml"
target="clean_all">             -->
    </target>
    
    <!--
 
***************************************************************************
    * Build sub_projects
 
***************************************************************************
    -->
    <target name="sub_projects_pre">
<!--        
    <echo message="Calling sub project project_name"/>
        <ant inheritAll="false" antfile="./project_dir/build.xml"
target="all">
-->
    </target>

    <target name="sub_projects_post">
<!--        
    <echo message="Calling sub project project_name"/>
        <ant inheritAll="false" antfile="./project_dir/build.xml">
-->
    </target>


</project>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to