And-based build of Java files and new testing infrastructure.

This commit is contained in:
Diomidis Spinellis 2005-11-15 16:02:13 +00:00
parent 34274b2a59
commit b748db9131
3 changed files with 67 additions and 108 deletions

View File

@ -3,40 +3,59 @@
#
.SUFFIXES:.class .java
VERSION=3.3
VERSION=4.1
TARBALL=UMLGraph-$(VERSION).tar.gz
ZIPBALL=UMLGraph-$(VERSION).zip
DISTDIR=UMLGraph-$(VERSION)
WEBDIR=/dds/pubs/web/home/sw/umlgraph
SRCFILE=UmlGraph.java sequence.pic README.txt
DOCLETSRCPATH=src/gr/spinellis/umlgraph/doclet
DOCLETSRC= \
$(DOCLETSRCPATH)/ClassGraph.java \
$(DOCLETSRCPATH)/ClassInfo.java \
$(DOCLETSRCPATH)/Options.java \
$(DOCLETSRCPATH)/StringUtil.java \
$(DOCLETSRCPATH)/UmlGraph.java \
$(DOCLETSRCPATH)/Version.java
TESTSRC = \
src/gr/spinellis/umlgraph/test/DotDiff.java \
src/gr/spinellis/umlgraph/test/BasicTest.java
PICFILE=sequence.pic
README=README.txt
JARFILE=lib/UmlGraph.jar
LF=perl -p -e 'BEGIN {binmode(STDOUT);} s/\r//'
.java.class:
javac -Xlint -classpath d:/jdk/lib/tools.jar $<
all: $(JARFILE)
all: UmlGraph.jar
tarball: $(TARBALL)
$(TARBALL): UmlGraph.jar docs Makefile
src/gr/spinellis/umlgraph/doclet/Version.java: Makefile
echo "/* Automatically generated file */" >$@
echo "package gr.spinellis.umlgraph.doclet;" >>$@
echo "class Version { public static String VERSION = \"$(VERSION)\";}" >>$@
$(TARBALL): $(JARFILE) docs Makefile
-cmd /c rd /s/q $(DISTDIR)
mkdir $(DISTDIR)
mkdir $(DISTDIR)/doc
mkdir $(DISTDIR)/lib
cp $(WEBDIR)/doc/* $(DISTDIR)/doc
cp UmlGraph.jar $(DISTDIR)
for i in $(SRCFILE) ;\
do\
perl -p -e 'BEGIN {binmode(STDOUT);} s/\r//' $$i >$(DISTDIR)/$$i;\
done
cp $(JARFILE) $(DISTDIR)/lib
cp build.xml $(DISTDIR)
tar cf - src testdata/{java,dot-ref} --exclude='*/RCS' | tar -C $(DISTDIR) -xvf -
$(LF) $(PICFILE) >$(DISTDIR)/lib/$(PICFILE)
$(LF) $(PICFILE) >$(DISTDIR)/src/$(PICFILE)
$(LF) $(README) >$(DISTDIR)/src/$(README)
tar cvf - $(DISTDIR) | gzip -c >$(TARBALL)
zip -r $(ZIPBALL) $(DISTDIR)
docs:
(cd doc && make)
UmlGraph.jar: UmlGraph.class
jar cvf UmlGraph.jar ClassGraph.class ClassInfo.class Options.class \
StringUtil.class UmlGraph.class
jar i UmlGraph.jar
$(JARFILE): $(DOCLETSRC)
ant compile
UmlGraph.class: UmlGraph.java
test:
ant test
web: $(TARBALL) CHECKSUM.MD5
cp $(TARBALL) $(ZIPBALL) CHECKSUM.MD5 $(WEBDIR)

View File

@ -5,11 +5,18 @@ UML class and sequence diagrams. You can browse the system's
documentation from the doc/index.html page, or print it from
doc/indexw.html.
To compile the Java doclet from the source code simply execute:
javac -classpath YOUR_JDK_DIRECTORY/lib/tools.jar UmlGraph.java
jar cvf UmlGraph.jar ClassGraph.class ClassInfo.class Options.class StringFuns.class UmlGraph.class
jar i UmlGraph.jar
To install the elements required to run UMLGraph, simply copy
the contents of the lib directory to a location consistent with
your installation's conventions (for example to /usr/local/lib).
To compile the Java doclet from the source code run ant on the
build.xml file.
If you change the source code, you can run regression tests by
executing "ant test".
Project home page: http://www.spinellis.gr/sw/umlgraph
Diomidis Spinellis - May 2004
Diomidis Spinellis - November 2005
$Id$

