view build.xml @ 85:073ee535234b embedded

Ok. Now everything compiles back with Ant again. Moved the Embedded stuff to the temporary MonetDBJavaLite repository before moving into the suggested MonetDBLite repository. The soon generated Embedded Connection jar will have a dependency on the regular JDBC driver jar. The JDBC driver jar is independent, however if attempted to create an Embedded Connection with will try to load the respective class from the class loader, failing if the Embedded Connection jar is not present. If anyone in the group has expertise on Java Class dynamic loading, please contact me because there might be issues on this. Removed the pom.xml file because the regular maven compilation fails.
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Fri, 30 Dec 2016 18:55:13 +0000 (2016-12-30)
parents a5a898f6886c
children 2b5e32efb1a4
line wrap: on
line source
<?xml version="1.0"?><!-- vim:set ts=2 sw=2 expandtab: -->

<!--
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0.  If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
-->

<!--

  Build file to allow ant (http://jakarta.apache.org/ant/) to be used
  to build the MonetDB Java libraries, such as the JDBC and XML:DB
  drivers.

-->

<project name="MonetDB_Java_Drivers" default="default" basedir=".">


  <!-- set global properties for this build -->
  <property name="srcdir"               value="src/main/java" />
  <property name="libdir"               value="lib" />
  <property name="jardir"               value="jars" />
  <property name="builddir"             value="build" />
  <property name="docdir"               value="doc" />
  <property name="jdbc-package"         value="nl/cwi/monetdb/jdbc" />
  <property name="mcl-package"          value="nl/cwi/monetdb/mcl" />
  <property name="client-package"       value="nl/cwi/monetdb/client" />
  <property name="util-package"         value="nl/cwi/monetdb/util" />
  <property name="mero-control-package" value="nl/cwi/monetdb/merovingian" />

  <property file="build.properties" />

  <property name="jdbc-jar"
    value="${jardir}/monetdb-jdbc-${JDBC_MAJOR}.${JDBC_MINOR}.jar" />
  <property name="jdbcclient-jar"
    value="${jardir}/jdbcclient.jar" />
  <property name="jmonetdb-jar"
    value="${jardir}/jmonetdb.jar" />
  <property name="mcl-jar"
    value="${jardir}/monetdb-mcl-${MCL_MAJOR}.${MCL_MINOR}.jar" />

  <property name="mero-control-jar"
    value="${jardir}/merocontrol.jar" />

  <!-- 

  Cross-compile for JVM 1.5 ("Java 5"). This allows the driver to work with older java installations.
  see also https://blogs.oracle.com/darcy/entry/bootclasspath_older_source for details on the error message w.r.t rt.jar 
  to get around this issue, the -Xlint:-options compiler option has also been addded.
  2013-04-17, hannes@cwi.nl

  Update: cross-compile for JVM 1.7 since 1.5 and 1.6 are both long
  since EOL.
  2015-07-16, sjoerd@acm.org

  -->
  <property name="jvm.version"               value="1.7" />
  <property name="javac.flags"               value="-Xlint:-options" />

  <!-- full target -->
  <target name="all">
    <antcall target="distjdbc" />

    <antcall target="distmerocontrol" />

    <antcall target="doc" />
  </target>

  <target name="distall">
    <antcall target="distjdbc" />
    <antcall target="distmerocontrol" />
  </target>

  <target name="default">
    <antcall target="jar_jdbcclient" />
    <antcall target="jar_jmonetdb" />
  </target>

  <target name="distjdbc">
    <antcall target="jar_jdbc" />
    <antcall target="jar_mcl" />
    <antcall target="jar_jdbcclient" />
  </target>

  <target name="distmerocontrol">
    <antcall target="jar_mero_control" />
  </target>

  <!-- jar targets -->
  <target name="jar_jdbc" depends="compile_mcl,compile_jdbc"
    unless="uptodate.jdbc-jar">
    <echo file="${builddir}/META-INF/services/java.sql.Driver" append="false">nl.cwi.monetdb.jdbc.MonetDriver</echo>
    <jar jarfile="${jdbc-jar}">
      <fileset dir="${builddir}">
        <include name="${jdbc-package}/**/*.class" />
        <include name="${mcl-package}/**/*.class" />
        <include name="META-INF/services/java.sql.Driver" />
      </fileset>
    </jar>
  </target>

  <target name="jar_mcl" depends="compile_mcl">
    <jar jarfile="${mcl-jar}">
      <fileset dir="${builddir}">
        <include name="${mcl-package}/**/*.class" />
      </fileset>
    </jar>
  </target>

  <target name="jar_client" depends="compile_util,compile_client">
    <jar jarfile="${jardir}/monetdb-clients.jar">
      <fileset dir="${builddir}">
        <include name="${client-package}/**/*.class" />
        <include name="${util-package}/**/*.class" />
      </fileset>
    </jar>
  </target>

  <!-- a convenience jar of JDBC plus the JdbcClient utililty -->
  <target name="jar_jdbcclient"
    depends="compile_mcl,compile_jdbc,compile_util,compile_client"
    unless="uptodate.jdbcclient-jar">
    <echo message="Building JDBC + JdbcClient convenience jar" />
    <jar jarfile="${jdbcclient-jar}">
      <fileset dir="${builddir}">
        <include name="${jdbc-package}/**/*.class" />
        <include name="${mcl-package}/**/*.class" />
        <include name="${client-package}/**/*.class" />
        <include name="${util-package}/**/*.class" />
        <include name="META-INF/services/java.sql.Driver" />
      </fileset>
      <manifest>
        <attribute name="Built-By" value="${user.name}" />
        <attribute name="Main-Class" value="nl.cwi.monetdb.client.JdbcClient" />
      </manifest>
    </jar>
  </target>

  <!-- a convenience jar of MeroControl plus the JMonetDB utility -->
  <target name="jar_jmonetdb"
    depends="compile_mcl,compile_util,compile_mero_control,compile_client"
    unless="uptodate.jmonetdb-jar">
    <echo message="Building MeroControl + JmonetDB convenience jar" />
    <jar jarfile="${jmonetdb-jar}">
      <fileset dir="${builddir}">
        <include name="${mero-control-package}/**/*.class" />
        <include name="${mcl-package}/**/*.class" />
        <include name="${client-package}/**/JMonetDB.class" />
        <include name="${util-package}/**/*.class" />
      </fileset>
      <manifest>
        <attribute name="Built-By" value="${user.name}" />
        <attribute name="Main-Class" value="nl.cwi.monetdb.client.JMonetDB" />
      </manifest>
    </jar>
  </target>

  <target name="jar_mero_control"
    depends="compile_mcl,compile_mero_control">
    <jar jarfile="${mero-control-jar}">
      <fileset dir="${builddir}">
        <include name="${mero-control-package}/**/*.class" />
      </fileset>
      <manifest>
        <attribute name="Built-By" value="${user.name}" />
      </manifest>
    </jar>
  </target>

  <!-- compile targets -->
  <target name="compile_jdbc" depends="prepare,driver">
    <echo message="Compiling JDBC driver" />
    <javac
      classpath="${srcdir}"
      destdir="${builddir}"
      debug="${debug}"
      optimize="${optimize}"
      includeantruntime="false"
      source="${jvm.version}"
      target="${jvm.version}"
      >
      <src path="${srcdir}" />
      <include name="${jdbc-package}/**/*.java" />
      <compilerarg line="${javac.flags}" />
    </javac>
  </target>

  <target name="compile_mcl" depends="prepare">
    <echo message="Compiling MCL" />
    <javac
      classpath="${srcdir}"
      srcdir="${srcdir}"
      destdir="${builddir}"
      debug="${debug}"
      optimize="${optimize}"
      includeantruntime="false"
      source="${jvm.version}"
      target="${jvm.version}"
      >
      <include name="${mcl-package}/**/*.java" />
      <compilerarg line="${javac.flags}" />
    </javac>
  </target>

  <target name="compile_client" depends="prepare">
    <echo message="Compiling Clients" />
    <javac
      classpath="${srcdir}"
      srcdir="${srcdir}"
      destdir="${builddir}"
      debug="${debug}"
      optimize="${optimize}"
      includeantruntime="false"
      source="${jvm.version}"
      target="${jvm.version}"
      >
      <include name="${client-package}/**/*.java" />
      <compilerarg line="${javac.flags}" />
    </javac>
  </target>

  <target name="compile_util" depends="prepare">
    <echo message="Compiling Utilities" />
    <javac
      classpath="${srcdir}"
      srcdir="${srcdir}"
      destdir="${builddir}"
      debug="${debug}"
      optimize="${optimize}"
      includeantruntime="false"
      source="${jvm.version}"
      target="${jvm.version}"
      >
      <include name="${util-package}/**/*.java" />
      <compilerarg line="${javac.flags}" />
    </javac>
  </target>

  <target name="compile_mero_control" depends="prepare">
    <echo message="Compiling Merovingian Control library" />
    <javac
      classpath="${srcdir}"
      srcdir="${srcdir}"
      destdir="${builddir}"
      debug="${debug}"
      optimize="${optimize}"
      includeantruntime="false"
      source="${jvm.version}"
      target="${jvm.version}"
      >
      <include name="${mero-control-package}/**/*.java" />
      <compilerarg line="${javac.flags}" />
    </javac>
  </target>

  <!--
  This generates MonetDriver.java.in from its ".java.in" equivalents.  It's
  required for importing the driver version properties.
  -->
  <target name="driver" depends="prepare" unless="uptodate.drivers">
    <tstamp>
      <format property="TODAY" pattern="yyyyMMdd" />
    </tstamp>

    <!-- Some defaults -->
    <filter token="JDBC_MAJOR" value="${JDBC_MAJOR}" />
    <filter token="JDBC_MINOR" value="${JDBC_MINOR}" />
    <filter token="MCL_MAJOR" value="${MCL_MAJOR}" />
    <filter token="MCL_MINOR" value="${MCL_MINOR}" />
    <filter token="JDBC_DEF_PORT" value="${JDBC_DEF_PORT}" />
    <filter token="JDBC_VER_SUFFIX" value="${JDBC_VER_SUFFIX} ${TODAY}" />

    <fail unless="JDBC_MAJOR" message="'JDBC_MAJOR' undefined. Please follow the directions in build.properties."/>
    <fail unless="JDBC_MINOR" message="'JDBC_MINOR' undefined. Please follow the directions in build.properties."/>
    <fail unless="JDBC_DEF_PORT" message="'JDBC_DEF_PORT' undefined. Please follow the directions in build.properties."/>
    <fail unless="JDBC_VER_SUFFIX" message="'JDBC_VER_SUFFIX' undefined. Please follow the directions in build.properties."/>

    <!-- now copy and filter the file -->
  	<copy file="${srcdir}/${jdbc-package}/MonetDriver.java.in"
  	  overwrite="true"
  	  tofile="src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in"
  	  filtering="yes" />

    <echo message="Configured build for the ${JDBC_MAJOR}.${JDBC_MINOR} (${JDBC_VER_SUFFIX}) edition driver" />
  </target>

  <!-- Prepares the build directory and sets some variables -->
  <!-- checks whether regeneration of files is necessary -->
  <target name="prepare">
    <condition property="debug" value="true">
      <equals arg1="${enable_debug}" arg2="true" casesensitive="false" trim="true" />
    </condition>
    <condition property="debug" value="false">
      <not>
        <equals arg1="${enable_debug}" arg2="true" casesensitive="false" trim="true" />
      </not>
    </condition>
    <condition property="optimize" value="true">
      <equals arg1="${enable_optimize}" arg2="true" casesensitive="false" trim="true" />
    </condition>
    <condition property="optimize" value="false">
      <not>
        <equals arg1="${enable_optimize}" arg2="true" casesensitive="false" trim="true" />
      </not>
    </condition>

    <uptodate targetfile="${jdbc-jar}" property="uptodate.jdbc-jar">
      <srcfiles dir="${srcdir}">
        <include name="${jdbc-package}/**/*.java" />
        <include name="${mcl-package}/**/*.java" />
      </srcfiles>
    </uptodate>
    <uptodate targetfile="${jdbcclient-jar}" property="uptodate.jdbcclient-jar">
      <srcfiles dir="${srcdir}">
        <include name="${client-package}/**/*.java" />
        <include name="${jdbc-package}/**/*.java" />
        <include name="${mcl-package}/**/*.java" />
      </srcfiles>
    </uptodate>
    <uptodate targetfile="${jmonetdb-jar}" property="uptodate.jmonetdb-jar">
      <srcfiles dir="${srcdir}">
        <include name="${client-package}/**/*.java" />
        <include name="${mero-control-package}/**/*.java" />
        <include name="${mcl-package}/**/*.java" />
      </srcfiles>
    </uptodate>
    <condition property="uptodate.drivers">
      <and>
        <uptodate targetfile="${builddir}/src/${jdbc-package}/MonetDriver.java">
          <srcfiles dir="${srcdir}">
            <include name="build.properties" />
            <include name="build.local.properties" />
            <include name="${jdbc-package}/MonetDriver.java.in" />
            <include name="${jdbc-package}/**/*.java" />
          </srcfiles>
        </uptodate>
      </and>
    </condition>

    <mkdir dir="${builddir}" />
    <mkdir dir="${jardir}" />
    <echo message="Debug is ${debug}, optimise is ${optimize}" />
  </target>

  <!-- This target removes the build, jar and doc directories -->
  <target name="clean">
    <delete quiet="true" dir="${builddir}" />
    <delete quiet="true" dir="${jardir}" />
    <delete quiet="true" dir="${docdir}" />
  </target>


  <!-- documentation target -->
  <target name="doc"
    depends="compile_mcl,compile_jdbc,compile_util,compile_client,compile_mero_control">
    <javadoc
      destdir="${docdir}"
      author="true"
      version="true"
      use="true"
      windowtitle="MonetDB Java APIs">

      <fileset dir="${srcdir}" defaultexcludes="yes">
        <include name="${jdbc-package}/**/*.java" />
        <include name="${mcl-package}/**/*.java" />
        <include name="${client-package}/**/*.java" />
        <include name="${util-package}/**/*.java" />
        <include name="${mero-control-package}/**/*.java" />
      </fileset>

      <fileset dir="${builddir}/src" defaultexcludes="yes">
        <include name="${jdbc-package}/**/*.java" />
        <include name="${mcl-package}/**/*.java" />
        <include name="${client-package}/**/*.java" />
        <include name="${util-package}/**/*.java" />
        <include name="${mero-control-package}/**/*.java" />
      </fileset>
    </javadoc>
  </target>

</project>