ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Nichols" <chr...@qstrategies.com>
Subject RE: Why Properties became immutable
Date Wed, 26 Jul 2000 03:55:26 GMT
setup targets using the javac with the "includes" attribute to include just
those packages that you want for each one.  Do the same for the jar's.  I
have done this very same thing with our project based on packages since we
tend to work on a single package at a time, but want to have a single build
system for all packages.  This let us define targets for each package for
the code/debug cycle, but the "core" target depends on all of these to build
the entire project.  Here is a sample build.xml

<project name="QMetrics" default="dist" basedir=".">

  <property name="version" value="0.5"/>
  <property name="project" value="QMetrics"/>
  <property name="build.compiler" value="classic"/>
  <property name="build.dir" value="../bin"/>
  <property name="build.src" value="${build.dir}/src"/>
  <property name="build.dest" value="${build.dir}/classes"/>
  <property name="src.java.dir" value="../src/java"/>
  <property name="javadoc.destdir" value="../docs/api"/>
  <property name="final.name" value="${project}-${version}"/>
  <property name="final.dir" value="../${final.name}/"/>
  <property name="debug" value="on"/>
  <property name="year" value="2000"/>
  <property name="ant.home" value="."/>
  <property name="optimize" value="off"/>
  <property name="deprecation" value="on"/>
  <!--
  Each of the following targets builds a top level folder under
com.qmetrics.
  any new top level folders should be added as a new target section to this
list
  and should also be added to the depends clause on the "core" target.
  -->
  <target name="database">

    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.src}"/>

    <mkdir dir="${build.src}/com/qmetrics"/>

    <copydir src="${src.java.dir}/com/qmetrics/database"
dest="${build.src}/com/qmetrics/database"/>

    <javac srcdir="${build.src}" destdir="${build.dest}"
includes="**/database/*" debug="${debug}"/>
  </target>

  <target name="global">

    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.src}"/>

    <mkdir dir="${build.src}/com/qmetrics"/>

    <copydir src="${src.java.dir}/com/qmetrics/global"
dest="${build.src}/com/qmetrics/global"/>

    <javac srcdir="${build.src}" destdir="${build.dest}"
includes="**/global/*" debug="${debug}"/>
  </target>

  <target name="java">

    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.src}"/>

    <mkdir dir="${build.src}/com/qmetrics"/>

    <copydir src="${src.java.dir}/com/qmetrics/java"
dest="${build.src}/com/qmetrics/java"/>

    <javac srcdir="${build.src}" destdir="${build.dest}"
includes="**/java/*" debug="${debug}"/>
  </target>

  <target name="net">

    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.src}"/>

    <mkdir dir="${build.src}/com/qmetrics"/>

    <copydir src="${src.java.dir}/com/qmetrics/net"
