[libpostgresql-jdbc-java] 110/128: build for maven

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:18:36 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to annotated tag REL9_3_1100
in repository libpostgresql-jdbc-java.

commit e0a0baae0b4df7cb76c626e4479001fc973a454e
Author: Dave Cramer <dave.cramer at credativ.ca>
Date:   Thu Oct 10 17:33:23 2013 -0400

    build for maven
---
 build.properties |  14 +++-
 build.xml        | 194 +++++++++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 179 insertions(+), 29 deletions(-)

diff --git a/build.properties b/build.properties
index 5c91342..978735c 100644
--- a/build.properties
+++ b/build.properties
@@ -4,6 +4,18 @@
 
 major=9
 minor=3
-fullversion=9.3devel
+fullversion=9.3
 def_pgport=5432
 enable_debug=yes
+
+maven.group.id=org.postgresql
+maven.artifact.id=postgresql
+#maven.artifact.version=9.3-2000-jdbc4
+maven.artifact.version=9.3.jdbc4-SNAPSHOT
+maven.artifact.description=The PostgreSQL Driver JDBC4
+
+# Maven snapshots and staging repository id and url
+maven.snapshots.repository.id=sonatype-nexus-snapshots
+maven.snapshots.repository.url=https://oss.sonatype.org/content/repositories/snapshots
+maven.staging.repository.id=sonatype-nexus-staging
+maven.staging.repository.url=https://oss.sonatype.org/service/local/staging/deploy/maven2
diff --git a/build.xml b/build.xml
index 7e70d60..bdb8843 100644
--- a/build.xml
+++ b/build.xml
@@ -15,7 +15,7 @@
   <!ENTITY jarfiles "postgresql.jar">
 ]>
 
-<project name="postgresqlJDBC" default="all" basedir=".">
+<project name="postgresqlJDBC" default="all" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
 
   <!-- set global properties for this build -->
   <property name="srcdir"  value="." />
@@ -30,6 +30,81 @@
   <property file="build.local.properties" />
   <property file="build.properties"/>
 
+ <!-- define artifacts' name, which follows the convention of Maven -->
+  <property name="maven.jar" value="${jardir}/${maven.artifact.id}-${maven.artifact.version}.jar"/>
+  <property name="maven.javadoc.jar" value="${jardir}/${maven.artifact.id}-${maven.artifact.version}-javadoc.jar"/>
+  <property name="maven.sources.jar" value="${jardir}/${maven.artifact.id}-${maven.artifact.version}-sources.jar"/>
+
+  <patternset id="jdbc.version.src.pattern">
+    <!-- This is the core of the driver.  It is common for all versions. -->
+    <include name="${package}/*.java" />
+    <include name="${package}/core/**" />
+    <include name="${package}/copy/**" />
+    <include name="${package}/fastpath/**" />
+    <include name="${package}/geometric/**" />
+    <include name="${package}/largeobject/**" />
+    <include name="${package}/util/**" />
+
+    <!--
+    Each jdbcN subpackage is used only if the driver supports *at least* that
+    revision of JDBC. That is, a JDBC2 build uses only jdbc2, a JDBC3 build
+    uses both jdbc2 and jdbc3, etc.
+
+    Within those subpackages, classes beginning with "JdbcN" are assumed to be
+    the concrete implementations for JDBC version N and are built only if the
+    driver supports *exactly* that version. For example, jdbc2/Jdbc2Statement.java
+    is built only if the driver build is a JDBC2 build.
+    -->
+
+    <!-- jdbc2 subpackage -->
+    <include name="${package}/jdbc2/**"/>
+
+    <!-- jdbc3 subpackage -->
+    <include name="${package}/jdbc3/Abstract*.java"/>
+    <include name="${package}/jdbc3/PSQLSavepoint.java"/>
+
+    <include name="${package}/jdbc3/Jdbc3Array.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3Blob.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3CallableStatement.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3Clob.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3Connection.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3DatabaseMetaData.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3PreparedStatement.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3ResultSet.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3ResultSetMetaData.java.java" if="jdbc3"/>
+    <include name="${package}/jdbc3/Jdbc3Statement.java" if="jdbc3"/>
+
+    <!-- jdbc3g subpackage -->
+    <include name="${package}/jdbc3g/*.java" if="jdbc3g"/>
+    <exclude name="${package}/jdbc3g/Jdbc3g*.java" unless="jdbc3g"/>
+
+    <!-- jdbc4 subpackage -->
+    <include name="${package}/jdbc4/*.java" if="jdbc4any"/>
+    <exclude name="${package}/jdcb4/Jdbc4*.java" unless="jdbc4any"/>
+
+    <!-- ssl -->
+    <include name="${package}/ssl/jdbc4/*.java" if="jdbc4any"/>
+    <include name="${package}/ssl/jdbc3/*.java" if="jdbc3any"/>
+
+    <!-- gss -->
+    <include name="${package}/gss/*.java"/>
+
+    <!-- datasource stuff -->
+    <include name="${package}/jdbc3/Jdbc3ConnectionPool.java" if="jdbc3any"/>
+    <include name="${package}/jdbc3/Jdbc3PoolingDataSource.java" if="jdbc3any"/>
+    <include name="${package}/jdbc3/Jdbc3SimpleDataSource.java" if="jdbc3any"/>
+
+    <include name="${package}/ds/*.java"/>
+    <include name="${package}/ds/common/*.java"/>
+    <include name="${package}/ds/jdbc23/*.java"/>
+    <include name="${package}/ds/jdbc4/*.java" if="jdbc4any"/>
+
+    <!-- XA stuff -->
+    <include name="${package}/xa/*.java"/>
+    <include name="${package}/xa/jdbc3/*.java"/>
+    <include name="${package}/xa/jdbc4/*.java" if="jdbc4any"/>
+  </patternset>
+
   <target name="check_versions">
     <condition property="jdbc2">
       <or>
