<?xml version="1.0" encoding="UTF-8"?>
<!-- 
// $Id: //open/dev/farrago/dist/build.xml#12 $
// Farrago is an extensible data management system.
// Copyright (C) 2005-2009 The Eigenbase Project
// Copyright (C) 2005-2009 SQLstream, Inc.
// Copyright (C) 2005-2009 LucidEra, Inc.
//
// 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 approved by The Eigenbase Project.
//
// 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
-->

<!-- Farrago ant script for creating distributions -->

<project name="farragoDistribution" basedir="." default="mustSpecify">

  <import file="../buildMacros.xml"/>

  <!-- Load properties needed to derive release spec. -->
  <property file="FarragoRelease.properties"/>
  <fail unless="package.name"/>
  <fail unless="product.version.major"/>
  <fail unless="product.version.minor"/>
  <fail unless="product.version.point"/>
  <property 
    name="release.spec" 
    value="${package.name}-${product.version.major}.${product.version.minor}.${product.version.point}"/>

  <!-- Directories and filenames for distribution jar file. -->
  <property name="dist.dir" location="${farrago.dir}/dist"/>
  <property name="dist.plugin.dir" location="${dist.dir}/plugin"/>
  <property name="dist.jar.file" location="${dist.dir}/farrago.jar"/>

  <target name="createReleaseDir">
    <mkdir dir="${dist.dir}/tmp/${release.spec}"/>
  </target>

  <target name="jar">
    <delete file="${dist.jar.file}" quiet="true"/>
    <jar destfile="${dist.jar.file}" update="true" compress="true">
      <fileset dir="${farrago.dir}">
        <include name="README"/>
        <include name="COPYING"/>
      </fileset>
      <fileset dir="${farrago.classes.dir}">
        <include name="**/*.class"/>
        <include name="**/*.properties"/>
        <include name="FarragoEhCache.xml"/>
      </fileset>
      <fileset dir="${farrago.catalog.src.dir}">
        <include name="**/*.class"/>
        <include name="META-INF/enki/**"/>
      </fileset>
      <fileset dir="${dist.dir}">
        <include name="FarragoRelease.properties"/>
      </fileset>
    </jar>
    <copy file="${farrago.plugin.dir}/FarragoMedJdbc.jar" 
      todir="${dist.plugin.dir}"/>
    <jar destfile="${dist.plugin.dir}/FarragoMedJdbc.jar" update="true">
      <fileset dir="${farrago.dir}">
        <include name="README"/>
        <include name="COPYING"/>
      </fileset>
    </jar>
    <war destfile="${dist.dir}/vjdbc_servlet.war" 
      webxml="${farrago.dir}/ext/vjdbc/web.xml">
      <fileset dir="${thirdparty.dir}/vjdbc/conf/servlet">
        <include name="*.html"/>
        <exclude name="applet.html"/>
      </fileset>
      <webinf dir="${farrago.dir}/ext/vjdbc">
        <include name="vjdbc-config"/>
      </webinf>
      <lib dir="${thirdparty.dir}/vjdbc/lib" excludes="j2ee_api.jar,junit.jar"/>
    </war>
  </target>

  <!-- TODO jvs 26-June-2005:  this isn't used yet -->
  <target name="createPlannervizRelease">
    <copy 
      file="${farrago.dir}/examples/plannerviz/plugin/FarragoPlannerviz.jar" 
      todir="${dist.plugin.dir}"/>
    <jar destfile="${dist.plugin.dir}/FarragoPlannerviz.jar" update="true">
      <fileset dir="${farrago.dir}">
        <include name="README"/>
        <include name="COPYING"/>
      </fileset>
    </jar>
  </target>
</project>
