Resolve a number of oddities in the Java build. First, remove the weird

redirections between the build files, which didn't work completely.  Now
you just go to the directory of your choice and run make.  Clean up the
build files to have a logical order, fix the unnecessary rebuilds, prevent
the deleting targets from removing files they're not responsible for.  Ant
1.3 does not have a bug.  It deletes directories just fine if you follow
the documentation.
This commit is contained in:
Peter Eisentraut 2001-07-06 23:07:20 +00:00
parent 55432fedd2
commit af3ce5daa4
6 changed files with 205 additions and 225 deletions

101
build.xml
View File

@ -1,101 +0,0 @@
<!--
build file to allow ant (http://jakarta.apache.org/ant/) to be used
to build the PostgreSQL JDBC Driver and any associated java utilities under
/contrib.
This is placed here for three reasons:
1: You only need to run ANT once to get everything.
2: To let people know that there are more java sources under /contrib.
3: In the next release (after 7.1) it's intended to have configure to
detect the presence of both the JDK and ANT, and if both are found
to build the jdbc driver and utils with the rest of postgresql.
$Id: build.xml,v 1.3 2001/03/11 11:06:59 petere Exp $
-->
<project name="postgresql" default="jar" basedir=".">
<!--
This is the normal entry point. It builds first the
jdbc driver, then the extra tools.
-->
<target name="jar">
<antcall target="call">
<param name="target" value="jar" />
</antcall>
</target>
<!--
This entry point clears the source tree. Call this when you want
to build a clean install.
-->
<target name="clean">
<antcall target="call">
<param name="target" value="clean" />
</antcall>
</target>
<!--
This entry point installs the .jar files into an install directory.
To use this, call ant as follows:
ant -Dinstall.directory=mydir install
Where mydir is the _Absolute_ path of the directory to create.
If the directory mydir does not exist it will be created.
If the directory is not absolute then the install will fail by
creating subdirectories in the build path. Be careful.
This is intended for "make install" to call it.
e.g.
Windows: ant -Dc:\jars install
Unix: ant -Dinstall.directory=/usr/local/lib/jars install
Cygwin: ant -Dinstall.directory=$(cygpath -w /usr/local/lib/jars) install
-->
<target name="install" if="install.directory">
<mkdir dir="${install.directory}" />
<antcall target="call">
<param name="target" value="install" />
</antcall>
</target>
<target name="uninstall" if="install.directory">
<antcall target="call">
<param name="target" value="uninstall" />
</antcall>
</target>
<!--
This actually calls the other two build.xml files.
To use it, use the <antcall> tag, and pass the destination target
within a <param> tag using name="target".
ie:
<antcall target="call">
<param name="target" value="mytarget" />
</antcall>
Here, the target mytarget will be called from all the sub build.xml
files.
Note: The target must be present in _ALL_ build.xml files otherwise
the build will fail.
-->
<target name="call">
<ant dir="src/interfaces/jdbc" target="${target}" />
<ant dir="contrib/retep" target="${target}" />
</target>
</project>

View File

@ -1,4 +1,4 @@
# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.22 2001/06/18 17:20:56 momjian Exp $
# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.23 2001/07/06 23:07:19 petere Exp $
subdir = contrib
top_builddir = ..
@ -38,6 +38,11 @@ WANTED_DIRS = \
userlock \
vacuumlo
ifeq ($(with_java),yes)
WANTED_DIRS += retep
endif
all install installdirs uninstall clean distclean maintainer-clean:
for dir in $(WANTED_DIRS); do \
if [ -f $$dir/Makefile ]; then \

30
contrib/retep/Makefile Normal file
View File

@ -0,0 +1,30 @@
#-------------------------------------------------------------------------
#
# Makefile for contributed retep tools
#
# Copyright (c) 2001, PostgreSQL Global Development Group
#
# $Header: /cvsroot/pgsql/contrib/retep/Attic/Makefile,v 1.1 2001/07/06 23:07:20 petere Exp $
#
#-------------------------------------------------------------------------
subdir = contrib/retep
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
all:
$(ANT) -buildfile $(srcdir)/build.xml all
install: installdirs
$(ANT) -buildfile $(srcdir)/build.xml install \
-Dinstall.directory=$(javadir)
installdirs:
$(mkinstalldirs) $(javadir)
uninstall:
$(ANT) -buildfile $(srcdir)/build.xml uninstall \
-Dinstall.directory=$(javadir)
clean distclean maintainer-clean:
$(ANT) -buildfile $(srcdir)/build.xml clean

View File

@ -1,18 +1,23 @@
<?xml version="1.0"?>
<!--
build file to build the donated retep tools packages
$Id: build.xml,v 1.7 2001/05/17 03:22:53 momjian Exp $
$Header: /cvsroot/pgsql/contrib/retep/Attic/build.xml,v 1.8 2001/07/06 23:07:20 petere Exp $
-->
<project name="retep" default="jar" basedir=".">
<!DOCTYPE project [
<!ENTITY jarname "retepTools.jar">
]>
<project name="retep" default="all" basedir=".">
<!-- set global properties for this build -->
<property name="src" value="." />
<property name="dest" value="build" />
<property name="srcdir" value="." />
<property name="builddir" value="build" />
<property name="package" value="uk/org/retep" />
<property name="jars" value="jars" />
<property name="jardir" value="jars" />
<!-- Some checks used to build dependent on the environment -->
<target name="checks">
@ -23,53 +28,71 @@
</target>
<target name="warning" depends="checks" unless="jdk1.2+">
<echo message="WARNING -- contributed retep tools need jdk1.2 or later -- compilation NOT done." />
<echo>
*** WARNING: Contributed retep tools need jdk1.2 or later.
*** Compilation NOT done
</echo>
</target>
<!-- Prepares the build by creating a directory to place the class files -->
<target name="prepare">
<mkdir dir="${dest}" />
<mkdir dir="${jars}" />
<!-- default target -->
<target name="all">
<antcall target="jar" />
</target>
<!-- This target removes any class files from the build directory -->
<target name="clean">
<delete>
<fileset dir="${dest}" />
<fileset dir="${jars}" />
</delete>
</target>
<!-- Builds the various jar files -->
<target name="jar" depends="compile">
<jar jarfile="${jardir}/&jarname;" whenempty="fail">
<fileset dir="${builddir}">
<include name="**/*.class" />
</fileset>
<fileset dir="${srcdir}">
<include name="**/*.properties" />
</fileset>
</jar>
</target>
<!-- Builds the XML Tools -->
<target name="compile" depends="checks,prepare,warning" if="jdk1.2+">
<javac srcdir="${src}" destdir="${dest}">
<javac srcdir="${srcdir}" destdir="${builddir}">
<include name="${package}/**" />
<exclude name="${package}/**" unless="jdk1.2+" />
</javac>
</target>
<!-- Builds the various jar files -->
<target name="jar" depends="compile">
<jar jarfile="${jars}/retepTools.jar" basedir="${dest}">
<include name="${package}/**" />
</jar>
<!-- Prepares the build by creating a directory to place the class files -->
<target name="prepare">
<mkdir dir="${builddir}" />
<mkdir dir="${jardir}" />
</target>
<target name="install" depends="jar" if="install.directory">
<target name="install" depends="all" if="install.directory">
<copy todir="${install.directory}" overwrite="true" filtering="off">
<fileset dir="${jars}">
<include name="**/*.jar" />
<fileset dir="${jardir}">
<include name="&jarname;" />
</fileset>
</copy>
</target>
<target name="uninstall" if="install.directory">
<delete>
<fileset dir="${install.directory}">
<include name="**/*.jar" />
<include name="&jarname;" />
</fileset>
</delete>
</target>
<!-- This target removes any class files from the build directory -->
<target name="clean">
<delete quiet="true" dir="${builddir}" />
<delete quiet="true" dir="${jardir}" />
</target>
</project>

View File

@ -1,10 +1,10 @@
#-------------------------------------------------------------------------
#
# Makefile for src/interfaces
# Makefile for JDBC driver
#
# Copyright (c) 1994, Regents of the University of California
# Copyright (c) 2001, PostgreSQL Global Development Group
#
# $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/Makefile,v 1.32 2001/06/07 20:24:54 momjian Exp $
# $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/Makefile,v 1.33 2001/07/06 23:07:20 petere Exp $
#
#-------------------------------------------------------------------------
@ -20,22 +20,22 @@ properties := -Dmajor=$(majorversion) -Dminor=$(minorversion) \
-Ddef_pgport=$(DEF_PGPORT)
all:
$(ANT) -buildfile $(top_srcdir)/build.xml $(properties)
$(ANT) -buildfile $(srcdir)/build.xml all \
$(properties)
install: installdirs
$(ANT) -Dinstall.directory=$(javadir) \
-buildfile $(top_srcdir)/build.xml \
install $(properties)
$(ANT) -buildfile $(srcdir)/build.xml install \
-Dinstall.directory=$(javadir) $(properties)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(datadir)/java
$(mkinstalldirs) $(javadir)
uninstall:
$(ANT) -Dinstall.directory=$(DESTDIR)$(datadir)/java \
-buildfile $(top_srcdir)/build.xml \
uninstall
$(ANT) -buildfile $(srcdir)/build.xml uninstall \
-Dinstall.directory=$(javadir)
clean distclean maintainer-clean:
$(ANT) -buildfile $(top_srcdir)/build.xml clean
# ANT 1.3 has a bug that prevents directory deletion
rm -rf build jars
$(ANT) -buildfile $(srcdir)/build.xml clean
check:
$(ANT) -buildfile $(srcdir)/build.xml test

View File

@ -1,31 +1,25 @@
<?xml version="1.0"?>
<!--
build file to allow ant (http://jakarta.apache.org/ant/) to be used
to build the PostgreSQL JDBC Driver.
to build the PostgreSQL JDBC Driver
$Id: build.xml,v 1.16 2001/07/04 15:07:54 momjian Exp $
$Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.17 2001/07/06 23:07:20 petere Exp $
-->
<project name="postgresqlJDBC" default="jar" basedir=".">
<!DOCTYPE project [
<!ENTITY jarfiles "postgresql.jar,postgresql-examples.jar">
]>
<project name="postgresqlJDBC" default="all" basedir=".">
<!-- set global properties for this build -->
<property name="src" value="." />
<property name="jars" value="jars" />
<property name="dest" value="build" />
<property name="srcdir" value="." />
<property name="jardir" value="jars" />
<property name="builddir" value="build" />
<property name="package" value="org/postgresql" />
<!--
defaults for the tests - overide these if required
junit.ui is one of textui, awtui or swingui
password must be something. Doesnt matter if trust is used!
-->
<property name="database" value="jdbc:postgresql:test" />
<property name="username" value="test" />
<property name="password" value="password" />
<property name="tablename" value="jdbctest" />
<property name="junit.ui" value="textui" />
<!--
This is a simpler method than utils.CheckVersion
@ -41,12 +35,62 @@
<available property="junit" classname="junit.framework.Test" />
</target>
<!-- default target -->
<target name="all">
<antcall target="jar" />
</target>
<!-- create the jar file -->
<target name="jar" depends="compile,examples">
<jar jarfile="${jardir}/postgresql.jar" whenempty="fail">
<fileset dir="${builddir}">
<include name="${package}/**/*.class" />
<exclude name="${package}/test/**" />
</fileset>
<fileset dir="${srcdir}">
<include name="${package}/*.properties" />
</fileset>
</jar>
<jar jarfile="${jardir}/postgresql-examples.jar" whenempty="fail">
<fileset dir="${builddir}">
<include name="example/**/*.class" />
</fileset>
<fileset dir="${srcdir}">
<include name="example/*.properties" />
</fileset>
</jar>
</target>
<!-- This is the core of the driver. It is common for all three versions. -->
<target name="compile" depends="prepare,check_versions,driver">
<javac srcdir="${srcdir}" destdir="${builddir}">
<include name="${package}/**" />
<exclude name="${package}/jdbc1/**" if="jdk1.2+" />
<exclude name="${package}/jdbc2/**" unless="jdk1.2+" />
<exclude name="${package}/largeobject/PGblob.java" unless="jdk1.2+" />
<exclude name="${package}/largeobject/PGclob.java" unless="jdk1.2+" />
<exclude name="${package}/PostgresqlDataSource.java" unless="jdk1.2e+" />
<exclude name="${package}/xa/**" unless="jdk1.2e+" />
<exclude name="${package}/test/**" unless="junit" />
</javac>
</target>
<!--
This generates Driver.java from Driver.java.in
It's required for importing the driver version properties
-->
<target name="driver" depends="prepare,check_versions">
<!-- determine the edition text -->
<property name="edition" value="JDBC1" />
<available property="edition" value="JDBC2" classname="java.lang.ThreadLocal" />
@ -71,115 +115,94 @@
tofile="${package}/Driver.java"
filtering="yes" />
<echo message="Configured build for the ${edition} edition driver." />
<echo message="Configured build for the ${edition} edition driver" />
</target>
<!-- This target removes any class files from the build directory -->
<target name="clean">
<!--
This should be just 'delete', but ant 1.3 fails.
This code doesn't delete the directories. bjm 2001-05-25
-->
<delete>
<fileset dir="${dest}" />
<fileset dir="${jars}" />
</delete>
<delete file="${package}/Driver.java" />
</target>
<!-- Prepares the build directory -->
<target name="prepare">
<mkdir dir="${dest}" />
<mkdir dir="${jars}" />
<mkdir dir="${builddir}" />
<mkdir dir="${jardir}" />
</target>
<!-- This is the core of the driver. It is common for all three versions -->
<target name="compile" depends="prepare,check_versions,driver">
<javac srcdir="${src}" destdir="${dest}">
<include name="${package}/**" />
<exclude name="${package}/jdbc1/**" if="jdk1.2+" />
<exclude name="${package}/jdbc2/**" unless="jdk1.2+" />
<exclude name="${package}/largeobject/PGblob.java" unless="jdk1.2+" />
<exclude name="${package}/largeobject/PGclob.java" unless="jdk1.2+" />
<exclude name="${package}/PostgresqlDataSource.java" unless="jdk1.2e+" />
<exclude name="${package}/xa/**" unless="jdk1.2e+" />
<exclude name="${package}/test/**" unless="junit" />
</javac>
<copy todir="${dest}" overwrite="true" filtering="on">
<fileset dir="${src}">
<include name="${package}/**/*.properties" />
<exclude name="${dest}/**" />
</fileset>
</copy>
</target>
<!-- This builds the examples -->
<target name="examples" depends="compile">
<javac srcdir="${src}" destdir="${dest}">
<javac srcdir="${srcdir}" destdir="${builddir}">
<include name="example/**" />
<exclude name="example/corba/**"/>
<exclude name="example/blobtest.java" unless="jdk1.2+"/>
</javac>
</target>
<!-- Builds the corba example -->
<target name="corba" if="jdk1.2+">
<exec dir="${src}/example/corba" executable="idl2java">
<exec dir="${srcdir}/example/corba" executable="idl2java">
<arg value="stock.idl" />
</exec>
<javac srcdir="${src}" destdir="${dest}">
<javac srcdir="${srcdir}" destdir="${builddir}">
<include name="example/corba/**" />
</javac>
</target>
<!-- This builds the jar file containing the driver -->
<target name="jar" depends="compile,examples">
<jar jarfile="${jars}/postgresql.jar" basedir="${dest}" includes="${package}/**/*.class,${package}/*.properties" excludes="${package}/test/**"/>
<jar jarfile="${jars}/postgresql-examples.jar" basedir="${dest}" includes="example/**/*.class,example/*.properties" />
</target>
<!--
This installs the jar file. It's called by the build.xml file in the
root directory of the source (where configure is). Refer to that file
on how to use it.
-->
<target name="install" depends="jar" if="install.directory">
<copy todir="${install.directory}" overwrite="true" filtering="off">
<fileset dir="${jars}">
<include name="**/*.jar" />
</fileset>
<!-- Install the jar files -->
<target name="install" depends="all" if="install.directory">
<copy todir="${install.directory}" overwrite="true">
<fileset dir="${jardir}" includes="&jarfiles;" />
</copy>
</target>
<!--
Uninstall the jar file.
-->
<!-- Uninstall the jar file -->
<target name="uninstall" if="install.directory">
<delete>
<fileset dir="${install.directory}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${install.directory}" includes="&jarfiles;" />
</delete>
</target>
<!--
This compiles and executes the JUnit tests
-->
<!-- This target removes any class files from the build directory -->
<target name="clean">
<delete quiet="true" dir="${builddir}" />
<delete quiet="true" dir="${jardir}" />
<delete quiet="true" file="${package}/Driver.java" />
</target>
<!-- This compiles and executes the JUnit tests -->
<!-- defaults for the tests - override these if required -->
<property name="database" value="jdbc:postgresql:test" />
<property name="username" value="test" />
<!-- Password must be something. Doesn't matter if trust is used! -->
<property name="password" value="password" />
<property name="tablename" value="jdbctest" />
<!-- junit.ui is one of textui, awtui, or swingui -->
<property name="junit.ui" value="textui" />
<target name="test" depends="jar" if="junit">
<javac srcdir="${src}" destdir="${dest}">
<javac srcdir="${srcdir}" destdir="${builddir}">
<include name="${package}/test/jdbc2/**" if="jdk1.2+" />
<include name="${package}/test/java2ee/**" if="jdk1.2e+" />
</javac>
<java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true">
<arg value="org.postgresql.test.JDBC2Tests" />
<sysproperty key="database" value="${database}" />
<sysproperty key="username" value="${username}" />
<sysproperty key="password" value="${password}" />
<classpath>
<pathelement location="${dest}" />
<pathelement location="${builddir}" />
<pathelement path="${java.class.path}" />
</classpath>
</java>
</target>
</project>