Pre-processing during build - Mailing list pgsql-jdbc

From Stephen Nelson
Subject Pre-processing during build
Date
Msg-id CAHpHs3nXM6Yr90kWVE_9_6g2DkekcUkP3MotS826j2CL8B80Og@mail.gmail.com
Whole thread Raw
List pgsql-jdbc
I'm working on a change proposal to switch the build of the driver
from Ant to Maven [1].

Working on this change I found the use of pre-processing of template
files to create valid Java classes. In my experience this isn't very
common in Java libraries, other than to inject version numbers. To me,
it does not seem to be a very elegant solution, although I can confirm
that it works fine and has been present in the driver since the
beginning.

The use of these templates is scattered around the codebase and
usually occurs when there is JDBC version-specific functionality to
use, e.g. Driver.java.in and PGConnectionPoolDataSource.java.in. [2]

The use of these templates means the code will not successfully
compile in an IDE, without running the build script first. I believe
the historical reason for part of this is to retain the
org.postgresql.Driver class to be used in a Class.forName method call
without the developer needing to worry about the JDBC spec version.
Please correct me if I'm wrong in this assumption.

Within the current build there is also the filtering of source
packages to only include the version of the JDBC spec you are
compiling for and any previous versions.

This can all be implemented in Maven, so won't prevent the project
using that for a build system. However it will make it possibly more
complicated than it needs to be, like the Ant build is now. The
negative of this is that it could put off new people building and
committing fixes and functionality to the codebase.

So, do we want to change this? It would be good to discuss this to
arrive at a solution that would best serve the users as well as
contributors (I'm aware that is rarely possible!)

[1] https://github.com/pgjdbc/pgjdbc/pull/322
[2] https://github.com/pgjdbc/pgjdbc/pull/322/files#r32378395


pgsql-jdbc by date:

Previous
From: Robert DiFalco
Date:
Subject: Re: Multiple Row Insert vs. Batch
Next
From: "Markus KARG"
Date:
Subject: Re: Pre-processing during build