107
build.xml
View File

@ -1,109 +1,42 @@
<project name="umlgraph" default="dist" basedir=".">
<project name="umlgraph" default="compile" basedir=".">
<description>
The specification for all umlgraph build processes.
The specification for the Java-based umlgraph build processes.
$Id$
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="images" location="images"/>
<property name="dist" location="/dds/pubs/web/home/sw/umlgraph"/>
<property name="lib" location="lib"/>
<property name="testsrc" location="test/src"/>
<!-- import environment varibles -->
<property environment="env"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${build}/classes"/>
<mkdir dir="${images}"/>
<mkdir dir="${images}/dot"/>
<mkdir dir="${images}/ps"/>
<mkdir dir="${images}/gif"/>
<mkdir dir="${lib}"/>
<mkdir dir="testdata/dot-out"/>
</target>
<target name="compile" depends="init"
description="compile the source, build library " >
<javac srcdir="${src}" destdir="${build}/classes" excludes="RCS/*"/>
<jar basedir="${build}/classes" destfile="${build}/UmlGraph.jar"/>
<javac srcdir="${src}" destdir="${build}" excludes="gr/spinellis/umlgraph/doclet/RCS/*,gr/spinellis/umlgraph/test/RCS/*"/>
<jar basedir="${build}" destfile="${lib}/UmlGraph.jar" includes="gr/spinellis/umlgraph/doclet/*.class"/>
</target>
<target name="ps" depends="dot"
description="create Postscript files out of the compiled dot sources" >
<apply executable="dot" dest="images/ps" parallel="false">
<arg value="-Tps"/>
<arg value="-o"/>
<targetfile/>
<srcfile/>
<fileset dir="images/dot"/>
<mapper type="glob" from="*.dot" to="*.ps"/>
</apply>
</target>
<target name="gif" depends="dot"
description="create GIF files out of the compiled dot sources" >
<apply executable="dot" dest="images/gif" parallel="false">
<arg value="-Tgif"/>
<arg value="-o"/>
<targetfile/>
<srcfile/>
<fileset dir="images/dot"/>
<mapper type="glob" from="*.dot" to="*.gif"/>
</apply>
</target>
<target name="dot" depends="compile"
description="create dot files out of the Java image sources" >
<dependset>
<srcfilelist
dir="${build}"
files="UmlGraph.jar"/>
<targetfileset
dir="images/dot"
includes="*.dot"/>
</dependset>
<apply executable="javadoc" dest="images/dot" parallel="false">
<arg value="-docletpath"/>
<arg value="${build}/UmlGraph.jar"/>
<arg line="-doclet UmlGraph"/>
<arg value="-private"/>
<arg value="-output"/>
<targetfile/>
<srcfile/>
<fileset dir="imgsrc"/>
<mapper type="glob" from="*.java" to="*.dot"/>
</apply>
</target>
<target name="dist" depends="compile,dot,gif"
description="generate the distribution" >
<!-- Create a fresh distribution directory -->
<delete dir="${dist}"/>
<mkdir dir="${dist}"/>
<!-- source files -->
<copy todir="${dist}" flatten="yes">
<fileset dir="${src}">
<include name="*.java"/>
</fileset>
</copy>
<!-- Java image source files -->
<copy todir="${dist}" flatten="yes">
<fileset dir="imgsrc"/>
</copy>
<!-- Dot image source files -->
<copy todir="${dist}" flatten="yes">
<fileset dir="${images}/dot"/>
</copy>
<!-- GIF image files -->
<copy todir="${dist}" flatten="yes">
<fileset dir="${images}/gif"/>
</copy>
<copy todir="${dist}" flatten="yes" file="makefile"/>
<copy todir="${dist}" flatten="yes" file="build.xml"/>
<copy todir="${dist}" flatten="yes" file="index.html"/>
<copy todir="${dist}" flatten="yes" file="${build}/UmlGraph.jar"/>
<target name="test" depends="compile"
description="run the regression tests" >
<java classname="gr.spinellis.umlgraph.test.BasicTest" fork="true">
<classpath>
<pathelement location="${env.JAVA_HOME}/lib/tools.jar"/>
<pathelement location="${build}"/>
<pathelement location="${lib}/UmlGraph.jar"/>
</classpath>
</java>
</target>
</project>