]> granicus.if.org Git - postgis/commitdiff
Ant rules to excecute maven by Maria Arias de Reyna (#1437)
authorSandro Santilli <strk@keybit.net>
Mon, 20 Feb 2012 12:52:58 +0000 (12:52 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 20 Feb 2012 12:52:58 +0000 (12:52 +0000)
Also simplify java Makefile to be simple proxies of ant

git-svn-id: http://svn.osgeo.org/postgis/trunk@9236 b70326c6-7e19-0410-871a-916f4a2858ee

configure.ac
java/Makefile [new file with mode: 0644]
java/jdbc/Makefile [deleted file]
java/jdbc/Makefile.in [new file with mode: 0644]
java/jdbc/build.xml

index 9d5c9a5502212de1e3173c36ff5aa76e7bd31abe..ac9c499586c210c55224a0d957e852ced5ca177a 100644 (file)
@@ -25,6 +25,8 @@ dnl
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_CXX
+AC_PATH_PROG([ANT], [ant], [])
+AC_SUBST([ANT])
 
 dnl
 dnl Define PIC flags in PICFLAGS (note: this variable is set as part of libtool initialisation above)
@@ -1041,6 +1043,7 @@ AC_OUTPUT([GNUmakefile
    doc/Makefile.comments 
    doc/html/image_src/Makefile 
    utils/Makefile 
+   java/jdbc/Makefile
    $RT_MAKEFILE_LIST])
     
 dnl ===========================================================================
diff --git a/java/Makefile b/java/Makefile
new file mode 100644 (file)
index 0000000..bb8efcb
--- /dev/null
@@ -0,0 +1,20 @@
+# **********************************************************************
+# *
+# * PostGIS - Spatial Types for PostgreSQL
+# * http://postgis.refractions.net
+# *
+# * Copyright (C) 2012 Sandro Santilli <strk@keybit.net>
+# *
+# * This is free software; you can redistribute and/or modify it under
+# * the terms of the GNU General Public Licence. See the COPYING file.
+# *
+# **********************************************************************
+
+# TODO: add all subdirs
+SUBDIRS = jdbc
+
+all install uninstall clean distclean check maintainer-clean:
+       for s in $(SUBDIRS); do \
+               echo "---- Making $@ in $${s}"; \
+               $(MAKE) -C $${s} $@ || exit 1; \
+       done;
diff --git a/java/jdbc/Makefile b/java/jdbc/Makefile
deleted file mode 100644 (file)
index f8955c2..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-# PostGIS Makefile
-
-# (C) 2004 Paul Ramsey, pramsey@refractions.net
-# (C) 2005 Markus Schaber, markus.schaber@logix-tt.com
-# (C) 2005 Sandro Santilli, strk@refractions.net
-# (C) 2005 Alex Bodnaru, alexbodn@012.net.il
-
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-
-#    You should have received a copy of the GNU General Public License
-#    along with this program; if not, write to the Free Software
-#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-# Following are some variable definitions that may have to be changed
-# according to your build environment. This can be done either by editing
-# this Makefile, or setting them via shell environment prior to calling make.
-
-### Config variable section starts ###
-
-# Configure the helper executables used during build.
-
-JAVAC?=javac -target 1.2 -source 1.2
-JAVA?=java
-JAR?=jar
-MKDIR?=mkdir -p
-DELETE?=rm -rvf
-CP?=cp
-
-# If you happen to be stuck with ancient jar implementations that do not
-# know about the -u option, but does not complain about duplicate directorys
-# with the same name (e. G. debian woody fastjar), set the DEBUGJAR below
-# variable to postgis_debug.fastjar and JAR (above) to fastjar.
-DEBUGJAR?=postgis_debug.jar
-
-# Make sure our classpath includes your postgresql.jar. This is somehow
-# difficult because some JREs (e. G. those on debian woody or sablevm) seem
-# to forget their own system classes (aka bootclasspath) as soon as _any_
-# classpath is set, either via environment or via command line. They do not
-# implement the concept of distinct classpath and bootclasspath settings,
-# as most current java implementations do. This makes it necessary to either
-# explicitly include the system classes in the set classpath, or use
-# non-standard options line --addclasspath to add both the postgresql.jar
-# and our own classes. We also cannot set an unset CLASSPATH variable here
-# for this reason. Current (Jan 2005) implementations from SUN, IBM, 
-# Blackdown, gij and kaffe are known to work fine.
-
-# If you set POSTGIS_BUILD_CLASSPATH via Environment (even to an empty string), we
-# simply use it and do not try to guess anything. If POSTGIS_CLASSPATH is
-# not set, we use the contents of CLASSPATH. If CLASSPATH is empty or not
-# set, we try to guess a default location that works on most unixoid systems.
-
-ifeq (${CLASSPATH},)
-       POSTGIS_BUILD_CLASSPATH?=/usr/share/java/postgresql.jar
-else
-       POSTGIS_BUILD_CLASSPATH?=${CLASSPATH}
-endif
-
-# Set those to --addclasspath for sablevm, to avoid overriding the
-# BOOTCLASSPATH, the first one is for the compiler, the second one for JRE.
-COMP_ADDCP?=-classpath
-EXEC_ADDCP?=-classpath
-
-# Class path entry separator, this is : on Linux/Unix and ; on Windows
-CPSEP?=:
-
-# This are used for the online regression tests, override via environment
-# as applicable. The jtest needs table creation privilege in current_schema(),
-# the others only call self contained SELECTs that do not access any tables.
-PGHOST?=localhost
-PGPORT?=5432
-PGDATABASE?=jdbc_test
-PGUSER?=psql
-PGPASS?=guess
-PGURL?=//$(PGHOST):$(PGPORT)/$(PGDATABASE)
-
-# Where to put the output from regression tests. If you want to have it on
-# stdout, set TESTRD to the empty string. If you want to have it in another
-# file, set TESTOUTPUT to the file path.
-# Be careful - that file will be deleted by "make clean".
-TESTOUTPUT?=test.log
-# Output redirect for tests
-TESTRD?= >>$(TESTOUTPUT) 
-
-### Config variable section ends ###
-
-# build internal constants follow:
-SRCDIR=./src
-EXAMPLES=examples
-BUILD=./bin
-RUNCP=$(POSTGIS_BUILD_CLASSPATH)$(CPSEP)./postgis.jar
-BUILDCP=$(STUBBUILD)$(CPSEP)$(POSTGIS_BUILD_CLASSPATH)$(CPSEP)$(SRCDIR)
-
-# The pgjdbc 7.2/7.4/8.0 compatibility stub stuff
-STUBDIR=stubs
-STUBBUILD=./stubbin/
-
-# What to put into the JAR files:
-JARCONTENTS=-C $(BUILD) org \
-               -C $(BUILD) examples \
-               -C $(SRCDIR) org/postgresql/driverconfig.properties \
-               -C . README COPYING_LGPL \
-               -C ../.. COPYING
-
-DEBUGJARCONTENTS=-C $(SRCDIR) org \
-               -C $(SRCDIR) examples
-
-# include version numbers
-include ../../Version.config
-
-# include configuration from central repository, only needed for install
-# and installdirs targets, not for building itsself.
--include ../../Makefile.config
-
-VERSION=$(POSTGIS_MAJOR_VERSION).$(POSTGIS_MINOR_VERSION).$(POSTGIS_MICRO_VERSION)
-
-# We copy the ../Version.config into the jar to have it read at runtime.
-VERSIONPATH=$(BUILD)/org/postgis
-VERSIONTARGET=$(VERSIONPATH)/version.properties
-
-
-# Preliminary jts support - not stable yet!
-JTSDIR=jtssrc
-JTSBUILD=jtsbin/
-
-JTSPATH=$(JTSBUILD)$(CPSEP)$(BUILD)$(CPSEP)$(RUNCP)
-
-# Get the list of all source files
-
-SRC = $(SRCDIR)/org/postgis/*.java $(SRCDIR)/org/postgis/*/*.java $(SRCDIR)/examples/*.java
-
-STUBSRC = $(STUBDIR)/org/postgresql/*.java
-
-JTSSRC = $(JTSDIR)/org/postgis/jts/*.java $(JTSDIR)/examples/*.java
-
-
-# Now the makefile targets that do the work:
-# The default target:
-all:   deprecation-warning \
-       jar \
-               postgis-jdbc-javadoc.zip \
-       offlinetests
-
-# This Makefile is deprecated for build.xml (build with Ant)
-deprecation-warning:
-       @echo "***"
-       @echo "*** WARNING: This Makefile is deprecated for a build using Ant (build.xml)"
-       @echo "***"
-       @echo "*** If you wish to build a standard PostGIS JDBC driver, please use the Ant build"
-       @echo "*** If you wish to build a JTS-enabled PostGIS JDBC driver, or run the online"
-       @echo "*** regression tests, you will currently still need to use this Makefile"
-       @echo "***"
-
-# Packing the archives
-
-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)
-
-postgis_debug.jar: postgis.jar $(SRC)
-       $(CP) postgis.jar postgis_debug.jar
-       $(JAR) -uf postgis_debug.jar $(DEBUGJARCONTENTS)
-
-# See comment for DEBUGJAR above for this rule.
-postgis_debug.fastjar: compile $(SRC) $(SRCDIR)/org/postgresql/driverconfig.properties
-       $(JAR) -cf postgis_debug.jar $(JARCONTENTS) $(DEBUGJARCONTENTS)
-
-$(BUILD):
-       $(MKDIR) $(BUILD)
-
-$(STUBBUILD):
-       $(MKDIR) $(STUBBUILD)
-
-$(VERSIONPATH): $(BUILD)
-       $(MKDIR) $(VERSIONPATH)
-
-$(VERSIONTARGET): $(SRC) ../../Version.config $(VERSIONPATH)
-       $(CP) ../../Version.config $(VERSIONTARGET)
-
-stubcompile: $(STUBBUILD) $(SRCCONF) $(STUBSRC)
-       $(JAVAC) -d $(STUBBUILD) $(STUBSRC)
-       touch stubcompile
-
-compile: stubcompile $(BUILD) $(SRCCONF) $(SRC) $(VERSIONTARGET)
-       $(JAVAC) $(COMP_ADDCP) "$(BUILDCP)" -d $(BUILD) $(SRC) 
-       touch compile
-
-test:  postgis.jar
-       $(JAVA) $(EXEC_ADDCP) "$(RUNCP)" $(EXAMPLES)/Test $(TESTRD) 
-
-jtest: postgis.jar
-       $(JAVA) $(EXEC_ADDCP) "$(RUNCP)" $(EXAMPLES)/TestServer $(TESTRD) \
-        jdbc:postgresql:$(PGURL) $(PGUSER) $(PGPASS)
-
-ptestoffline: postgis.jar      
-       $(JAVA) $(EXEC_ADDCP) "$(RUNCP)" $(EXAMPLES)/TestParser $(TESTRD) offline
-
-ptest: postgis.jar
-       $(JAVA) $(EXEC_ADDCP) "$(RUNCP)" $(EXAMPLES)/TestParser $(TESTRD) \
-        "jdbc:postgresql_postGIS:$(PGURL);jdbc:postgresql_autogis:$(PGURL)" \
-        $(PGUSER) $(PGPASS)
-
-boxtestoffline: postgis.jar    
-       $(JAVA) $(EXEC_ADDCP) "$(RUNCP)" $(EXAMPLES)/TestBoxes $(TESTRD) offline
-
-boxtest: postgis.jar
-       $(JAVA) $(EXEC_ADDCP) "$(RUNCP)" $(EXAMPLES)/TestBoxes $(TESTRD) \
-        jdbc:postgresql_postGIS:$(PGURL) $(PGUSER) $(PGPASS)
-
-autoregistertest: postgis.jar
-       $(JAVA) $(EXEC_ADDCP) "$(RUNCP)" $(EXAMPLES)/TestAutoregister $(TESTRD) \
-        jdbc:postgresql:$(PGURL) $(PGUSER) $(PGPASS)
-
-# Print all available versions
-versions: postgis.jar
-       $(JAVA) $(EXEC_ADDCP) "$(RUNCP)" $(EXAMPLES)/VersionPrinter jdbc:postgresql://$(PGHOST):$(PGPORT)/$(PGDATABASE) $(PGUSER) $(PGPASS)
-
-offlinetests: boxtestoffline ptestoffline test
-
-onlinetests: boxtest ptest jtest autoregistertest
-
-# boxtest and ptest include boxtestoffline and ptestoffline, so we only need
-# to run test in addition to the onlinetests
-alltests: onlinetests test
-
-# Cleaning
-clean:
-       echo cleaning...
-       $(DELETE) $(BUILD) bin stubbin postgis.jar postgis_debug.jar \
-               compile stubcompile jtscompile $(JTSBUILD) postgis_jts.jar \
-               javadoc-build postgis-jdbc-javadoc.zip \
-               $(TESTOUTPUT) \
-               postgis_$(VERSION).jar \
-               postgis_debug_$(VERSION).jar \
-               postgis_jts_$(VERSION).jar
-
-maintainer-clean: clean
-       $(DELETE) $(SRCCONF)
-
-
-install: jar installdirs
-       @echo Testing for successful inclusion of ../Makefile.config
-       test ../Makefile.config
-       $(INSTALL_DATA) postgis.jar $(DESTDIR)
-       $(INSTALL_DATA) postgis_debug.jar $(DESTDIR)
-
-installdirs:
-       @mkdir -p $(DESTDIR)
-
-postgis-jdbc-javadoc.zip: javadoc-build
-       $(JAR) -cf postgis-jdbc-javadoc.zip -C javadoc-build .
-
-javadoc-build:
-       $(MKDIR) javadoc-build
-       # We use an ugly trick to build on windows and unix - 
-       # javadoc command line options are not portable wr/t path separators
-       javadoc -d javadoc-build -sourcepath "src:jtssrc:;src;jtssrc" \
-               org.postgis org.postgis.jts org.postgis.binary org.postgis.java2d examples
-
-# Preliminary JTS support
-
-postgis_jts: postgis_jts.jar jtstestoffline
-       @echo "Warning! This is beta code. Use at your own risk."
-
-$(JTSBUILD):
-       $(MKDIR) $(JTSBUILD)
-
-jtscompile: compile stubcompile $(JTSBUILD) $(SRCCONF) $(JTSSRC)
-       $(JAVAC) $(COMP_ADDCP) "$(BUILD)$(CPSEP)$(BUILDCP)" -d $(JTSBUILD) $(JTSSRC) 
-       touch jtscompile
-       
-jtstestoffline: jtscompile     
-       $(JAVA) $(EXEC_ADDCP) "$(JTSPATH)" $(EXAMPLES)/JtsTestParser $(TESTRD) offline
-
-jtstest: jtscompile
-       $(JAVA) $(EXEC_ADDCP) "$(JTSPATH)" $(EXAMPLES)/JtsTestParser $(TESTRD) \
-       jdbc:postgres_jts:$(PGURL) $(PGUSER) $(PGPASS)
-
-postgis_jts.jar: postgis.jar jtscompile $(SRCDIR)/org/postgresql/driverconfig.properties
-       $(CP) postgis.jar postgis_jts.jar
-       $(JAR) -uf postgis_jts.jar -C $(JTSBUILD) .
-       $(CP) postgis_jts.jar postgis_jts_$(VERSION).jar
-
diff --git a/java/jdbc/Makefile.in b/java/jdbc/Makefile.in
new file mode 100644 (file)
index 0000000..5909cf4
--- /dev/null
@@ -0,0 +1,24 @@
+# **********************************************************************
+# *
+# * PostGIS - Spatial Types for PostgreSQL
+# * http://postgis.refractions.net
+# *
+# * Copyright (C) 2012 Sandro Santilli <strk@keybit.net>
+# *
+# * This is free software; you can redistribute and/or modify it under
+# * the terms of the GNU General Public Licence. See the COPYING file.
+# *
+# **********************************************************************
+
+ANT=@ANT@
+
+all: build
+
+build clean distclean check:
+       $(ANT) $@
+
+maintainer-clean: distclean
+       : nothing to do
+
+install uninstall:
+       : TODO !
index e213c458c81905b4d06217d3b465759dd9c35734..055001bd59b5a962567c37cd70fe669e7e776420 100644 (file)
@@ -4,7 +4,8 @@
  *
  * PostGIS JDBC driver
  *
- * (C) 2007  Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> 
+ * (C) 2007  Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
+ * Rewritten on 2012 by Maria Arias de Reyna <delawen@gmail.com> 
  *
  * This library is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
  * http://www.gnu.org.
  *
 
- Usage: ant -Dclasspath=/path/to/postgresql-jdbc.jar
+ Usage: ant build
 
  -->
-<project name="postgis-jdbc-driver" default="all" basedir=".">
+
+<project name="postgis-jdbc-driver" default="all" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
 
   <!-- Global properties -->
   <property name="stubsrc" value="stubs"/>
   <property file="${versioninfo}"/>
   <property name="postgis_version" value="${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}"/>
 
-  <!-- Build classpath - required to build the PostGIS JDBC driver -->
-  <path id="buildclasspath">
-    <pathelement location="${stubbuild}/"/> 
-    <pathelement path="${pgdefaultjar}"/>
-    <pathelement path="${classpath}"/>
-  </path>
-
-  <!-- Regression test classpath - must contain the PostgreSQL JDBC driver plus the PostGIS JDBC driver -->
   <path id="regressclasspath">
     <pathelement path="${pgdefaultjar}"/>
     <pathelement path="${classpath}"/>
   </path>
 
 
-  <!-- Clean target -->
-  <target name="clean">
-    <!-- Delete the binary build directories -->
-    <delete dir="${stubbuild}"/>
-    <delete dir="${build}"/>
-
-    <!-- Delete the JAR files -->
-    <delete>
-      <fileset dir="." includes="postgis_${postgis_version}.jar"/>
-      <fileset dir="." includes="postgis_debug_${postgis_version}.jar"/>
-    </delete>
-
-    <!-- Delete the test log file -->
-    <delete>
-      <fileset dir="." includes="${regresslog}"/>
-    </delete>
-
-    <!-- Delete the documentation -->
-    <delete dir="${javadocbuild}"/>
-    <delete>
-      <fileset dir="." includes="${javadoczip}"/>
-    </delete>
-  </target>
-
-
-  <!-- Main target -->
-  <target name="all" depends="build-standard, offline-regression, javadoc-compress"/>
-
-
-  <!-- Build the standard (non-JTS) jar -->
-  <target name="build-standard" depends="stubbuild, standard-jar">
-    <echo message="Building standard JDBC jar"/>
-  </target>
-
+     <!-- Loading Maven dependencies -->
+     <mkdir dir="lib"/>
+     <get src="http://www.apache.org/dist/maven/binaries/maven-ant-tasks-2.1.3.jar" dest="lib/maven-ant-tasks-2.1.3.jar"/>
 
-  <!-- Build the stubs (the pgjdbc 7.2/7.4/8.0 compatibility stub stuff) -->
-  <target name="stubbuild">
-    <mkdir dir="${stubbuild}"/>
-    <javac srcdir="${stubsrc}" destdir="${stubbuild}" source="1.2" target="1.2"/>
-  </target>
+     <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
+     <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
+           uri="antlib:org.apache.maven.artifact.ant"
+           classpathref="maven-ant-tasks.classpath" />
 
-  <!-- Standard driver compile -->
-  <target name="standard-compile">
-    <mkdir dir="${build}"/>
-    <javac srcdir="${src}" destdir="${build}" classpathref="buildclasspath" source="1.2" target="1.2"/>
-  </target>
+     <target name="build">
+      <artifact:mvn pom="pom.xml">
+         <arg value="package"/>
+      </artifact:mvn> 
+     </target>
 
-  <!-- Standard driver JAR file (creates debug and non-debug versions) -->
-  <target name="standard-jar" depends="standard-compile">
-    <!-- Copy driverconfig.properties into the JAR to auto-register PostGIS types -->
-    <copy file="${src}/org/postgresql/driverconfig.properties" tofile="${build}/org/postgresql/driverconfig.properties"/>
-    
-    <!-- Copy Version.config into the JAR (this is read at runtime) -->
-    <copy file="${versioninfo}" tofile="${build}/org/postgis/version.properties"/>
-
-    <!-- Copy additional README and copyright files -->
-    <copy file="README" tofile="${build}/README"/>
-    <copy file="COPYING_LGPL" tofile="${build}/COPYING_LGPL"/>
-    <copy file="../../COPYING" tofile="${build}/COPYING"/>
-
-    <!-- Create the non-debug version -->
-    <jar destfile="postgis-${postgis_version}.jar" duplicate="preserve">
-      <fileset dir="${build}"/>
-    </jar>
-
-    <!-- Create debug version -->
-    <jar destfile="postgis_debug-${postgis_version}.jar" duplicate="preserve">
-      <fileset dir="${build}"/>
-      <fileset dir="${src}" includes="org/**"/>
-      <fileset dir="${src}" includes="examples/**"/>
-    </jar>
+    <target name="all" depends="build"/>
+  
+     <target name="clean">
+      <artifact:mvn pom="pom.xml">
+         <arg value="clean"/>
+      </artifact:mvn>
+     </target>
+
+    <target name="distclean" depends="clean">
+      <delete dir="${user.home}/.m2/repository/"/>
+      <delete dir="lib"/>
+    </target>
+
+  <target name="check">
+     <artifact:mvn pom="pom.xml">
+       <arg value="test"/>
+     </artifact:mvn>
   </target>
 
+  <!-- Extra targets -->
 
   <!-- Offline regression tests -->
   <target name="offline-regression" depends="boxtestoffline-regression, ptestoffline-regression, test-regression"/>
   </target>
 
 
+
   <!-- Documentation -->
-  <target name="javadoc" depends="build-standard">
+  <target name="javadoc" depends="build">
     <javadoc sourcepath="${src}" destdir="${javadocbuild}">
       <package name="org.postgis"/>
       <package name="org.postgis.jts"/>
   </target>
 
 </project>
-