mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
now compiles clean with jdk 1.4
This commit is contained in:
parent
2ea01da59b
commit
178961ad47
@ -1,207 +1,234 @@
|
|||||||
<?xml version="1.0"?>
|
<?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
|
||||||
|
|
||||||
$Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.18 2001/09/23 04:11:14 momjian Exp $
|
$Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.19 2002/02/22 02:07:30 davec Exp $
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!DOCTYPE project [
|
<!DOCTYPE project [
|
||||||
<!ENTITY jarfiles "postgresql.jar,postgresql-examples.jar">
|
<!ENTITY jarfiles "postgresql.jar,postgresql-examples.jar">
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<project name="postgresqlJDBC" default="all" basedir=".">
|
<project name="postgresqlJDBC" default="all" basedir=".">
|
||||||
|
|
||||||
<!-- set global properties for this build -->
|
<!-- set global properties for this build -->
|
||||||
<property name="srcdir" value="." />
|
<property name="srcdir" value="." />
|
||||||
<property name="jardir" value="jars" />
|
<property name="jardir" value="jars" />
|
||||||
<property name="builddir" value="build" />
|
<property name="builddir" value="build" />
|
||||||
<property name="package" value="org/postgresql" />
|
<property name="package" value="org/postgresql" />
|
||||||
|
<property name="debug" value="yes" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
This is a simpler method than utils.CheckVersion
|
This is a simpler method than utils.CheckVersion
|
||||||
It defaults to jdbc1, but builds jdbc2 if the java.lang.Byte class is
|
It defaults to jdbc1, but builds jdbc2 if the java.lang.Byte class is
|
||||||
in the CLASSPATH (ie JDK1.2 or later), and then enterprise if the
|
in the CLASSPATH (ie JDK1.2 or later), and then enterprise if the
|
||||||
javax.sql.DataSource class is present.
|
javax.sql.DataSource class is present.
|
||||||
|
|
||||||
Important: This must have the following order: jdbc1, jdbc2, enterprise
|
Important: This must have the following order: jdbc1, jdbc2, enterprise
|
||||||
-->
|
-->
|
||||||
<target name="check_versions">
|
<target name="check_versions">
|
||||||
<available property="jdk1.2+" classname="java.lang.ThreadLocal" />
|
<condition property="jdbc1">
|
||||||
<available property="jdk1.2e+" classname="javax.sql.DataSource" />
|
<equals arg1="${ant.java.version}" arg2="1.1"/>
|
||||||
<available property="junit" classname="junit.framework.Test" />
|
</condition>
|
||||||
</target>
|
<condition property="jdbc2">
|
||||||
|
<or>
|
||||||
|
<equals arg1="${ant.java.version}" arg2="1.2"/>
|
||||||
<!-- default target -->
|
<equals arg1="${ant.java.version}" arg2="1.3"/>
|
||||||
<target name="all">
|
</or>
|
||||||
<antcall target="jar" />
|
</condition>
|
||||||
</target>
|
<condition property="jdbc3">
|
||||||
|
<equals arg1="${ant.java.version}" arg2="1.4"/>
|
||||||
|
</condition>
|
||||||
<!-- create the jar file -->
|
<condition property="datasource">
|
||||||
<target name="jar" depends="compile,examples">
|
<and>
|
||||||
<jar jarfile="${jardir}/postgresql.jar" whenempty="fail">
|
<equals arg1="${jdbc2}" arg2="true" />
|
||||||
<fileset dir="${builddir}">
|
<available classname="javax.sql.DataSource"/>
|
||||||
<include name="${package}/**/*.class" />
|
</and>
|
||||||
<exclude name="${package}/test/**" />
|
</condition>
|
||||||
</fileset>
|
<available property="junit" classname="junit.framework.Test" />
|
||||||
|
</target>
|
||||||
<fileset dir="${srcdir}">
|
|
||||||
<include name="${package}/*.properties" />
|
|
||||||
</fileset>
|
<!-- default target -->
|
||||||
</jar>
|
<target name="all">
|
||||||
|
<antcall target="jar" />
|
||||||
<jar jarfile="${jardir}/postgresql-examples.jar" whenempty="fail">
|
</target>
|
||||||
<fileset dir="${builddir}">
|
|
||||||
<include name="example/**/*.class" />
|
|
||||||
</fileset>
|
<!-- create the jar file -->
|
||||||
|
<target name="jar" depends="compile,examples">
|
||||||
<fileset dir="${srcdir}">
|
<jar jarfile="${jardir}/postgresql.jar" whenempty="fail">
|
||||||
<include name="example/*.properties" />
|
<fileset dir="${builddir}">
|
||||||
</fileset>
|
<include name="${package}/**/*.class" />
|
||||||
</jar>
|
<exclude name="${package}/test/**" />
|
||||||
</target>
|
</fileset>
|
||||||
|
|
||||||
|
<fileset dir="${srcdir}">
|
||||||
<!-- This is the core of the driver. It is common for all three versions. -->
|
<include name="${package}/*.properties" />
|
||||||
<target name="compile" depends="prepare,check_versions,driver">
|
</fileset>
|
||||||
<javac srcdir="${srcdir}" destdir="${builddir}">
|
</jar>
|
||||||
<include name="${package}/**" />
|
|
||||||
|
<jar jarfile="${jardir}/postgresql-examples.jar" whenempty="fail">
|
||||||
<exclude name="${package}/jdbc1/**" if="jdk1.2+" />
|
<fileset dir="${builddir}">
|
||||||
<exclude name="${package}/jdbc2/**" unless="jdk1.2+" />
|
<include name="example/**/*.class" />
|
||||||
|
</fileset>
|
||||||
<exclude name="${package}/largeobject/PGblob.java" unless="jdk1.2+" />
|
|
||||||
<exclude name="${package}/largeobject/PGclob.java" unless="jdk1.2+" />
|
<fileset dir="${srcdir}">
|
||||||
|
<include name="example/*.properties" />
|
||||||
<exclude name="${package}/PostgresqlDataSource.java" unless="jdk1.2e+" />
|
</fileset>
|
||||||
<exclude name="${package}/xa/**" unless="jdk1.2e+" />
|
</jar>
|
||||||
|
</target>
|
||||||
<exclude name="${package}/test/**" unless="junit" />
|
|
||||||
</javac>
|
|
||||||
</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}" debug="${debug}">
|
||||||
<!--
|
<include name="${package}/**" />
|
||||||
This generates Driver.java from Driver.java.in
|
|
||||||
It's required for importing the driver version properties
|
<exclude name="${package}/jdbc1/**" unless="jdbc1"/>
|
||||||
-->
|
<exclude name="${package}/jdbc2/**" unless="jdbc2"/>
|
||||||
<target name="driver" depends="prepare,check_versions">
|
|
||||||
<!-- determine the edition text -->
|
<exclude name="${package}/largeobject/PGblob.java" unless="jdbc2" />
|
||||||
<property name="edition" value="JDBC1" />
|
<exclude name="${package}/largeobject/PGclob.java" unless="jdbc2" />
|
||||||
<available property="edition" value="JDBC2" classname="java.lang.ThreadLocal" />
|
|
||||||
<available property="edition" value="JDBC2" classname="java.lang.StrictMath" />
|
<exclude name="${package}/PostgresqlDataSource.java" unless="datasource" />
|
||||||
<available property="edition" value="JDBC2 Enterprise" classname="javax.sql.DataSource" />
|
<exclude name="${package}/xa/**" unless="datasource" />
|
||||||
|
|
||||||
<!-- determine the connection class -->
|
<exclude name="${package}/test/**" unless="junit" />
|
||||||
<property name="connectclass" value="org.postgresql.jdbc1.Connection" />
|
</javac>
|
||||||
<available property="connectclass" value="org.postgresql.jdbc2.Connection" classname="java.lang.ThreadLocal" />
|
</target>
|
||||||
|
|
||||||
<!-- Some defaults -->
|
|
||||||
<filter token="MAJORVERSION" value="${major}" />
|
<!--
|
||||||
<filter token="MINORVERSION" value="${minor}" />
|
This generates Driver.java from Driver.java.in
|
||||||
<filter token="VERSION" value="PostgreSQL ${fullversion} ${edition}" />
|
It's required for importing the driver version properties
|
||||||
<filter token="JDBCCONNECTCLASS" value="${connectclass}" />
|
-->
|
||||||
<filter token="DEF_PGPORT" value="${def_pgport}" />
|
<target name="driver" depends="prepare,check_versions">
|
||||||
|
<!-- determine the edition text -->
|
||||||
<!-- Put a check for the current version here -->
|
<property name="edition" value="JDBC1" />
|
||||||
|
<condition property="edition" value="JDBC2">
|
||||||
<!-- now copy and filter the file -->
|
<or>
|
||||||
<copy file="${package}/Driver.java.in"
|
<equals arg1="${jdbc2}" arg2="true"/>
|
||||||
tofile="${package}/Driver.java"
|
<equals arg1="${jdbc3}" arg2="true"/> <!-- fake it for now -->
|
||||||
filtering="yes" />
|
|
||||||
|
</or>
|
||||||
<echo message="Configured build for the ${edition} edition driver" />
|
</condition>
|
||||||
</target>
|
|
||||||
|
<condition property="edition" value="JDBC2 Enterprise">
|
||||||
|
<and>
|
||||||
<!-- Prepares the build directory -->
|
<available classname="javax.sql.DataSource" />
|
||||||
<target name="prepare">
|
<equals arg1="${jdbc2}" arg2="true"/>
|
||||||
<mkdir dir="${builddir}" />
|
</and>
|
||||||
<mkdir dir="${jardir}" />
|
</condition>
|
||||||
</target>
|
|
||||||
|
<!-- determine the connection class -->
|
||||||
|
<property name="connectclass" value="org.postgresql.jdbc1.Connection" />
|
||||||
<!-- This builds the examples -->
|
<available property="connectclass" value="org.postgresql.jdbc2.Connection" classname="java.lang.ThreadLocal" />
|
||||||
<target name="examples" depends="compile">
|
|
||||||
<javac srcdir="${srcdir}" destdir="${builddir}">
|
<!-- Some defaults -->
|
||||||
<include name="example/**" />
|
<filter token="MAJORVERSION" value="${major}" />
|
||||||
<exclude name="example/corba/**"/>
|
<filter token="MINORVERSION" value="${minor}" />
|
||||||
<exclude name="example/blobtest.java" unless="jdk1.2+"/>
|
<filter token="VERSION" value="PostgreSQL ${fullversion} ${edition}" />
|
||||||
</javac>
|
<filter token="JDBCCONNECTCLASS" value="${connectclass}" />
|
||||||
</target>
|
<filter token="DEF_PGPORT" value="${def_pgport}" />
|
||||||
|
|
||||||
|
<!-- Put a check for the current version here -->
|
||||||
<!-- Builds the corba example -->
|
|
||||||
<target name="corba" if="jdk1.2+">
|
<!-- now copy and filter the file -->
|
||||||
<exec dir="${srcdir}/example/corba" executable="idl2java">
|
<copy file="${package}/Driver.java.in"
|
||||||
<arg value="stock.idl" />
|
tofile="${package}/Driver.java"
|
||||||
</exec>
|
filtering="yes" />
|
||||||
|
|
||||||
<javac srcdir="${srcdir}" destdir="${builddir}">
|
<echo message="Configured build for the ${edition} edition driver" />
|
||||||
<include name="example/corba/**" />
|
</target>
|
||||||
</javac>
|
|
||||||
</target>
|
|
||||||
|
<!-- Prepares the build directory -->
|
||||||
|
<target name="prepare">
|
||||||
|
<mkdir dir="${builddir}" />
|
||||||
<!-- Install the jar files -->
|
<mkdir dir="${jardir}" />
|
||||||
<target name="install" depends="all" if="install.directory">
|
</target>
|
||||||
<copy todir="${install.directory}" overwrite="true">
|
|
||||||
<fileset dir="${jardir}" includes="&jarfiles;" />
|
|
||||||
</copy>
|
<!-- This builds the examples -->
|
||||||
</target>
|
<target name="examples" depends="compile">
|
||||||
|
<javac srcdir="${srcdir}" destdir="${builddir}">
|
||||||
|
<include name="example/**" />
|
||||||
<!-- Uninstall the jar file -->
|
<exclude name="example/corba/**"/>
|
||||||
<target name="uninstall" if="install.directory">
|
<exclude name="example/blobtest.java" unless="jdk1.2+"/>
|
||||||
<delete>
|
</javac>
|
||||||
<fileset dir="${install.directory}" includes="&jarfiles;" />
|
</target>
|
||||||
</delete>
|
|
||||||
</target>
|
|
||||||
|
<!-- Builds the corba example -->
|
||||||
|
<target name="corba" if="jdk1.2+">
|
||||||
|
<exec dir="${srcdir}/example/corba" executable="idl2java">
|
||||||
<!-- This target removes any class files from the build directory -->
|
<arg value="stock.idl" />
|
||||||
<target name="clean">
|
</exec>
|
||||||
<delete quiet="true" dir="${builddir}" />
|
|
||||||
<delete quiet="true" dir="${jardir}" />
|
<javac srcdir="${srcdir}" destdir="${builddir}">
|
||||||
<delete quiet="true" file="${package}/Driver.java" />
|
<include name="example/corba/**" />
|
||||||
</target>
|
</javac>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<!-- This compiles and executes the JUnit tests -->
|
|
||||||
|
<!-- Install the jar files -->
|
||||||
<!-- defaults for the tests - override these if required -->
|
<target name="install" depends="all" if="install.directory">
|
||||||
<property name="database" value="jdbc:postgresql:test" />
|
<copy todir="${install.directory}" overwrite="true">
|
||||||
<property name="username" value="test" />
|
<fileset dir="${jardir}" includes="&jarfiles;" />
|
||||||
<!-- Password must be something. Doesn't matter if trust is used! -->
|
</copy>
|
||||||
<property name="password" value="password" />
|
</target>
|
||||||
<!-- junit.ui is one of textui, awtui, or swingui -->
|
|
||||||
<property name="junit.ui" value="textui" />
|
|
||||||
|
<!-- Uninstall the jar file -->
|
||||||
|
<target name="uninstall" if="install.directory">
|
||||||
<target name="test" depends="jar" if="junit">
|
<delete>
|
||||||
<javac srcdir="${srcdir}" destdir="${builddir}">
|
<fileset dir="${install.directory}" includes="&jarfiles;" />
|
||||||
<include name="${package}/test/jdbc2/**" if="jdk1.2+" />
|
</delete>
|
||||||
<include name="${package}/test/java2ee/**" if="jdk1.2e+" />
|
</target>
|
||||||
</javac>
|
|
||||||
|
|
||||||
<java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true">
|
|
||||||
<arg value="org.postgresql.test.JDBC2Tests" />
|
<!-- This target removes any class files from the build directory -->
|
||||||
<sysproperty key="database" value="${database}" />
|
<target name="clean">
|
||||||
<sysproperty key="username" value="${username}" />
|
<delete quiet="true" dir="${builddir}" />
|
||||||
<sysproperty key="password" value="${password}" />
|
<delete quiet="true" dir="${jardir}" />
|
||||||
<classpath>
|
<delete quiet="true" file="${package}/Driver.java" />
|
||||||
<pathelement location="${builddir}" />
|
</target>
|
||||||
<pathelement path="${java.class.path}" />
|
|
||||||
</classpath>
|
|
||||||
</java>
|
|
||||||
</target>
|
<!-- This compiles and executes the JUnit tests -->
|
||||||
|
|
||||||
</project>
|
<!-- 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" />
|
||||||
|
<!-- junit.ui is one of textui, awtui, or swingui -->
|
||||||
|
<property name="junit.ui" value="textui" />
|
||||||
|
|
||||||
|
|
||||||
|
<target name="test" depends="jar" if="junit">
|
||||||
|
<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="${builddir}" />
|
||||||
|
<pathelement path="${java.class.path}" />
|
||||||
|
</classpath>
|
||||||
|
</java>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
Loading…
Reference in New Issue
Block a user