提交 af3ce5da 编写于 作者: P Peter Eisentraut

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.
上级 55432fed
<!--
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>
# $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 subdir = contrib
top_builddir = .. top_builddir = ..
...@@ -38,6 +38,11 @@ WANTED_DIRS = \ ...@@ -38,6 +38,11 @@ WANTED_DIRS = \
userlock \ userlock \
vacuumlo vacuumlo
ifeq ($(with_java),yes)
WANTED_DIRS += retep
endif
all install installdirs uninstall clean distclean maintainer-clean: all install installdirs uninstall clean distclean maintainer-clean:
for dir in $(WANTED_DIRS); do \ for dir in $(WANTED_DIRS); do \
if [ -f $$dir/Makefile ]; then \ if [ -f $$dir/Makefile ]; then \
......
#-------------------------------------------------------------------------
#
# 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
<?xml version="1.0"?>
<!-- <!--
build file to build the donated retep tools packages 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 --> <!-- set global properties for this build -->
<property name="src" value="." /> <property name="srcdir" value="." />
<property name="dest" value="build" /> <property name="builddir" value="build" />
<property name="package" value="uk/org/retep" /> <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 --> <!-- Some checks used to build dependent on the environment -->
<target name="checks"> <target name="checks">
...@@ -23,53 +28,71 @@ ...@@ -23,53 +28,71 @@
</target> </target>
<target name="warning" depends="checks" unless="jdk1.2+"> <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> </target>
<!-- Prepares the build by creating a directory to place the class files --> <!-- default target -->
<target name="prepare"> <target name="all">
<mkdir dir="${dest}" /> <antcall target="jar" />
<mkdir dir="${jars}" />
</target> </target>
<!-- This target removes any class files from the build directory -->
<target name="clean"> <!-- Builds the various jar files -->
<delete> <target name="jar" depends="compile">
<fileset dir="${dest}" /> <jar jarfile="${jardir}/&jarname;" whenempty="fail">
<fileset dir="${jars}" /> <fileset dir="${builddir}">
</delete> <include name="**/*.class" />
</target> </fileset>
<fileset dir="${srcdir}">
<include name="**/*.properties" />
</fileset>
</jar>
</target>
<!-- Builds the XML Tools --> <!-- Builds the XML Tools -->
<target name="compile" depends="checks,prepare,warning" if="jdk1.2+"> <target name="compile" depends="checks,prepare,warning" if="jdk1.2+">
<javac srcdir="${src}" destdir="${dest}"> <javac srcdir="${srcdir}" destdir="${builddir}">
<include name="${package}/**" /> <include name="${package}/**" />
<exclude name="${package}/**" unless="jdk1.2+" /> <exclude name="${package}/**" unless="jdk1.2+" />
</javac> </javac>
</target> </target>
<!-- Builds the various jar files -->
<target name="jar" depends="compile"> <!-- Prepares the build by creating a directory to place the class files -->
<jar jarfile="${jars}/retepTools.jar" basedir="${dest}"> <target name="prepare">
<include name="${package}/**" /> <mkdir dir="${builddir}" />
</jar> <mkdir dir="${jardir}" />
</target> </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"> <copy todir="${install.directory}" overwrite="true" filtering="off">
<fileset dir="${jars}"> <fileset dir="${jardir}">
<include name="**/*.jar" /> <include name="&jarname;" />
</fileset> </fileset>
</copy> </copy>
</target> </target>
<target name="uninstall" if="install.directory"> <target name="uninstall" if="install.directory">
<delete> <delete>
<fileset dir="${install.directory}"> <fileset dir="${install.directory}">
<include name="**/*.jar" /> <include name="&jarname;" />
</fileset> </fileset>
</delete> </delete>
</target> </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> </project>
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# 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) \ ...@@ -20,22 +20,22 @@ properties := -Dmajor=$(majorversion) -Dminor=$(minorversion) \
-Ddef_pgport=$(DEF_PGPORT) -Ddef_pgport=$(DEF_PGPORT)
all: all:
$(ANT) -buildfile $(top_srcdir)/build.xml $(properties) $(ANT) -buildfile $(srcdir)/build.xml all \
$(properties)
install: installdirs install: installdirs
$(ANT) -Dinstall.directory=$(javadir) \ $(ANT) -buildfile $(srcdir)/build.xml install \
-buildfile $(top_srcdir)/build.xml \ -Dinstall.directory=$(javadir) $(properties)
install $(properties)
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(datadir)/java $(mkinstalldirs) $(javadir)
uninstall: uninstall:
$(ANT) -Dinstall.directory=$(DESTDIR)$(datadir)/java \ $(ANT) -buildfile $(srcdir)/build.xml uninstall \
-buildfile $(top_srcdir)/build.xml \ -Dinstall.directory=$(javadir)
uninstall
clean distclean maintainer-clean: clean distclean maintainer-clean:
$(ANT) -buildfile $(top_srcdir)/build.xml clean $(ANT) -buildfile $(srcdir)/build.xml clean
# ANT 1.3 has a bug that prevents directory deletion
rm -rf build jars check:
$(ANT) -buildfile $(srcdir)/build.xml test
<?xml version="1.0"?>
<!-- <!--
build file to allow ant (http://jakarta.apache.org/ant/) to be used 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 --> <!-- set global properties for this build -->
<property name="src" value="." /> <property name="srcdir" value="." />
<property name="jars" value="jars" /> <property name="jardir" value="jars" />
<property name="dest" value="build" /> <property name="builddir" value="build" />
<property name="package" value="org/postgresql" /> <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 This is a simpler method than utils.CheckVersion
...@@ -41,12 +35,62 @@ ...@@ -41,12 +35,62 @@
<available property="junit" classname="junit.framework.Test" /> <available property="junit" classname="junit.framework.Test" />
</target> </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 This generates Driver.java from Driver.java.in
It's required for importing the driver version properties It's required for importing the driver version properties
--> -->
<target name="driver" depends="prepare,check_versions"> <target name="driver" depends="prepare,check_versions">
<!-- determine the edition text --> <!-- determine the edition text -->
<property name="edition" value="JDBC1" /> <property name="edition" value="JDBC1" />
<available property="edition" value="JDBC2" classname="java.lang.ThreadLocal" /> <available property="edition" value="JDBC2" classname="java.lang.ThreadLocal" />
...@@ -71,115 +115,94 @@ ...@@ -71,115 +115,94 @@
tofile="${package}/Driver.java" tofile="${package}/Driver.java"
filtering="yes" /> filtering="yes" />
<echo message="Configured build for the ${edition} edition driver." /> <echo message="Configured build for the ${edition} edition driver" />
</target> </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 --> <!-- Prepares the build directory -->
<target name="prepare"> <target name="prepare">
<mkdir dir="${dest}" /> <mkdir dir="${builddir}" />
<mkdir dir="${jars}" /> <mkdir dir="${jardir}" />
</target> </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 --> <!-- This builds the examples -->
<target name="examples" depends="compile"> <target name="examples" depends="compile">
<javac srcdir="${src}" destdir="${dest}"> <javac srcdir="${srcdir}" destdir="${builddir}">
<include name="example/**" /> <include name="example/**" />
<exclude name="example/corba/**"/> <exclude name="example/corba/**"/>
<exclude name="example/blobtest.java" unless="jdk1.2+"/> <exclude name="example/blobtest.java" unless="jdk1.2+"/>
</javac> </javac>
</target> </target>
<!-- Builds the corba example --> <!-- Builds the corba example -->
<target name="corba" if="jdk1.2+"> <target name="corba" if="jdk1.2+">
<exec dir="${src}/example/corba" executable="idl2java"> <exec dir="${srcdir}/example/corba" executable="idl2java">
<arg value="stock.idl" /> <arg value="stock.idl" />
</exec> </exec>
<javac srcdir="${src}" destdir="${dest}">
<javac srcdir="${srcdir}" destdir="${builddir}">
<include name="example/corba/**" /> <include name="example/corba/**" />
</javac> </javac>
</target> </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 <!-- Install the jar files -->
root directory of the source (where configure is). Refer to that file <target name="install" depends="all" if="install.directory">
on how to use it. <copy todir="${install.directory}" overwrite="true">
--> <fileset dir="${jardir}" includes="&jarfiles;" />
<target name="install" depends="jar" if="install.directory">
<copy todir="${install.directory}" overwrite="true" filtering="off">
<fileset dir="${jars}">
<include name="**/*.jar" />
</fileset>
</copy> </copy>
</target> </target>
<!--
Uninstall the jar file. <!-- Uninstall the jar file -->
-->
<target name="uninstall" if="install.directory"> <target name="uninstall" if="install.directory">
<delete> <delete>
<fileset dir="${install.directory}"> <fileset dir="${install.directory}" includes="&jarfiles;" />
<include name="**/*.jar" />
</fileset>
</delete> </delete>
</target> </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"> <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/jdbc2/**" if="jdk1.2+" />
<include name="${package}/test/java2ee/**" if="jdk1.2e+" /> <include name="${package}/test/java2ee/**" if="jdk1.2e+" />
</javac> </javac>
<java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true"> <java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true">
<arg value="org.postgresql.test.JDBC2Tests" /> <arg value="org.postgresql.test.JDBC2Tests" />
<sysproperty key="database" value="${database}" /> <sysproperty key="database" value="${database}" />
<sysproperty key="username" value="${username}" /> <sysproperty key="username" value="${username}" />
<sysproperty key="password" value="${password}" /> <sysproperty key="password" value="${password}" />
<classpath> <classpath>
<pathelement location="${dest}" /> <pathelement location="${builddir}" />
<pathelement path="${java.class.path}" /> <pathelement path="${java.class.path}" />
</classpath> </classpath>
</java> </java>
</target> </target>
</project> </project>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册