@@ -198,7 +273,7 @@
 
   <target name="check_driver">
     <uptodate targetfile="${package}/Driver.java" property="driver.uptodate">
-      <srcfiles dir="${srcdir}">
+      <srcfiles dir=".">
       <include name="${package}/Driver.java.in"/>
       <include name="${package}/ds/PGSimpleDataSource.java.in"/>
       <include name="${package}/ds/PGPoolingDataSource.java.in"/>
@@ -313,33 +388,33 @@
     <!-- Put a check for the current version here -->
 
     <!-- now copy and filter the file -->
-    <copy file="${srcdir}/${package}/Driver.java.in"
+    <copy file="${package}/Driver.java.in"
           overwrite="true"
-          tofile="${srcdir}/${package}/Driver.java"
+          tofile="${package}/Driver.java"
           filtering="yes" />
-    <copy file="${srcdir}/${package}/ds/PGPoolingDataSource.java.in"
+    <copy file="${package}/ds/PGPoolingDataSource.java.in"
           overwrite="true"
-          tofile="${srcdir}/${package}/ds/PGPoolingDataSource.java"
+          tofile="${package}/ds/PGPoolingDataSource.java"
           filtering="yes" />
-    <copy file="${srcdir}/${package}/ds/PGSimpleDataSource.java.in"
+    <copy file="${package}/ds/PGSimpleDataSource.java.in"
           overwrite="true"
-          tofile="${srcdir}/${package}/ds/PGSimpleDataSource.java"
+          tofile="${package}/ds/PGSimpleDataSource.java"
           filtering="yes" />
-    <copy file="${srcdir}/${package}/ds/PGPooledConnection.java.in"
+    <copy file="${package}/ds/PGPooledConnection.java.in"
           overwrite="true"
-          tofile="${srcdir}/${package}/ds/PGPooledConnection.java"
+          tofile="${package}/ds/PGPooledConnection.java"
           filtering="yes" />
-    <copy file="${srcdir}/${package}/ds/PGConnectionPoolDataSource.java.in"
+    <copy file="${package}/ds/PGConnectionPoolDataSource.java.in"
           overwrite="true"
