- Adds new version config variables for jdbc
- jdbc "make jar" additionally creates files named like
postgis_1_0_0RC4.jar using the info from Version.config
- org/postgis/Version.java now uses a Makefile generated ressource to
initialize its values, so it is always "in sync" with Version.config
git-svn-id: http://svn.osgeo.org/postgis/trunk@1484
b70326c6-7e19-0410-871a-
916f4a2858ee
--- /dev/null
+# Version numbering central repository, to be included from various
+# places during the build process
+
+# shared library version
+SO_MAJOR_VERSION=1
+SO_MINOR_VERSION=0
+SO_MICRO_VERSION=0RC4
+
+# sql scripts version
+SCRIPTS_VERSION=0.2.0
+
+# JDBC code version
+JDBC_MAJOR_VERSION=1
+JDBC_MINOR_VERSION=0
+JDBC_MICRO_VERSION=0RC4
stubbin
stubcompile
jtscompile
+versionstamp
DEBUGJARCONTENTS=-C $(SRCDIR) org \
-C $(SRCDIR) examples
+# include version numbers from central repository
+include ../Version.config
+VERSION=$(JDBC_MAJOR_VERSION)_$(JDBC_MINOR_VERSION)_$(JDBC_MICRO_VERSION)
+VERSIONPATH=$(BUILD)/org/postgis
+VERSIONTARGET=$(VERSIONPATH)/version.properties
+
# Preliminary jts support - not stable yet!
JTSDIR=jtssrc
JTSBUILD=jtsbin/
offlinetests
jar: compile postgis.jar $(DEBUGJAR)
+ $(CP) postgis.jar postgis_$(VERSION).jar
+ $(CP) postgis_debug.jar postgis_debug_$(VERSION).jar
postgis.jar: compile $(SRCDIR)/org/postgresql/driverconfig.properties
$(JAR) -cf postgis.jar $(JARCONTENTS)
$(STUBBUILD):
$(MKDIR) $(STUBBUILD)
+$(VERSIONPATH): $(BUILD)
+ $(MKDIR) $(VERSIONPATH)
+
+versionstamp: $(SRC) ../Version.in $(VERSIONPATH)
+ echo >$(VERSIONTARGET) JDBC_MAJOR_VERSION=$(JDBC_MAJOR_VERSION)
+ echo >>$(VERSIONTARGET) JDBC_MINOR_VERSION=$(JDBC_MINOR_VERSION)
+ echo >>$(VERSIONTARGET) JDBC_MICRO_VERSION=$(JDBC_MICRO_VERSION)
+ touch versionstamp
+
stubcompile: $(STUBBUILD)
$(JAVAC) -d $(STUBBUILD) $(STUBSRC)
touch stubcompile
-compile: stubcompile $(BUILD) $(SRC)
+compile: stubcompile $(BUILD) $(SRC) versionstamp
$(JAVAC) $(COMP_ADDCP) "$(BUILDCP)" -d $(BUILD) $(SRC)
touch compile
clean:
$(DELETE) $(BUILD) bin stubbin postgis.jar postgis_debug.jar \
- compile stubcompile jtscompile $(JTSBUILD) postgis_jts.jar
+ compile stubcompile jtscompile $(JTSBUILD) postgis_jts.jar \
+ versionstamp
# Install - this needs the successfull inclusion of PostgreSQL top
# level Makefile (which is mandatory for the C part of PostGIS as well).
package org.postgis;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+
/** Corresponds to the appropriate PostGIS that carried this source */
public class Version {
-
+ /** We read our version information from this ressource... */
+ private static final String RESSOURCENAME = "org/postgis/version.properties";
+
/** The major version */
- public static final int MAJOR = 1;
+ public static final int MAJOR;
/** The minor version */
- public static final int MINOR = 0;
+ public static final int MINOR;
/**
* The micro version, usually a number including possibly textual suffixes
* like RC3.
*/
- public static final String MICRO = "0RC4";
+ public static final String MICRO;
+
+ static {
+ int major = -1;
+ int minor = -1;
+ String micro = "INVALID";
+ try {
+ ClassLoader loader = Version.class.getClassLoader();
+ URL ver = loader.getResource(RESSOURCENAME);
+ if (ver == null) {
+ throw new ExceptionInInitializerError(
+ "Error initializing PostGIS JDBC version! Cause: Ressource "+RESSOURCENAME+" not found!");
+ }
+ BufferedReader rd = new BufferedReader(new InputStreamReader(ver.openStream()));
+
+ String line;
+ while ((line = rd.readLine()) != null) {
+ line = line.trim();
+ if (line.startsWith("JDBC_MAJOR_VERSION")) {
+ major = Integer.parseInt(line.substring(19));
+ } else if (line.startsWith("JDBC_MINOR_VERSION")) {
+ minor = Integer.parseInt(line.substring(19));
+ } else if (line.startsWith("JDBC_MICRO_VERSION")) {
+ micro = line.substring(19);
+ } else {
+ // ignore line
+ }
+ }
+ if (major == -1 || minor == -1 || micro.equals("INVALID")) {
+ throw new ExceptionInInitializerError("Error initializing PostGIS JDBC version! Cause: Ressource "+RESSOURCENAME+" incomplete!");
+ }
+ } catch (IOException e) {
+ throw new ExceptionInInitializerError("Error initializing PostGIS JDBC version! Cause: " + e.getMessage());
+ } finally {
+ MAJOR = major;
+ MINOR = minor;
+ MICRO = micro;
+ }
+ }
/** Full version for human reading - code should use the constants above */
public static final String FULL = "PostGIS JDBC V" + MAJOR + "." + MINOR + "." + MICRO;
# Shared library parameters.
#
NAME=lwgeom
-SO_MAJOR_VERSION=1
-SO_MINOR_VERSION=0
-SO_MICRO_VERSION=0RC3
-SCRIPTS_VERSION=0.2.0
+
+# fetch version numbers from central repository
+include ../Version.config
+
ifeq (${USE_VERSION},71)
MODULE_FILENAME = $(LPATH)/$(shlib)
MODULE_INSTALLDIR = $(libdir)