build patch - Mailing list pgsql-jdbc

From Mike Beachy
Subject build patch
Date
Msg-id 20021210082705.B17594@marketdude.com
Whole thread Raw
List pgsql-jdbc
While hacking about on the code, I've made another couple of tweaks to the
build files. They make it possible to use ant exclusively after running a
configure and a 'make build.properties'. The changes don't affect use of
make if you still want to use it.

Change summary:

To build.xml, I added a specification to retrieve properties from
build.properties, a new target called check_driver that makes sure
Driver.java gets regenerated if build.properties or Driver.java.in is newer
than it is, and a new 'clean_all' target that nukes the build.properties
file in addition to the things in the clean target.

To Makefile, I added a new target, build.properties, which creates a
file with the variables lifted from Makefile.global. I dropped the
command line definitions of these variables and made build.properties a
dependency of the targets that needed them.

Patch follows.

Mike

Index: build.xml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/build.xml,v
retrieving revision 1.30
diff -c -r1.30 build.xml
*** build.xml    2002/10/20 00:10:55    1.30
--- build.xml    2002/12/10 13:23:49
***************
*** 23,28 ****
--- 23,30 ----
    <property name="package" value="org/postgresql" />
    <property name="debug" value="on" />

+   <property file="build.properties"/>
+
    <!--
      This is a simpler method than utils.CheckVersion
      It defaults to jdbc1, but builds jdbc2 if the java.lang.Byte class is
***************
*** 115,126 ****
      </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 -->
      <condition property="edition" value="JDBC1">
          <equals arg1="${jdbc1}" arg2="true"/>
--- 117,137 ----
      </javac>
    </target>

+   <target name="check_driver">
+     <uptodate targetfile="${package}/Driver.java" property="driver.uptodate">
+       <srcfiles dir=".">
+     <include name="${package}/Driver.java.in"/>
+     <include name="build.properties"/>
+       </srcfiles>
+     </uptodate>
+   </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,check_driver"
!           unless="driver.uptodate">
      <!-- determine the edition text -->
      <condition property="edition" value="JDBC1">
          <equals arg1="${jdbc1}" arg2="true"/>
***************
*** 158,163 ****
--- 169,177 ----

       <fail unless="major" message="'major' undefined. Please follow the directions in README."/>
       <fail unless="minor" message="'minor' undefined. Please follow the directions in README."/>
+      <fail unless="fullversion" message="'fullversion' undefined. Please follow the directions in README."/>
+      <fail unless="def_pgport" message="'def_pgport' undefined. Please follow the directions in README."/>
+      <fail unless="enable_debug" message="'enable_debug' undefined. Please follow the directions in README."/>

      <!-- Put a check for the current version here -->

***************
*** 231,236 ****
--- 245,253 ----
      <delete quiet="true" file="${package}/Driver.java" />
    </target>

+   <target name="clean_all" depends="clean">
+     <delete quiet="true" file="build.properties" />
+   </target>


    <!-- This compiles and executes the JUnit tests -->
Index: Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/Makefile,v
retrieving revision 1.36
diff -c -r1.36 Makefile
*** Makefile    2002/10/20 02:55:50    1.36
--- Makefile    2002/12/10 13:23:49
***************
*** 15,32 ****
  majorversion := $(shell echo $(VERSION) | sed 's/^\([0-9][0-9]*\)\..*$$/\1/')
  minorversion := $(shell echo $(VERSION) | sed 's/^[0-9][0-9]*\.\([0-9][0-9]*\).*$$/\1/')

! properties := -Dmajor=$(majorversion) -Dminor=$(minorversion) \
!         -Dfullversion=$(VERSION) \
!         -Ddef_pgport=$(DEF_PGPORT) \
!         -Denable_debug=$(enable_debug)
!
! all:
!     $(ANT) -buildfile $(srcdir)/build.xml all \
!       $(properties)

! install: installdirs
      $(ANT) -buildfile $(srcdir)/build.xml install \
!       -Dinstall.directory=$(javadir) $(properties)

  installdirs:
      $(mkinstalldirs) $(javadir)
--- 15,34 ----
  majorversion := $(shell echo $(VERSION) | sed 's/^\([0-9][0-9]*\)\..*$$/\1/')
  minorversion := $(shell echo $(VERSION) | sed 's/^[0-9][0-9]*\.\([0-9][0-9]*\).*$$/\1/')

! build.properties: $(top_builddir)/src/Makefile.global
!     echo "# This file was created by 'make build.properties'." > build.properties
!     echo major=$(majorversion) >> build.properties
!     echo minor=$(minorversion) >> build.properties
!     echo fullversion=$(VERSION) >> build.properties
!     echo def_pgport=$(DEF_PGPORT) >> build.properties
!     echo enable_debug=$(enable_debug) >> build.properties

! all: build.properties
!     $(ANT) -buildfile $(srcdir)/build.xml all
!
! install: installdirs build.properties
      $(ANT) -buildfile $(srcdir)/build.xml install \
!       -Dinstall.directory=$(javadir)

  installdirs:
      $(mkinstalldirs) $(javadir)
***************
*** 36,42 ****
        -Dinstall.directory=$(javadir)

  clean distclean maintainer-clean:
!     $(ANT) -buildfile $(srcdir)/build.xml clean

! check: all
!     $(ANT) -buildfile $(srcdir)/build.xml test $(properties)
--- 38,44 ----
        -Dinstall.directory=$(javadir)

  clean distclean maintainer-clean:
!     $(ANT) -buildfile $(srcdir)/build.xml clean_all

! check: build.properties
!     $(ANT) -buildfile $(srcdir)/build.xml test

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: PooledConnectionImpl problem
Next
From: "Gerlits András"
Date:
Subject: updatable (J2EE) resultsets