[Spread-users] [PATCH] Spread Java build

Daniel Rall dlr at finemaltcoding.com
Wed Jul 25 02:34:39 EDT 2001


[originally sent to spread at spread.org -- Yair Amir suggested I resend
to this list]

First, some background:
Since the advent of a recent conference on Spread attended by some of
my colleagues (David Pellegrini and Jason Brittain), my company
(CollabNet) is looking at Spread as the layer on which to implement
some clustering solutions.  We are heavy users of Java, but must also
integrate technologies written in other languages.  Because of this,
we have an interest in a JMS-like implementation on top of the Spread
API.

But I digress.  This mail is really to submit a patch against the Java
build system for version 3.16.0 for review and (hopefully) inclusion
into the Spread distribution.  The existing build system for the Java
client library appears to consist mostly of the spread/java/readme.txt
file.  While the existing system is nicely portable and only dependent
upon the JDK, I decided that I could do a little better.  So, I've
written an Ant <http://jakarta.apache.org/ant/> build file which
supplies all the functionality previously available only via the
commands outlined in readme.txt to JDK binaries.  Ant is an excellent
build tool, far more suited to Java builds than Make (Ant is faster
and has built-in support for JDK binaries).  And to top it off, it's
cross platform (runs on Linux, Windows, MacOS, Solaris, etc.).
Every Java-based project on apache.org has adopted it, and most other
open source and commercial project are following suite.  Anyhow, I
hope that sells you on the value of Ant as a Java build tool.  I'm
including a patch to readme.txt and my new build.xml file, both of
which live in the spread/java/ directory of the Spread source tree.

Daniel Rall


--- readme.txt-ORIG	Tue Jul 24 17:58:19 2001
+++ readme.txt	Tue Jul 24 18:32:57 2001
@@ -41,18 +41,40 @@
 subdirectory with all the .class files. (on Windows the '/' in the above
 command need to be '\' ).
 
+If you have the Ant build system <http://jakarta.apache.org/ant/>
+installed, alternately you can run:
+
+ant
+
+Or, to produce a JAR file:
+
+ant jar
+
+To compile the applications run:
+
 javac User.java 
+
 and
+
 javac Flooder.java
 
+or
+
+ant sample-apps
+
 Documentation exists in the docs direcory. the java.html page gives 
 an introduction to the Spread Java interface and the rest of the files
 are generated by javadoc.
 
 To rebuild it run:
+mkdir testdocs
 javadoc -sourcepath splib_src/ -verbose -windowtitle 'Spread for Java' \
   -nodeprecated -d testdocs splib_src/*.java
 
+or
+
+ant javadocs
+
 To run the User and Flooder programs you need to have a Spread daemon
 running (see main package for how to build and run one). Then you can do
 
@@ -66,4 +88,3 @@
 If you want to run multiple copies of the application add the -u username 
 parameter to the commandline giving each instance of the application a
 new username.
-



<?xml version="1.0"?>

<!-- ================================================================= -->
<!-- Build file for Spread client Java implementation                  -->
<!--                                                                   -->
<!-- original author: Daniel Rall <dlr at finemaltcoding.com>             -->
<!-- ================================================================= -->
<project name="spread" default="jar" basedir=".">

        <property name="Name" value="Spread"/>
        <property name="version" value="3.16.0"/>
        <property name="project" value="spread"/>
        <property name="title" value="${Name} ${version} API for Java"/>
        <property name="year" value="2001"/>
        <property name="build.compiler" value="jikes"/>
        <property name="build.dir" value="dest"/>
        <property name="build.src" value="${build.dir}/src"/>
        <property name="build.dest" value="${build.dir}/class"/>
        <property name="src.java.dir" value="splib_src"/>
        <property name="jar.name" value="${project}-${version}.jar"/>
        <property name="lib.dir" value="/usr/lib/java"/>
        <property name="sample.build.src" value="${build.dir}/sample"/>
        <property name="javadoc.destdir" value="testdocs"/>
        <property name="debug" value="on"/>
        <property name="optimize" value="off"/>
        <property name="deprecation" value="on"/>

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

    <!-- ================================================================= -->
    <!-- Compiles the source directory                                     -->
    <!-- ================================================================= -->
    <target name="compile" depends="prepare">
        <javac srcdir="${src.java.dir}"
            destdir="${build.dest}"
            debug="${debug}"
            deprecation="${deprecation}"
            optimize="${optimize}">
        </javac>
    </target>

    <target name="sample-apps" depends="jar">
        <copy todir="${sample.build.src}">
            <fileset dir="." includes="*.java"/>
        </copy>
        <javac srcdir="${sample.build.src}"
            destdir="."
            debug="${debug}"
            deprecation="${deprecation}"
            optimize="${optimize}">
        </javac>
        <delete dir="${sample.build.src}"/>
    </target>

    <!-- ================================================================= -->
    <!-- Compiles the source directory and creates a .jar file             -->
    <!-- ================================================================= -->
    <target name="jar" depends="clean,compile">
        <jar jarfile="${build.dir}/${jar.name}"
            basedir="${build.dest}"
            excludes="**/package.html"/>
    </target>

    <target name="install">
        <copy file="${build.dir}/${jar.name}"
              tofile="${lib.dir}/${jar.name}"/>
    </target>

    <!-- ================================================================= -->
    <!-- Makes everything including install                                -->
    <!-- ================================================================= -->
    <target name="all" depends="jar,install"/>

    <!-- ================================================================= -->
    <!-- Creates the API documentation                                     -->
    <!-- ================================================================= -->
    <target name="javadocs" depends="prepare">
        <mkdir dir="${javadoc.destdir}"/>
        <mkdir dir="${build.src}/spread"/>
        <copy todir="${build.src}/spread">
            <fileset dir="${src.java.dir}" includes="*.java"/>
        </copy>
        <javadoc
            sourcepath="${build.src}"
            packagenames="spread.*"
            destdir="${javadoc.destdir}"
            author="true"
            private="true"
            version="true"
            use="true"
            windowtitle="${title}"
            doctitle="${title}"
            bottom="Copyright &#169; ${year} Spread Concepts LLC. All Rights Reserved."
        />
        <delete dir="${build.src}/spread"/>
    </target>
    
    <!-- ================================================================= -->
    <!-- Cleans up the build directory                                     -->
    <!-- ================================================================= -->
    <target name="clean">
        <delete dir="${build.dir}"/>
    </target>

</project>





More information about the Spread-users mailing list