-          tofile="${srcdir}/${package}/ds/PGConnectionPoolDataSource.java"
+          tofile="${package}/ds/PGConnectionPoolDataSource.java"
           filtering="yes" />
-    <copy file="${srcdir}/${package}/xa/PGXADataSource.java.in"
+    <copy file="${package}/xa/PGXADataSource.java.in"
           overwrite="true"
-          tofile="${srcdir}/${package}/xa/PGXADataSource.java"
+          tofile="${package}/xa/PGXADataSource.java"
           filtering="yes" />
-    <copy file="${srcdir}/${package}/ssl/MakeSSL.java.in"
+    <copy file="${package}/ssl/MakeSSL.java.in"
           overwrite="true"
-          tofile="${srcdir}/${package}/ssl/MakeSSL.java"
+          tofile="${package}/ssl/MakeSSL.java"
           filtering="yes" />
 
   <echo message="Configured build for the ${edition} edition driver." />
@@ -363,13 +438,13 @@
   <target name="clean">
     <delete quiet="true" dir="${builddir}" />
     <delete quiet="true" dir="${jardir}" />
-    <delete quiet="true" file="${srcdir}/${package}/Driver.java" />
-    <delete quiet="true" file="${srcdir}/${package}/ds/PGPoolingDataSource.java" />
-    <delete quiet="true" file="${srcdir}/${package}/ds/PGSimpleDataSource.java" />
-    <delete quiet="true" file="${srcdir}/${package}/ds/PGPooledConnection.java" />
-    <delete quiet="true" file="${srcdir}/${package}/ds/PGConnectionPoolDataSource.java" />
-    <delete quiet="true" file="${srcdir}/${package}/xa/PGXADataSource.java" />
-    <delete quiet="true" file="${srcdir}/${package}/ssl/MakeSSL.java" />
+    <delete quiet="true" file="${package}/Driver.java" />
+    <delete quiet="true" file="${package}/ds/PGPoolingDataSource.java" />
+    <delete quiet="true" file="${package}/ds/PGSimpleDataSource.java" />
+    <delete quiet="true" file="${package}/ds/PGPooledConnection.java" />
+    <delete quiet="true" file="${package}/ds/PGConnectionPoolDataSource.java" />
+    <delete quiet="true" file="${package}/xa/PGXADataSource.java" />
+    <delete quiet="true" file="${package}/ssl/MakeSSL.java" />
   </target>
 
   <!-- This compiles and executes the JUnit tests -->
@@ -380,7 +455,7 @@
   <property name="database" value="test" />
   <property name="username" value="test" />
   <!-- Password must be something.  Doesn't matter if trust is used! -->
-  <property name="password" value="test" />
+  <property name="password" value="password" />
   <property name="preparethreshold" value="5" />
   <property name="loglevel" value="0" />
   <property name="protocolVersion" value="0" />
@@ -455,12 +530,12 @@
   <!-- Build public javadoc -->
   <target name="publicapi" depends="compile">
     <mkdir dir="${builddir}/publicapi" />
-    <javadoc destdir="${builddir}/publicapi" charset="utf-8">
+    <javadoc destdir="${builddir}/publicapi">
       <classpath>
         <pathelement path="${builddir}" />
         <pathelement path="${java.class.path}" />
       </classpath>
-      <fileset dir="${srcdir}/${package}">
+      <fileset dir="${package}">
         <include name="copy/*.java" />
         <include name="geometric/*.java" />
         <include name="largeobject/*.java" />
@@ -481,12 +556,12 @@
 
   <!-- Build driver-internal javadoc. NB: needs Ant 1.6 & JDK 1.4 for 'breakiterator'. -->
   <target name="privateapi" depends="compile">
-    <javadoc destdir="${builddir}/privateapi" breakiterator="yes" charset="utf-8">
+    <javadoc destdir="${builddir}/privateapi" breakiterator="yes">
       <classpath>
         <pathelement path="${builddir}" />
         <pathelement path="${java.class.path}" />
       </classpath>