dest="${build.src}/com/qmetrics/net"/>

    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/net/*"
debug="${debug}"/>
  </target>

  <target name="repository">

    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.src}"/>

    <mkdir dir="${build.src}/com/qmetrics"/>

    <copydir src="${src.java.dir}/com/qmetrics/repository"
dest="${build.src}/com/qmetrics/repository"/>

    <javac srcdir="${build.src}" destdir="${build.dest}"
includes="**/repository/*" debug="${debug}"/>
  </target>

  <target name="turbine">

    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.src}"/>

    <mkdir dir="${build.src}/com/qmetrics"/>

    <copydir src="${src.java.dir}/com/qmetrics/turbine"
dest="${build.src}/com/qmetrics/turbine"/>

    <javac srcdir="${build.src}" destdir="${build.dest}"
includes="**/turbine/*" debug="${debug}"/>
  </target>

  <target name="util">

    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.src}"/>

    <mkdir dir="${build.src}/com/qmetrics"/>

    <copydir src="${src.java.dir}/com/qmetrics/util"
dest="${build.src}/com/qmetrics/util"/>

    <javac srcdir="${build.src}" destdir="${build.dest}"
includes="**/util/*" debug="${debug}"/>
  </target>
  <!--
  this target builds everything above
  -->
  <target name="core" depends="database, global, java, net, repository,
turbine, util">
  </target>

  <target name="dist" depends="core">
    <jar jarfile="${build.dir}/${project}.jar" basedir="${build.dest}"/>
  </target>


  <target name="fast" depends="core">
    <!--
    This is a somewhat fast version of the standard build but when building
    the .jar it actually uses zip and the 'freshen' option
    -->

        <exec
            dir="${build.dest}"
            command="zip -u -r -0 ../${project}.jar com"/>
  </target>

  <target name="clean">
    <deltree dir="${build.dir}"/>
  </target>

  <!--
  Basic target which rebuilds Repository clean and then does a full
rebuild...
  This is a little quicker than "build.sh clean && build.sh" because there
is
  no second JVM bootup.
  -->
  <target name="rebuild" depends="clean,core"/>

  <target name="javadoc" depends="core">
    <mkdir dir="${javadoc.destdir}"/>

    <javadoc    sourcepath="${build.src}"
				classpath="d:/dev/lib/jgl3.1.0.jar;d:/dev/lib/turbine-2.0.jar"
                destdir="${javadoc.destdir}"
                packagenames="com.qmetrics.repository.*"
                private="true"
				verbose="false"
                windowtitle="${project} API"
                doctitle="${project}"
                version="true"
                use="true"
                bottom="Copyright &#169; ${year} Q Strategies Inc. All
Rights Reserved."
                author="true"/>
  </target>


    <target name="all" depends="dist">
        <jar jarfile="${build.dir}/${final.name}-dist.jar" basedir=".."
includes="src/*,build/*,docs/*,lib/*,bin/${project}.jar"/>
    </target>


  <!-- this creates a distribution. you must run clean,dist -->
  <target name="package" depends="clean,dist,javadoc,package-work"/>


  <!--
  This is the actual work that the package does.  If you want you can call
  this directly assuming that all the dependencies that the package target
are
  done.
  -->
  <target name="package-work">

    <deltree dir="${final.dir}"/>

    <mkdir dir="${final.dir}"/>
    <mkdir dir="${final.dir}/build"/>
    <mkdir dir="${final.dir}/src"/>
    <mkdir dir="${final.dir}/docs"/>
    <mkdir dir="${final.dir}/lib"/>

    <copydir src="../build" dest="${final.dir}/build"/>
    <copydir src="../src" dest="${final.dir}/src"/>
    <copydir src="../docs" dest="${final.dir}/docs"/>
    <copydir src="../lib" dest="${final.dir}/lib"/>

    <copyfile src="${build.dir}/${project}.jar"
dest="${final.dir}/${project}.jar"/>

    <zip zipfile="../${project}-${version}.zip" basedir="${final.dir}/../"
includes="${final.name}/"/>

  </target>

</project>


c.
-----Original Message-----
From: David Walend [mailto:dwalend@eecs.tufts.edu]
Sent: Tuesday, July 25, 2000 8:42 PM
To: ant-dev@jakarta.apache.org
Subject: Re: Why Properties became immutable


On Tue, 25 Jul 2000, James Duncan Davidson wrote:

> on 7/25/00 7:18 AM, Stefan Bodewig at bodewig@bost.de wrote:
>
> > Actually <property> already is at the same level as <target>. I now
> > regret we didn't take the full swing to forbid placing them inside of
> > targets.
>
> Here's a vote for doing exactly that... properties belong as project
> children only.

I have what I think is a dumb newbie question. I have no doubt this thread
is over my head.

I have a source tree with client code, server code, and common code
intermangled.

I'd like to set up ant to just build the .jars for the server, or just
build the .jars for the client.

My gut take on how to do this was: set up server-jars and client-jars
targets, each of which sets properties for generic classes (calls javac)
and jars (calls jar) targets. But this won't work due to immutable
properties.

What's a good approach to solve this problem in ant?

Thanks,

Dave


Mime
View raw message