Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7519594

Browse files
author
Peter Mount
committed
Finished build.xml and updated Driver.java.in and buildDriver to match how Makefile and ANT operate.
1 parent 1d46fb8 commit 7519594

File tree

4 files changed

+58
-15
lines changed

4 files changed

+58
-15
lines changed

src/interfaces/jdbc/CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Wed Dec 20 16:19:00 GMT 2000 [email protected]
2+
- Finished build.xml and updated Driver.java.in and buildDriver to
3+
match how Makefile and ANT operate.
4+
15
Tue Dec 19 17:30:00 GMT 2000 [email protected]
26
- Finally created ant build.xml file
37

src/interfaces/jdbc/build.xml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
build file to allow ant (http://jakarta.apache.org/ant/) to be used
44
to build the PostgreSQL JDBC Driver.
55
6-
$Id: build.xml,v 1.1 2000/12/19 17:33:39 peter Exp $
6+
$Id: build.xml,v 1.2 2000/12/20 16:22:48 peter Exp $
77
88
-->
99

1010
<project name="postgresqlJDBC" default="jar" basedir=".">
1111

12-
1312
<!-- set global properties for this build -->
1413
<property name="src" value="." />
1514
<property name="dest" value="build" />
1615
<property name="package" value="org/postgresql" />
16+
<property name="major" value="7" />
17+
<property name="minor" value="1" />
1718

1819
<!--
1920
This is a simpler method than utils.CheckVersion
@@ -27,25 +28,63 @@
2728
<available property="jdk1.2+" classname="java.lang.ThreadLocal" />
2829
<available property="jdk1.3+" classname="java.lang.StrictMath" />
2930
<available property="jdk1.2e+" classname="javax.sql.DataSource" />
31+
</target>
32+
33+
<!--
34+
This generates Driver.java from Driver.java.in
35+
It's required for importing the driver version properties
36+
-->
37+
<target name="driver" depends="prepare,check_versions">
38+
39+
<!-- determine the edition text -->
40+
<property name="edition" value="JDBC1" />
41+
<available property="edition" value="JDBC2" classname="java.lang.ThreadLocal" />
42+
<available property="edition" value="JDBC2" classname="java.lang.StrictMath" />
43+
<available property="edition" value="JDBC2 Enterprise" classname="javax.sql.DataSource" />
44+
45+
<!-- determine the connection class -->
46+
<property name="connectclass" value="org.postgresql.jdbc1.Connection" />
47+
<available property="connectclass" value="org.postgresql.jdbc2.Connection" classname="java.lang.ThreadLocal" />
48+
49+
<!-- Some defaults -->
50+
<filter token="MAJORVERSION" value="${major}" />
51+
<filter token="MINORVERSION" value="${minor}" />
52+
<filter token="VERSION" value="PostgreSQL ${major}.${minor} ${edition}" />
53+
<filter token="JDBCCONNECTCLASS" value="${connectclass}" />
54+
55+
<!-- Put a check for the current version here -->
56+
57+
<!-- now copy and filter the file -->
58+
<copy file="${package}/Driver.java.in"
59+
tofile="${package}/Driver.java"
60+
filtering="yes" />
61+
62+
<echo message="Configured build for the ${edition} edition driver." />
3063

31-
<mkdir dir="${dest}" />
3264
</target>
3365

66+
<!-- This target removes any class files from the build directory -->
3467
<target name="clean">
3568
<delete dir="${dest}" />
69+
<delete file="${package}/Driver.java" />
70+
</target>
71+
72+
<!-- Prepares the build directory -->
73+
<target name="prepare">
74+
<mkdir dir="${dest}" />
3675
</target>
3776

3877
<!-- This is the core of the driver. It is common for all three versions -->
39-
<target name="compile" depends="check_versions">
78+
<target name="compile" depends="prepare,check_versions,driver">
4079
<javac srcdir="${src}" destdir="${dest}">
4180
<include name="${package}/**" />
4281
<exclude name="${package}/jdbc1/**" if="jdk1.2+" />
4382
<exclude name="${package}/jdbc2/**" unless="jdk1.2+" />
44-
<exclude name="${package}/largeobject/PGBlob.java" unless="jdk1.2+" />
83+
<exclude name="${package}/largeobject/PGblob.java" unless="jdk1.2+" />
4584
<exclude name="${package}/PostgresqlDataSource.java" unless="jdk1.2e+" />
4685
<exclude name="${package}/xa/**" unless="jdk1.2e+" />
4786
</javac>
48-
<copy todir="${dest}">
87+
<copy todir="${dest}" overwrite="true" filtering="on">
4988
<fileset dir="${src}">
5089
<include name="**/*.properties" />
5190
</fileset>

src/interfaces/jdbc/org/postgresql/Driver.java.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public class Driver implements java.sql.Driver
114114
return null;
115115

116116
try {
117-
org.postgresql.Connection con = (org.postgresql.Connection)(Class.forName("%JDBCCONNECTCLASS%").newInstance());
117+
org.postgresql.Connection con = (org.postgresql.Connection)(Class.forName("@JDBCCONNECTCLASS@").newInstance());
118118
con.openConnection (host(), port(), props, database(), url, this);
119119
return (java.sql.Connection)con;
120120
} catch(ClassNotFoundException ex) {
@@ -192,7 +192,7 @@ public class Driver implements java.sql.Driver
192192
*/
193193
public int getMajorVersion()
194194
{
195-
return %MAJORVERSION%;
195+
return @MAJORVERSION@;
196196
}
197197

198198
/**
@@ -202,15 +202,15 @@ public class Driver implements java.sql.Driver
202202
*/
203203
public int getMinorVersion()
204204
{
205-
return %MINORVERSION%;
205+
return @MINORVERSION@;
206206
}
207207

208208
/**
209209
* Returns the VERSION variable from Makefile.global
210210
*/
211211
public static String getVersion()
212212
{
213-
return "%VERSION%";
213+
return "@VERSION@";
214214
}
215215

216216
/**

src/interfaces/jdbc/utils/buildDriver

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#
3-
# $Id: buildDriver,v 1.1 2000/10/12 08:55:28 peter Exp $
3+
# $Id: buildDriver,v 1.2 2000/12/20 16:22:49 peter Exp $
44
#
55
# This script generates the org/postgresql/Driver.java file from the template
66
# org/postgresql/Driver.java.in
@@ -38,10 +38,10 @@ MINORVERSION=`echo $VERSION | cut -f2 -d'.' | cut -c1`
3838
#---------------------------------------------------------------------------
3939
# Now finally build the driver
4040
sed \
41-
-e "s/%JDBCCONNECTCLASS%/$CLASS/g" \
42-
-e "s/%VERSION%/$VERSION $EDITION/g" \
43-
-e "s/%MAJORVERSION%/$MAJORVERSION/g" \
44-
-e "s/%MINORVERSION%/$MINORVERSION/g" \
41+
-e "s/@JDBCCONNECTCLASS@/$CLASS/g" \
42+
-e "s/@VERSION@/$VERSION $EDITION/g" \
43+
-e "s/@MAJORVERSION@/$MAJORVERSION/g" \
44+
-e "s/@MINORVERSION@/$MINORVERSION/g" \
4545
<${SOURCE}.in \
4646
>$SOURCE
4747
#---------------------------------------------------------------------------

0 commit comments

Comments
 (0)