Pre-processing during build
От | Stephen Nelson |
---|---|
Тема | Pre-processing during build |
Дата | |
Msg-id | CAHpHs3nXM6Yr90kWVE_9_6g2DkekcUkP3MotS826j2CL8B80Og@mail.gmail.com обсуждение исходный текст |
Список | 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 по дате отправления: