Re: Ant Packaging - Was: building pgsql-interfaces...

From: Mark Dzmura <mdz(at)digital-mission(dot)com>
To: "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: Ant Packaging - Was: building pgsql-interfaces...
Date: 2000-10-19 18:31:15
Message-ID: 39EF3DF3.9DC89A86@digital-mission.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Peter Mount wrote:

> On Tue, 17 Oct 2000, Christopher Cain wrote:
>
> > For what it's worth, I am very much in favor of migrating to Ant. Having worked
> > with it in other packages, I have found it to be an order of magnitude better
> > than Make for Java software. As mentioned, it is cleaner and much easier to
> > work with than makefiles. Of course, I can say all of this because unlike like
> > Peter, I have no idea what any of the complications are :-)
>
> There's three complications really.
>
> 1: We need to get the current version number out of the source. This is
> used by DatabaseMetaData for some methods, and the current official way is
> to get it out of Makefile.global. However, this is only in existence after
> configure is run on the main source tree.
>
> Prior to 7.1, this was done manually, and as there was several places to
> do it, it was easily, and regularly missed.

Ant is typically invoked by a "build.sh" bash script (under Unix/Linux platforms - I
know there is an equivalent .bat file for windoze systems, but I don't build
in that environment.)

It is a piece of cake to invoke build.sh, passing down one or more
parameters, either on the make command line or as environment variables,
and from inside the script to pass the parameters to Ant with "-Dproperty=value"
phrases on the line which starts the Ant JVM. These variables are accesible

So it's easy to get things like version numbers from the "make" world into Ant.

> 2: The org.postgresql.Driver class is created dynamically. Partly to
> include the version data, but also to include which implementation of
> java.sql.Connection is needed for that particular version of the
> driver. Ie, which one of the _three_ versions of the driver now in the
> source - JDBC1.1, JDBC2 and JDBC2-Enterprise which match to either
> JDK1.1.x, Java2SE and Java2EE respectively.
>

>
> 3: Currently make utilises a test class, utils.CheckVersion which is
> compiliable on all JDK1.1 or later VM's and checks for the existence of
> certain classes and parameters to check what true version of the JDK is in
> existence. Make then uses this to build the correct version of
> org.postgresql.Driver and the rest of the driver.
>

Ant has decent conditionals which should be sufficient

As a speed benchmark, Cocoon 1.8, with well over 100 Java source files,
builds in under 30 seconds on my PII/400 notebook w/ 128MB RAM
(and running lots of other stuff..)

>
> Now, some classes are only built for certain drivers. ie:
>
> For the enterprise edition there are:
> org.postgresql.PostgresqlDataSource
> org.postgresql.xa.*
>
> Unique to JDBC1 is org.postgresql.jdbc1.*
>
> Unique to JDBC2 is org.postgresql.jdbc2.*
> org.postgresql.largeobject.PGBlob
> and some array implementation stuff I'm having trouble including from the
> supplied patches (working on that one).
>
> > I would like to get some feedback on the idea, however, as I really do think
> > that Ant is a superior solution for Java projects. If there is any interest, I
> > would certainly be willing to help Mark out in getting an Ant distro of the
> > drivers up and running.
>
> Make is dire for building Java projects, which is why I'd favour ANT if it
> can deal with the three problems above. The last thing I want to see is
> having to have three (possibly more) sets of source code where there are
> lots of duplication, and we would loose the integrity of the driver pretty
> fast (most of the driver is common to all versions).
>

>
> Also, how platform independent is ANT? I currently test the builds under
> Linux, and the various Windows entities (if you can call them an OS).
>

Ant was built under Solaris. Runs great on Linux (We use it exclusively for
Java - ditched make entirely for Java about 6 months ago). As for Windows,
I can only say that the documentation talks as much about Windows as it does
about *nix platforms, and many developers using it seem to be using Windows...
No personal experience, though... (windows being one of the impediments to
my complete happiness...)

regards,
mdz

> > Peter Mount wrote:
> >
> > > I'll look into Ant, but I can see some possible problems, especially as we
> > > have 3 versions of driver now (JDBC1.1, JDBC2 and JDBC2enterprise), and I'm
> > > checking the JDBC2.1 specification at the moment.
> >
> > Mark Dzmura wrote:
> >
> > > (( I offer as a suggestion that Peter/et al move to using the Java Apache
> > > project's
> > > "Ant" package for doing Java-only builds... It is so much faster and cleaner
> > > to build under Ant (everything is compiled under a single JVM) and
> > > maintanence
> > > of the build.xml file is so much cleaner than hopeless makefiles...
> > >
> > > If there is interest, I will take a stab at creating a build.xml for the
> > > JDBC driver...))
> >
>
> --
> Peter T Mount peter(at)retep(dot)org(dot)uk http://www.retep.org.uk
> PostgreSQL JDBC Driver http://www.retep.org.uk/postgres/
> Java PDF Generator http://www.retep.org.uk/pdf/

Attachment Content-Type Size
mdz.vcf text/x-vcard 280 bytes

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Christopher Cain 2000-10-19 21:51:15 Re: Ant Packaging - Was: building pgsql-interfaces...
Previous Message Matthew H. North 2000-10-19 16:06:38 PsqlODBC on W2K conn. to PostgreSQL 7.0.2 on FreeBSD