-      <fileset dir="${srcdir}/${package}">
+      <fileset dir="${package}">
         <include name="**/*.java"/>
 	<exclude name="jdbc3/Jdbc3*.java" unless="jdbc3" />
 	<exclude name="jdbc3g/Jdbc3g*.java" unless="jdbc3g" />
@@ -547,4 +622,67 @@
     </xmlvalidate>
   </target>
 
+  <target name="deploy" depends="maven-jar" description="deploy snapshot version to Maven snapshot repository">
+    <mkdir dir="${builddir}/pom"/>
+    <!-- Copy the templated pom.xml with version info -->
+    <filter token="maven.group.id" value="${maven.group.id}"/>
+    <filter token="maven.artifact.id" value="${maven.artifact.id}"/>
+    <filter token="maven.artifact.version" value="${maven.artifact.version}"/>
+    <filter token="maven.artifact.description" value="${maven.artifact.description}"/>
+    <copy todir="${builddir}/pom" filtering="true" file="src/pom/pom.xml"/>
+
+    <artifact:mvn>
+      <artifact:arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file"/>
+      <artifact:arg value="-Durl=${maven.snapshots.repository.url}"/>
+      <artifact:arg value="-DrepositoryId=${maven.snapshots.repository.id}"/>
+      <artifact:arg value="-DpomFile=${builddir}/pom/pom.xml"/>
+      <artifact:arg value="-Dfile=${maven.jar}"/>
+      <artifact:arg value="-Pgpg"/>
+      
+    </artifact:mvn>
+  </target>
+
+  <!-- before this, update project version (both build.xml and pom.xml) from SNAPSHOT to RELEASE -->
+  <target name="stage" depends="maven-jar" description="deploy release version to Maven staging repository">
+    <mkdir dir="${builddir}/pom"/>
+    <!-- Copy the templated pom.xml with version info -->
+    <filter token="maven.group.id" value="${maven.group.id}"/>
+    <filter token="maven.artifact.id" value="${maven.artifact.id}"/>
+    <filter token="maven.artifact.version" value="${maven.artifact.version}"/>
+    <filter token="maven.artifact.description" value="${maven.artifact.description}"/>
+    <copy todir="${builddir}/pom" filtering="true" file="src/pom/pom.xml"/>
+    <!-- sign and deploy the main artifact -->
+    <artifact:mvn>
+      <artifact:arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file" />
+      <artifact:arg value="-Durl=${maven.staging.repository.url}" />
+      <artifact:arg value="-DrepositoryId=${maven.staging.repository.id}" />
+      <artifact:arg value="-DpomFile=${builddir}/pom/pom.xml" />
+      <artifact:arg value="-Dfile=${maven.jar}" />
+      <artifact:arg value="-DfinalName=${maven.jar}" />
+      <artifact:arg value="-Dtypes=jar,jar" />
+      <artifact:arg value="-Dclassifiers=sources,javadoc" />
+      <artifact:arg value="-Dfiles=${maven.sources.jar},${maven.javadoc.jar}" />
+      <artifact:arg value="-Pgpg" />
+    </artifact:mvn>
+  </target>
+
+  <!-- create jar files for distribution to maven central -->
+  <target name="maven-jar" depends="jar, publicapi">
+    <!-- Copy the built jar into a maven compatible name -->
+    <copy file="${jardir}/postgresql.jar" tofile="${maven.jar}"/>
+    <!-- Create a jar of the javadoc public api -->
+    <jar jarfile="${maven.javadoc.jar}">
+      <fileset dir="${builddir}/publicapi">
+        <include name="**/*"/>
+      </fileset>
+    </jar>
+    <!-- Create a jar of the source code -->
+    <jar jarfile="${maven.sources.jar}">
+      <fileset dir="${srcdir}">
+        <patternset refid="jdbc.version.src.pattern"/>
+        <include name="META-INF/**/*"/>
+      </fileset>
+    </jar>
+  </target>
+
 </project>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list