]> granicus.if.org Git - postgresql/commitdiff
Resolve a number of oddities in the Java build. First, remove the weird
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 6 Jul 2001 23:07:20 +0000 (23:07 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 6 Jul 2001 23:07:20 +0000 (23:07 +0000)
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.

build.xml [deleted file]
contrib/Makefile
contrib/retep/Makefile [new file with mode: 0644]
contrib/retep/build.xml
src/interfaces/jdbc/Makefile
src/interfaces/jdbc/build.xml

diff --git a/build.xml b/build.xml
deleted file mode 100644 (file)
index daee9f4..0000000
--- a/build.xml
+++ /dev/null
@@ -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>
-  
index 7b3bbcb6fe03c940a283219cf2adb7a92134ed74..79dfa28ce4491d0a883ad5acc94d9484310c9dd3 100644 (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 \
diff --git a/contrib/retep/Makefile b/contrib/retep/Makefile
new file mode 100644 (file)
index 0000000..e5de9c7
--- /dev/null
@@ -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
index 9fbc0f61ac57a0dcf6c01c4fe3ac2beb37d4b2c6..04a8db5c2f01186452a6f51c8ba5e1cee39d218f 100644 (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">
   </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>
index c40de4e0bc0ecb976dc4dc35d1c2880ca573185d..311645a6c65b2d3f66247712856aadfe19a0a616 100644 (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
index 9d70e2cbb8a30601ab2a54b5cc1d66a8b6660fd9..114d05813b0ca969ff3cbdd469f921a5804ce5d1 100644 (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
     <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" />
           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>