<?xml version="1.0"?>

<!-- ===================== Calendar config module =====================
     This is the build.xml for the bedework calendar config and deploy module..

     Authors: Mike Douglass   douglm@rpi.edu
     =================================================================== -->

<project name="cal.config" default="init" >
  <property name="base.name" value="config"/>

  <!--
  <import file="${org.bedework.config.base}/build.pubcaldav.xml"/>
  -->

  <target name="init">
    <dirname property="this.dir" file="${ant.file}"/>
    <property name="source.home" location="${this.dir}/src"/>

    <!-- set this for the app builds -->
    <dirname property="app.root.dir" file="${ant.file}"/>
  </target>

  <target name="deploy.init">
    <condition property="org.bedework.deploy.admin.web">
      <equals arg1="true" arg2="${org.bedework.install.admin.web}"/>
    </condition>

    <condition property="org.bedework.deploy.public.web">
      <equals arg1="true" arg2="${org.bedework.install.public.web}"/>
    </condition>

    <condition property="org.bedework.deploy.personal.web">
      <equals arg1="true" arg2="${org.bedework.install.personal.web}"/>
    </condition>

    <condition property="org.bedework.deploy.public.caldav">
      <equals arg1="true" arg2="${org.bedework.install.public.caldav}"/>
    </condition>

    <condition property="org.bedework.deploy.personal.caldav">
      <equals arg1="true" arg2="${org.bedework.install.personal.caldav}"/>
    </condition>

    <!-- We build a  properties file to define properties common to all
         components in a suite. -->
    <property name="org.bedework.deploy.temp.env.properties"
              location="${org.bedework.temp.home}/config/env.properties" />
    <delete file="${org.bedework.deploy.temp.env.properties}" />

    <echo file="${org.bedework.deploy.temp.env.properties}">
org.bedework.env.systemid=${org.bedework.env.systemid}

org.bedework.envclass=${org.bedework.envclass}

org.bedework.userauthclass=${org.bedework.userauthclass}

org.bedework.mailerclass=${org.bedework.mailerclass}

org.bedework.calintfclass=${org.bedework.calintfclass}

org.bedework.update.check.interval=${org.bedework.update.check.interval}

# These are only set for standalone apps using jdbc
org.bedework.jdbcclassname=${org.bedework.jdbcclassname}
org.bedework.jdbcurl=${org.bedework.jdbcurl}
org.bedework.jdbcid=${org.bedework.jdbcid}
org.bedework.jdbcpw=${org.bedework.jdbcpw}

    </echo>
  </target>

  <!-- Build target builds the web configuration tool. -->
  <target name="build" depends="init"
          description="Build bedework web config jar">
    <!-- ==================== Sources and classes ====================== -->

    <fileset id="buildjar.java.sources" dir="${source.home}" >
      <include name="org/bedework/webconfig/**/*.java"/>
    </fileset>

    <patternset id="base.class.patternset">
      <include name="org/bedework/webconfig/**/*.class"/>
    </patternset>
    <!-- ==================== Compilation Classpath ==================== -->

    <path id="compile.classpath">
      <pathelement location="${servlet.jar}"/>
      <pathelement location="${struts.jar}"/>
      <pathelement location="${log4j.jar}"/>

      <pathelement location="${org.bedework.rpiutil.jar}"/>

      <pathelement location="${org.bedework.calfacadeshared.jar}"/>
      <pathelement location="${org.bedework.webcommon.jar}"/>
    </path>

    <!-- ==================== Build Target ============================= -->

    <property name="build.jar.file" location="${org.bedework.config.jar}" />

    <ant antfile="${buildjar}" inheritRefs="true" target="build" />
  </target>

  <!-- Build target builds the runnable configuration tool (not fully developed). -->
  <target name="build.runnable" depends="init"
          description="Build UW calendar config shell script">
    <!-- ==================== Sources and classes ====================== -->

    <fileset id="buildjar.java.sources" dir="${source.home}" >
      <!--
      <include name="edu/rpi/cct/uwcal/config/**/*.java"/>
      -->
      <include name="org/bedework/webconfig/**/*.java"/>
    </fileset>

    <patternset id="base.class.patternset">
      <!--
      <include name="edu/rpi/cct/uwcal/config/**/*.class"/>-->
      <include name="org/bedework/webconfig/**/*.class"/>
    </patternset>
    <!-- ==================== Compilation Classpath ==================== -->

    <path id="compile.classpath">
      <pathelement location="${servlet.jar}"/>
      <pathelement location="${struts.jar}"/>
      <pathelement location="${log4j.jar}"/>

      <pathelement location="${org.bedework.common.jar}"/>
    </path>

    <!-- ================= Extra runtime library jars ================== -->

    <fileset id="org.bedework.run.jars" dir="${org.bedework.empty.dir}" >
    </fileset>

    <fileset id="org.bedework.run.lib.jars" dir="${org.bedework.empty.dir}" >
    </fileset>

    <!-- ==================== Build Target ============================= -->

    <property name="build.jar.file" location="${org.bedework.config.jar}" />

    <ant antfile="${buildjar}" inheritRefs="true" target="build" />

    <!-- ===============================================================
         Build a runnable component and zip it up
         =============================================================== -->

    <property name="app.run.shellscr"
              location="${org.bedework.config.base}/config.sh" />
    <property name="app.run.jar.file" value="${build.jar.file}" />
    <property name="app.run.main.class"
              value="edu.rpi.cct.uwcal.config.optionsApp.OptionsApp" />

    <property name="org.bedework.runsh.log4j.xml"
              location="${org.bedework.config.base}/resources/log4j.xml" />

    <ant antfile="${buildsh}"
         inheritRefs="true" target="build" />
  </target>

  <target name="do.deploy" depends="deploy.init"
          description="Deply Calendar using config shell script">
    <antcall inheritrefs="true" target="deploy.public.caldav" />
  </target>

  <!-- ====================== Deploy public caldav ===================== -->
</project>

