<!--
  == This software is subject to the terms of the Eclipse Public License v1.0
  == Agreement, available at the following URL:
  == http://www.eclipse.org/legal/epl-v10.html.
  == You must accept the terms of that agreement to use this software.
  ==
  == Copyright (C) 2001-2005 Julian Hyde
  == Copyright (C) 2005-2012 Pentaho and others
  == All Rights Reserved.
  -->
<project name="mondrian" default="help" xmlns:ivy="antlib:org.apache.ivy.ant">

  <property environment="env"/>

  <property name="project.location" location="${basedir}"/>
  <property name="lib.location" location="${project.location}/lib"/>
  <property file="${project.location}/build.properties"/>
  <property file="${project.location}/test.properties"/>
  <property file="${project.location}/mondrian.properties"/>
  <property name="project.build.debug" value="on"/>
  <property name="testsrc.dir" value="${basedir}/testsrc/main" />

  <!--
    ===================================================================
    Set the properties related to paths
    ===================================================================
  -->
  <!--
    Set src.dir to an absolute path when building with CruiseControl.
    Otherwise, set it to a relative path.
  -->
  <condition property="src.dir" value="${basedir}/src">
    <isset property="cruisecontrol" />
  </condition>
  <condition property="src.dir" value="src">
    <not>
      <isset property="cruisecontrol" />
    </not>
  </condition>

  <property name="build.dir" value="build"/>
  <property name="bin.dir" value="build"/>
  <property name="testsrc.dir" value="testsrc"/>
  <property name="testsrc.dir.relative" value="testsrc"/>
  <property name="java.dir" value="${src.dir}/main"/>
  <property name="javatest.dir" value="${testsrc.dir}"/>
  <property name="lib.dir" value="lib"/>
  <property name="wb.plugins.dir" value="workbench/plugins"/>
  <property name="doc.dir" value="doc"/>
  <property name="javadoc.dir" value="${doc.dir}/api"/>
  <property name="classes.dir" value="${build.dir}/classes"/>
  <property name="testclasses.dir" value="${build.dir}/testclasses"/>
  <property name="dist.name" value="${name}-${project.revision}"/>
  <property name="dist.base" value="distribution"/>
  <property name="dist.dir" value="dist"/>
  <property name="demo.dir" value="demo"/>
  <property name="dist.src.file" value="${dist.dir}/${dist.name}-src.zip"/>
  <property name="dist.bin.file" value="${dist.dir}/${dist.name}.zip"/>
  <property name="dist.doc.file" value="${dist.dir}/doc.tar.gz"/>
  <property name="jar.file" value="${lib.dir}/${name}.jar"/>
  <property name="workbench.jar.file" value="${lib.dir}/workbench.jar"/>
  <property name="workbench.dist.name" value="workbench-${project.revision}"/>
  <property name="workbench.zip-dist.file" value="${workbench.dist.name}.zip"/>
  <property name="workbench.main.class" value="mondrian.gui.Workbench"/>
  <property name="resource.jar.file" value="${lib.dir}/eigenbase-resgen.jar"/>
  <property name="xom.jar.file" value="${lib.dir}/eigenbase-xom.jar"/>
  <property name="jdk.home" value="${env.JAVA_HOME}"/>

  <tstamp>
    <format property="copyright.year" pattern="yyyy"/>
  </tstamp>

  <!-- Override this to tell Subfloor how to run the junit & jacoco -->
  <property name="junit.test.pattern" value="mondrian/test/Main.java"/>

  <!-- Map some mondrian.* properties to junit.sysprop.*
       so they get passed to the test fork (see subfloor) -->
  <property name="junit.sysprop.mondrian.jdbcDrivers"
      value="${mondrian.jdbcDrivers}"/>
  <property name="junit.sysprop.mondrian.foodmart.jdbcURL"
      value="${mondrian.foodmart.jdbcURL}"/>
  <property name="junit.sysprop.mondrian.foodmart.jdbcUser"
      value="${mondrian.foodmart.jdbcUser}"/>
  <property name="junit.sysprop.mondrian.foodmart.jdbcPassword"
      value="${mondrian.foodmart.jdbcPassword}"/>
  <property name="junit.sysprop.mondrian.test.foodmart.catalogURL"
      value="${mondrian.foodmart.catalogURL}"/>

  <!-- tests require en_US locale -->
  <property name="junit.sysprop.user.language" value="en"/>
  <property name="junit.sysprop.user.region" value="US"/>


  <property name="log4j.configuration" value="log4j.properties" />

  <property name="generated.java.files" value="
${java.dir}/mondrian/olap/Parser.java,
${java.dir}/mondrian/olap/ParserSym.java,
${java.dir}/mondrian/parser/MdxParserImpl.java,
${java.dir}/mondrian/parser/MdxParserImplTokenManager.java,
${java.dir}/mondrian/parser/ParseException.java,
${java.dir}/mondrian/parser/SimpleCharStream.java,
${java.dir}/mondrian/parser/Token.java,
${java.dir}/mondrian/parser/TokenMgrError.java,
${java.dir}/mondrian/olap/MondrianDef.java,
${java.dir}/mondrian/olap/Mondrian3Def.java,
${java.dir}/mondrian/olap/MondrianProperties.java,
${java.dir}/mondrian/gui/MondrianGuiDef.java,
${java.dir}/mondrian/resource/MondrianResource*.java,
${java.dir}/mondrian/xmla/DataSourcesConfig*.java,
${java.dir}/mondrian/server/MondrianServerVersion.java
${etc.dir}/mondrian/web/jsp/**/*.java"/>
  <property name="generated.lib.files" value="
${lib.dir}/mondrian.jar,
${lib.dir}/workbench.jar,
${lib.dir}/mondrian.xml,
${lib.dir}/*.dtd,
VERSION.txt,
${doc.dir}/properties.html,
mondrian.properties.template,
demo/FoodMartCreateData.sql"/>

  <!--
    ===================================================================
    Properties for running the FoodMart test. Override them by
    editing test.properties, mondrian.properties, or plain System
    properties*.
    
    * only for mondrian.* properties from System are passed
    ===================================================================
  -->

  <!-- Comma-separated list of jdbc drivers. Override in test.properties. -->
  <property name="mondrian.jdbcDrivers" value="sun.jdbc.odbc.JdbcOdbcDriver"/>

  <!-- Connect string to the database. Override in test.properties. -->
  <property name="mondrian.foodmart.jdbcURL" value="jdbc:odbc:MondrianFoodMart"/>

  <!-- Classpath for JDBC drivers. Override in your test.properties. -->
  <property name="driver.classpath" value=""/>

  <!-- URL of the catalog definition. -->
  <property name="mondrian.foodmart.catalogURL"
      value="file:${project.location}/${demo.dir}/FoodMart.xml"/>

  <!-- Test class name. -->
  <property name="mondrian.test.Class" value=""/>

  <!-- Test pattern. -->
  <property name="mondrian.test.Name" value=""/>

  <!-- Arguments to the java process spawned by the junit task. -->
  <property name="junit.jvmargs" value="-ea -esa -Xmx1024m"/>
  <property name="junit.maxmemory" value="1024M"/>

  <!--
      ===================================================================
      Now import subfloor. All properties must be overridden first
      =================================================================== -->
  <import file="subfloor.xml" />


  <!-- Define some classpaths -->
  <path id="classpath.custom" description="Adds WB dependencies">
    <pathelement location="${wb.plugins.dir}/kettle-dbdialog.jar"/>
    <pathelement location="${wb.plugins.dir}/kettle-core.jar"/>
    <pathelement location="${wb.plugins.dir}/pentaho-xul-core.jar"/>
    <pathelement location="${wb.plugins.dir}/pentaho-xul-swing.jar"/>
  </path>

  <path id="project.build.classpath" description="The classpath for resgen">
    <pathelement location="${classes.dir}"/>
    <path refid="classpath"/>
  </path>

  <path id="test.classpath.custom" description="Adds the db driver class to the test classpath">
    <pathelement path="${driver.classpath}"/>
  </path>

  <target name="define-tasks" depends="prepare">
    <taskdef name="javacup" classname="java_cup.JavaCUPTask">
      <classpath refid="classpath"/>
    </taskdef>

    <taskdef name="xomgen" classname="org.eigenbase.xom.XOMGenTask">
      <classpath refid="classpath"/>
    </taskdef>

    <taskdef name="resgen" classname="org.eigenbase.resgen.ResourceGenTask">
      <classpath refid="project.build.classpath"/>
    </taskdef>
  </target>

  <target name="help">
    <echo>
      You must specify a specific project target when using the ANT build.
      Targets are one of the following:

      - help
          This is the help.

      - info
          Shows configuration info.

      - binzip
          Compiles Mondrian and wraps everything in a neat little package,
          including documentation.

      - workbench-dist
          Compiles PSW and wraps everything in a neat little package.

      - jar
          Creates a Mondrian jar.

      - workbench
          Creates Mondrian and workbench jars.

      - clean
          Deletes build output.

      - clean-deep
          Clean build output and generated sources.

      - javadoc
          Create the API documentation.

      - test
          Runs the tests. Requires FoodMart to be installed. (see below)

      - jacoco
          Runs the tests with jacoco to measure coverage. Requires FoodMart
          to be installed. (see below)

      -load-foodmart
          Will load the test DB FoodMart using the JDBC parameters specified.
          (see below)

      To run the tests, you must have FoodMart available in a database.
      You can pass the DB configuration through the command line arguments,
      like so:

          ant -Dmondrian.foodmart.jdbcURL="jdbc:mysql://localhost/foodmart" \
              -Dmondrian.foodmart.jdbcUser=foodmart \
              -Dmondrian.foodmart.jdbcPassword=foodmart \
              -Dmondrian.jdbcDrivers=com.mysql.jdbc.Driver \
              -Ddriver.classpath="/opt/mysql-connector-java-5.1.25-bin.jar" 
              test

      Alternatively, these can be written to a file at the root of the project.
      Create a file 'mondrian.properties' containing this:

          mondrian.foodmart.jdbcURL=jdbc:mysql://localhost/foodmart
          mondrian.foodmart.jdbcUser=foodmart
          mondrian.foodmart.jdbcPassword=foodmart
          mondrian.jdbcDrivers=com.mysql.jdbc.Driver
          driver.classpath=/opt/mysql-connector-java-5.1.25-bin.jar

      To load foodmart into your DB, you can call the 'load-foodmart' target
      before 'test'.

      The parameters can be adjusted to point to a different DB than MySQL.
    </echo>
  </target>

  <target name="info">
  <echo>==============================================================</echo>
  <echo>| Mondrian configuration info                                |</echo>
  <echo>==============================================================</echo>
  <echo>project.location             = ${project.location}</echo>
  <echo>jdk.home                     = ${env.JAVA_HOME}</echo>
  <echo>log4j.configuration          = ${log4j.configuration}</echo>
  <echo>mondrian.foodmart.catalogURL = ${mondrian.foodmart.catalogURL}</echo>
  <echo>mondrian.foodmart.jdbcURL    = ${mondrian.foodmart.jdbcURL}</echo>
  <echo>mondrian.jdbcDrivers         = ${mondrian.jdbcDrivers}</echo>
  <echo>driver.classpath (additions) = ${driver.classpath}</echo>
  <echo>==============================================================</echo>
  </target>

  <target name="clean" depends="subfloor.clean">
    <delete includeEmptyDirs="true" quiet="true">
      <fileset dir="${lib.dir}" includes="*" excludes="mondrian.xsd,xml-apis.jar"/>
      <fileset dir="${classes.dir}" includes="**/*.class,**/*.properties"/>
      <fileset dir="${testclasses.dir}" includes="**/*.class,**/*.properties"/>
      <fileset dir="." includes="${generated.java.files},${generated.lib.files},VERSION.txt"/>
      <fileset dir="demo/derby/foodmart"/>
      <fileset dir="${javadoc.dir}" />
      <fileset dir="${testsrc.dir}" includes="**/*.log.xml"/>
      <fileset dir="${testsrc.dir}" includes="**/*JUnit.java"/>
      <fileset dir="${wb.plugins.dir}" includes="*.jar"/>
    </delete>
  </target>

  <target name="clean-deep">
    <delete includeEmptyDirs="true" quiet="true">
      <fileset dir="${lib.dir}" includes="*.jar,*.war" excludes="xml-apis.jar"/>
      <fileset dir="${classes.dir}"/>
      <fileset dir="${testclasses.dir}"/>
      <fileset dir="${dist.dir}"/>
    </delete>
    <antcall target="clean"/>
  </target>

  <target name="prepare" depends="install-ivy,resolve">
    <mkdir dir="${classes.dir}"/>
    <mkdir dir="${testclasses.dir}"/>
    <mkdir dir="${devlib.dir}"/>
    <mkdir dir="${testlib.dir}"/>
    <mkdir dir="${dist.dir}"/>
    <mkdir dir="${bin.dir}"/>
  </target>

  <target name="resolve" unless="skip.download" >
      <!-- Use symbolic links, rather than copying, on unix. -->
      <condition property="symlink" value="true">
          <os family="unix"/>
      </condition>
      <echo message="symlink=${symlink}"/>

      <!-- Mondrian dependencies. -->
      <ivy:resolve file="ivy.xml"/>
      <ivy:retrieve symlink="${symlink}" type="jar,war"
          pattern="${lib.dir}/[module].[ext]"/>
      <ivy:retrieve symlink="${symlink}" type="source,javadoc"
          pattern="${lib.dir}/[module]-[type].[ext]"/>
  </target>

  <target name="resolve-for-workbench" depends="prepare" unless="skip.download">
      <!-- Use symbolic links, rather than copying, on unix. -->
      <condition property="symlink" value="true">
          <os family="unix"/>
      </condition>
      <echo message="symlink=${symlink}"/>

      <!-- Workbench dependencies to workbench/plugins -->
      <ivy:resolve file="workbench/ivy.xml"/>
      <ivy:retrieve symlink="${symlink}" type="jar"
          pattern="${wb.plugins.dir}/[module].[ext]"/>
      <ivy:retrieve symlink="${symlink}" type="source,javadoc"
          pattern="${wb.plugins.dir}/[module]-[type].[ext]"/>
  </target>

  <target name="resolve-workbench-runtime-deps" depends="prepare" 
          unless="skip.download"
          description="Resolves runtime dependencies not required for compilation.">
    <ivy:resolve file="workbench/assembly_ivy.xml"/>
    <ivy:retrieve symlink="${symlink}"
                  pattern="${wb.plugins.dir}/[module].[ext]"/>
    <ivy:retrieve symlink="${symlink}" type="source,javadoc"
                  pattern="${wb.plugins.dir}/[module]-[type].[ext]"/>
  </target>


  <target name="cmdrunner" depends="jar">
    <property name="crtmp.dir" location="${build.dir}/tmpcmdrunner"/>
    <mkdir dir="${crtmp.dir}"/>

    <unjar src="${lib.dir}/commons-dbcp.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/commons-collections.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/commons-logging.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/commons-pool.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/commons-vfs2.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/eigenbase-properties.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/eigenbase-resgen.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/eigenbase-xom.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/javacup.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/log4j.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/mondrian.jar" dest="${crtmp.dir}"/>
    <unjar src="${lib.dir}/servlet-api.jar" dest="${crtmp.dir}"/>

    <unjar dest="${crtmp.dir}">
        <fileset dir="${lib.dir}">
            <include name="**/*.jar"/>
            <exclude name="**/junit.zip"/>
        </fileset>
    </unjar>

    <copy file="./log4j.properties" todir="${crtmp.dir}"/>

    <jar destfile="${lib.dir}/cmdrunner.jar" >
      <fileset dir="${crtmp.dir}" >
        <include name="**/*.xml"/>
        <include name="**/*.class"/>
        <include name="**/*.properties"/>
      </fileset>

      <manifest>
        <attribute name="Main-Class" value="mondrian.tui.CmdRunner"/>
        <attribute name="Built-By" value="${user.name}"/>
      </manifest>
    </jar>

    <delete dir="${crtmp.dir}" quiet="true"/>
  </target>

  <target name="cmdrunner-run" depends="jar">
    <java fork="yes" classpathref="test.classpath" classname="mondrian.tui.CmdRunner">
        <sysproperty key="log4j.configuration" value="${log4j.configuration}"/>
        <!-- <arg value="-d"/> -->
    </java>
  </target>

  <target name="compile.pre" depends="
version,
prepare,
parser,
generate.resources,
generate.properties,
def,
subfloor.compile.pre"/>

  <target name="compile" depends="init, compile.pre, compile.java, compile.post">
    <!-- TODO This needs to be cleaned up. Mondrian entirely bypasses the
    compile target of subfloor. It shouldn't need to, but that's for
    another day. -->
  </target>

  <target name="generate.resources" depends="define-tasks">

    <!-- Compile MondrianException first, so that resgen can use
         reflection on it. -->
    <javac
        srcdir="${java.dir}"
        destdir="${classes.dir}"
        debug="${project.build.debug}"
        classpathref="project.build.classpath"
        includeantruntime="false"
        source="${javac.source}"
        target="${javac.target}">
      <include name="mondrian/olap/MondrianException.java" />
      <include name="mondrian/olap/ResultLimitExceededException.java" />
      <include name="mondrian/olap/InvalidHierarchyException.java" />
      <include name="mondrian/olap/ResourceLimitExceededException.java" />
      <include name="mondrian/olap/NativeEvaluationUnsupportedException.java" />
      <include name="mondrian/olap/QueryCanceledException.java" />
      <include name="mondrian/olap/QueryTimeoutException.java" />
    </javac>

    <resgen
        srcdir="${java.dir}"
        resdir="${classes.dir}"
        style="functor"
        locales="en_US,de_DE,de,es_ES">
      <include name="mondrian/resource/MondrianResource.xml"/>
    </resgen>

  </target>

  <target name="generate.properties">
    <!-- Generate MondrianProperties.java,
         mondrian.properties.template, property.html. -->
    <javac
        srcdir="${java.dir}"
        destdir="${classes.dir}"
        debug="${project.build.debug}"
        classpathref="project.build.classpath"
        includeantruntime="false"
        source="${javac.source}"
        target="${javac.target}">
      <include name="mondrian/util/PropertyUtil.java" />
    </javac>

    <java classpathref="project.build.classpath"
        classname="mondrian.util.PropertyUtil"
        fork="no"/>
  </target>

  <!--target name="apologise" unless="java.version.matches.requested">
    <echo>Actual JVM Version (${java.runtime.version}) does not match
requested (${requested.java.version}); skipping compile for this JDK.
If you wish to build for this JDK, modify ${unix.script}.
    </echo>
  </target-->

  <target name="compile.java">
    <echo>Compiling on JVM Version: ${java.runtime.version}</echo>
    <condition property="include.gui">
      <isset property="include.workbench" />
    </condition>
    <echo>include.gui=${include.gui}</echo>

    <javac
        srcdir="${java.dir}"
        destdir="${classes.dir}"
        debug="${project.build.debug}"
        classpathref="project.build.classpath"
        source="${javac.source}"
        target="${javac.target}"
        includeantruntime="false">
      <include name="mondrian/**/*.java"/>
      <exclude name="mondrian/gui/**/*.java"                 unless="include.gui" /> 
    </javac>
    <copy file="src/main/mondrian/rolap/aggmatcher/DefaultRules.xml"
        todir="${classes.dir}"/>
    <copy file="VERSION.txt"
            todir="${classes.dir}"/>
    <copy file="src/main/mondrian/rolap/aggmatcher/DefaultRulesSchema.xml"
        todir="${classes.dir}"/>
    <copy todir="${classes.dir}">
      <fileset
          dir="${java.dir}"
          includes="
META-INF/**"/>
    </copy>
  </target>

  <target name="parser" depends="define-tasks">
    <!-- Old parser. -->
    <javacup
        srcdir="${java.dir}"
        input="${java.dir}/mondrian/olap/Parser.cup"
        expect="63"
        interface="true"/>
    <!-- New parser. -->
    <javacc
        target="${java.dir}/mondrian/parser/MdxParser.jj"
        javacchome="${lib.dir}"/>
  </target>

  <target name="def" depends="define-tasks">
    <xomgen
        model="${java.dir}/mondrian/olap/Mondrian.xml"
        destdir="${java.dir}"
        classname="mondrian.olap.MondrianDef"
        dtdname="mondrian.dtd"/>
    <copy file="${java.dir}/mondrian/olap/mondrian.dtd"
        todir="${lib.dir}"/>

    <!-- Workbench needs a different model. See Mondrian_SW.xml for details. -->
    <xomgen
        model="${java.dir}/mondrian/olap/Mondrian_SW.xml"
        destdir="${java.dir}"
        classname="mondrian.gui.MondrianGuiDef"
        dtdname="mondrian_SW.dtd"
        />

    <xomgen
        model="${java.dir}/mondrian/rolap/aggmatcher/DefaultRulesSchema.xml"
        destdir="${java.dir}"
        classname="mondrian.rolap.aggmatcher.DefaultDef"
        dtdname="aggregates.dtd"/>
    <copy file="${java.dir}/mondrian/rolap/aggmatcher/aggregates.dtd"
        todir="${lib.dir}"/>

    <xomgen
        model="${java.dir}/mondrian/xmla/DataSourcesConfig.xml"
        destdir="${java.dir}"
        classname="mondrian.xmla.DataSourcesConfig"
        dtdname="datasourcesconfig.dtd"/>
    <copy file="${java.dir}/mondrian/xmla/datasourcesconfig.dtd"
        todir="${lib.dir}"/>
  </target>

  <!-- Before you run it, you will need to set the
       "mondrian.jdbcDrivers", "mondrian.foodmart.jdbcURL", and
       "mondrian.foodmart.catalogURL" properties. The easiest way to
       do this is to edit the file "test.properties". -->

  <target name="set.connectString">
    <!-- Ensure that the JdbcUser parameter is only added to the connect string
         if the mondrian.foodmart.jdbcUser property is set. Likewise
         JdbcPassword. -->
    <condition property="jdbcUser"
        value=";JdbcUser='${mondrian.foodmart.jdbcUser}'">
      <isset property="mondrian.foodmart.jdbcUser"/>
    </condition>
    <condition property="jdbcUser" value="">
      <not>
        <isset property="mondrian.foodmart.jdbcUser"/>
      </not>
    </condition>
    <condition property="jdbcPassword"
        value=";JdbcPassword='${mondrian.foodmart.jdbcPassword}'">
      <isset property="mondrian.foodmart.jdbcPassword"/>
    </condition>
    <condition property="jdbcPassword" value="">
      <not>
        <isset property="mondrian.foodmart.jdbcPassword"/>
      </not>
    </condition>

    <property name="mondrian.test.connectString"
        value="Provider=mondrian;Jdbc='${mondrian.foodmart.jdbcURL}'${jdbcUser}${jdbcPassword};Catalog='${mondrian.foodmart.catalogURL}'"/>

    <!-- Make sure it is added by subfloor when running tests -->
    <property name="junit.sysprop.mondrian.test.connectString"
      value="${mondrian.test.connectString}" />
  </target>

  <target name="test" depends="info,subfloor.test">
    <!-- Add 'info' before 'test' -->
  </target>
  
  <target name="jacoco" depends="info,subfloor.jacoco">
    <!-- Add 'info' before 'jacoco' -->
  </target>

  <target name="compile-tests" depends="subfloor.compile-tests,set.connectString">
  </target>

  <condition property="tests.skip" value="true">
    <isset property="mondrian.tests.skip"/>
  </condition>

  <target name="test-list">
    <property name="test.args" value="-l"/>
    <antcall target="test-only"/>
  </target>

  <target name="junit-main" depends="" unless="tests.skip">
    <echo>The target 'junit-main' was replaced by 'test'.
      Please call this one instead.</echo>
    <antcall target="test"/>
  </target>

  <target name="version">
    <echo file="VERSION.txt">Title: ${name}
Version: ${project.revision}
VersionMajor: ${project.revision.major}
VersionMinor: ${project.revision.minor}
Vendor: ${vendor}
</echo>
   <echo file="${java.dir}/mondrian/olap4j/MondrianOlap4jDriverVersion.java">/*
 * Project version information. Generated - do not modify.
 */
package mondrian.olap4j;
/**
 * Version information for the Mondrian olap4j driver. (Generated.)
 */
class MondrianOlap4jDriverVersion {
    static final String NAME = "${driver.name}";
    static final String VERSION = "${driver.version}";
    static final int MAJOR_VERSION = ${driver.version.major};
    static final int MINOR_VERSION = ${driver.version.minor};
}

// End MondrianOlap4jDriverVersion.java</echo>
       <echo file="${java.dir}/mondrian/server/MondrianServerVersion.java">/*
 * Project version information. Generated - do not modify.
 */
package mondrian.server;
/**
 * Version information for Mondrian. (Generated by build)
 */
class MondrianServerVersion {
    static final String VENDOR = "${vendor}";
    static final String NAME = "${name}";
    static final String VERSION = "${project.revision}";
    static final int MAJOR_VERSION = ${project.revision.major};
    static final int MINOR_VERSION = ${project.revision.minor};
    static final String COPYRIGHT_YEAR = "${copyright.year}";
}
// End MondrianServerVersion.java</echo>
  </target>

  <target name="srczip" depends="version">
    <mkdir dir="${dist.dir}" />
    <delete file="${dist.src.file}"/>
    <zip
        zipfile="${dist.src.file}"
        update="true">
      <zipfileset
          dir="."
          prefix="${dist.name}"
          includes="
${java.dir}/**/*.properties,
${java.dir}/META-INF/**,
${java.dir}/mondrian/resource/MondrianResource.xml,
${java.dir}/mondrian/olap/Mondrian.xml,
${java.dir}/mondrian/olap/Mondrian_SW.xml,
${java.dir}/mondrian/olap/MondrianProperties.xml,
${java.dir}/mondrian/rolap/aggmatcher/DefaultRules.xml,
${java.dir}/mondrian/rolap/aggmatcher/DefaultRulesSchema.xml,
${java.dir}/mondrian/xmla/DataSourcesConfig.xml,
${java.dir}/**/*.java,
${java.dir}/**/*.cup,
${java.dir}/**/*.jj,
${java.dir}/**/*.gif,
${java.dir}/**/*.png,
${java.dir}/**/*.html,
${lib.dir}/mondrian.xsd,
${testsrc.dir.relative}/queryFiles/**/*.xml,
${testsrc.dir.relative}/**/*.csv,
${testsrc.dir.relative}/**/*.error,
${testsrc.dir.relative}/**/*.java,
${testsrc.dir.relative}/**/*.xml,
${testsrc.dir.relative}/**/*.html,
${testsrc.dir.relative}/**/*.txt,
${testsrc.dir.relative}/**/*.sql,
${webapp.dir}/WEB-INF/*.xml,
${webapp.dir}/**/*.jsp,
${webapp.dir}/WEB-INF/*.xsl,
${webapp.dir}/WEB-INF/*.tld,
${doc.dir}/**/*.css,
${doc.dir}/**/*.gif,
${doc.dir}/**/*.png,
${doc.dir}/**/*.jpeg,
${doc.dir}/**/*.html,
bin/checkFile.awk,
bin/checkFile.sh,
bin/cmdrunner.sh,
bin/cmdrunner.cmd,
bin/run.sh,
misc/**/*.mf,
misc/Meta.xsl,
workbench/drivers/readme.txt,
workbench/plugins/readme.txt,
workbench/cpappend.bat,
workbench/ivy.xml,
workbench/log4j.xml,
workbench/mondrian.properties,
workbench/readme.txt,
workbench/workbench.bat,
workbench/workbench.sh,
workbench/workbench.command,
build.xml,
build.bat,
build.sh,
build.properties,
ivy.xml,
ivysettings.xml,
log4j.properties,
LICENSE.html,
README.txt,
subfloor.xml,
VERSION.txt,
${demo.dir}/FoodMart.xml"
          excludes="
${javadoc.dir}/**,
**/_vti*/*,
**/*~,
**/junit-results/**,
${generated.java.files},
doc/deployDoc.sh" />
      <zipfileset
          dir="."
          includes="mondrian.properties.template"
          fullpath="${dist.name}/mondrian.properties" />
      <zipfileset
          dir="."
          prefix="${dist.name}"
          filemode="755"
          includes="
buildOnJdk.bat,
buildOnJdk.sh" />
    </zip>
  </target>

  <target name="load-foodmart"
        depends="info,compile,compile-tests"
        description="load the foodmart database from the data file using the Mondrian loader. Assumes empty database exists">

    <available classname="${mondrian.jdbcDrivers}"
           classpathref="test.classpath" property="driver.present.for.load-foodmart"/>

    <echo message="Driver present: ${driver.present.for.load-foodmart}"/>
    <!--
        Load from demo/FoodMartCreateData.zip directly - no need to unzip
        
        Otherwise override, like
                <arg value="-inputFile=demo/myData.sql"/>
                <arg value="-inputFile=demo/myData.zip"/> - will access this without unzipping

        You can override the JDBC batch size by setting the same
        property in your mondrian.properties.  Current using the
        default of 50 SQL statements per batch.
    -->

    <property name="mondrian.foodmart.loaderBatchSize" value="50" />
    <property name="mondrian.foodmart.jdbcSchema" value="" />

    <java classname="mondrian.test.loader.MondrianFoodMartLoader"
            classpathref="test.classpath"
            fork="yes">
        <!--<jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787" />-->
        <arg value="-tables"/>
        <arg value="-data"/>
        <arg value="-indexes"/>
        <arg value="-jdbcDrivers=${mondrian.jdbcDrivers}"/>
        <arg value="-outputJdbcURL=${mondrian.foodmart.jdbcURL}"/>
        <arg value="-outputJdbcUser=${mondrian.foodmart.jdbcUser}"/>
        <arg value="-outputJdbcPassword=${mondrian.foodmart.jdbcPassword}"/>
        <arg value="-outputJdbcSchema=${mondrian.foodmart.jdbcSchema}"/>
        <arg value="-outputJdbcBatchSize=${mondrian.foodmart.loaderBatchSize}"/>
    </java>
     
  </target>

  <target name="binzip"
      depends="clean-deep,srczip,jar,javadoc,xml_schema">
    <mkdir dir="${dist.dir}" />
    <delete file="${dist.bin.file}"/>
    <zip zipfile="${dist.bin.file}">
      <zipfileset
          dir="."
          prefix="${dist.name}"
          includes="
${doc.dir}/**/*.jpg,
${doc.dir}/**/*.html,
${doc.dir}/**/*.css,
${doc.dir}/**/*.png,
${doc.dir}/api/**/*.xml,
lib/*.dtd,
demo/FoodMart.xml,
demo/FoodMartCreateData.zip,
LICENSE.html,
README.txt,
VERSION.txt"
          excludes="
**/*~,
**/_vti*/*,
**/*.psp,
${doc.dir}/api/src-html/**/*"/>
      <zipfileset
          dir="${dist.dir}"
          prefix="${dist.name}"
          includes="${dist.name}.jar"/>
      <zipfileset
          dir="${dist.dir}"
          prefix="${dist.name}"
          includes="${dist.name}-src.zip"/>
    </zip>
  </target>

  <target name="doczip"
      depends="javadoc-with-ydoc, xml_schema"
      description="Builds a zipfile of the documentation, which can then be
                   deployed to sf.net. See also doc/deployDoc.sh.">
    <mkdir dir="${dist.dir}" />
    <tar
        destfile="${dist.doc.file}"
        compression="gzip">
      <tarfileset
          dir="."
          includes="
doc/api/**/*,
doc/**/*.html,
doc/**/*.gif,
doc/**/*.jpg,
doc/**/*.png,
doc/**/*.css,
doc/**/*.xml"
          excludes="
**/*~,
**/_vti*/*,
**/*.psp,
**/*.sh"/>
    </tar>
  </target>

  <target name="jar" depends="version,compile">
    <mkdir dir="${lib.dir}" />
    <jar
        destfile="${jar.file}"
        update="true">
      <zipfileset
          dir="${classes.dir}"
          includes="
**/*.class,
**/*.properties,
**/*.xml,
META-INF/**"
          excludes="mondrian/gui/**/*.*"/>
      <zipfileset
          dir="${testclasses.dir}"
          includes="
mondrian/test/loader/**/*.class,
mondrian/olap4j/MondrianInprocProxy*.class,
mondrian/test/AbstractMondrianOlap4jTester.class,
mondrian/test/MondrianOlap4jTester.class"/>
      <zipfileset
          dir="${javatest.dir}"
          includes="
mondrian/test/loader/insert.sql"/>
      <zipfileset
          dir="."
          includes="
LICENSE.html,
README.txt,
VERSION.txt"/>
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <section name="mondrian/olap/">
          <attribute name="Implementation-Title" value="${name}"/>
          <attribute name="Implementation-Version" value="${project.revision}"/>
          <attribute name="Implementation-Vendor" value="${vendor}"/>
        </section>
        <section name="mondrian/server/">
          <attribute name="Implementation-Title" value="${name}"/>
          <attribute name="Implementation-Version" value="${project.revision}"/>
          <attribute name="Implementation-Vendor" value="${vendor}"/>
        </section>
      </manifest>
    </jar>
    <copy file="${jar.file}"
        tofile="${dist.dir}/${ivy.artifact.id}-${project.revision}.jar"/>
  </target>

  <target name="xml_schema"
      description="Generates xml_schema.html from Mondrian.xml">
    <xslt in="src/main/mondrian/olap/Mondrian.xml"
        out="doc/xml_schema.html"
        style="misc/Meta.xsl"/>
  </target>

  <target name="javadoc-strict" description="
Generates javadoc as part of the nightly regress,
to make sure that all javadoc references are valid.

Javadoc is known to produce errors against JDK 1.4 and 1.5; it runs
clean against JDK 1.6.">
    <antcall target="javadoc-internal">
      <param name="additionalparam" value=""/>
      <param name="access" value="private"/>
    </antcall>
  </target>

  <target name="javadoc" description="Generates javadoc for release">
    <antcall target="javadoc-internal">
      <param name="additionalparam" value=""/>
      <param name="access" value="package"/>
    </antcall>
  </target>

  <target name="javadoc-internal">
    <mkdir dir="${javadoc.dir}" />
    <delete quiet="true" file="${javadoc.dir}/index.html"/>
    <!-- remove stray package.html files under classes to avoid 'multiple
         sources of package comments' errors -->
    <delete includeEmptyDirs="false" quiet="true">
      <fileset dir="${classes.dir}" includes="**/package.html"/>
      <fileset dir="${testclasses.dir}" includes="**/package.html"/>
    </delete>
    <property name="ps" value="${path.separator}"/>
    <javadoc
        sourcepath="${java.dir}${ps}${javatest.dir}"
        maxmemory="1024m"
        classpathref="test.classpath"
        destdir="${javadoc.dir}"
        packagenames="mondrian.*"
        overview="${java.dir}/overview.html"
        footer="&lt;a href=&quot;http://sourceforge.net/projects/mondrian&quot;&gt;&lt;img src=&quot;http://sflogo.sourceforge.net/sflogo.php?group_id=35302&#38;type=15&quot; width=&quot;150&quot; height=&quot;40&quot; border=&quot;0&quot; alt=&apos;Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads&apos;&gt;&lt;/a&gt;"
        author="true"
        source="${javac.source}"
        access="${access}"
        Windowtitle="Mondrian OLAP Engine, version ${project.revision}"
        additionalparam="${additionalparam}"
      >
      <tag name="pre" description="Pre-condition:"
           scope="constructors,methods"/>
      <tag name="post" description="Post-condition:"
           scope="constructors,methods"/>
      <tag name="testcase" description="Test-case:"
           scope="constructors,methods,types"/>
      <link href="http://java.sun.com/javase/7/docs/api/"/>
      <link href="http://www.olap4j.org/api/"/>
      <link href="http://junit.sourceforge.net/javadoc"/>
      <link href="http://java.sun.com/products/servlet/2.2/javadoc/"/>
      <link href="http://eigenbase.sourceforge.net/resgen/api/"/>
      <link href="http://farrago.sourceforge.net/api/"/>
    </javadoc>
    <copy file="${java.dir}/mondrian/olap/Mondrian.xml"
        todir="${javadoc.dir}/mondrian/olap"/>
  </target>

  <!-- Generate javadoc with embedded UML diagrams using the yDoc doclet from
       yWorks.com. Set ydoc.home in build.properties, then replace
       ${ydoc.home}/resources/ydoc.license with a full license (free for open
       source use). -->
  <target name="javadoc-with-ydoc"
      description="Generates javadoc for public site; verbose: includes
diagrams and hyperlinks to source code">
    <mkdir dir="${javadoc.dir}" />
    <delete quiet="true" file="${javadoc.dir}/index.html"/>
    <!-- remove stray package.html files under classes to avoid 'multiple
         sources of package comments' errors -->
    <delete includeEmptyDirs="false" quiet="true">
      <fileset dir="${classes.dir}" includes="**/package.html"/>
      <fileset dir="${testclasses.dir}" includes="**/package.html"/>
    </delete>
    <property name="ps" value="${path.separator}"/>
    <javadoc
        sourcepath="${java.dir}"
        maxmemory="1024m"
        classpathref="test.classpath"
        destdir="${javadoc.dir}"
        packagenames="mondrian.*"
        overview="${java.dir}/overview.html"
        footer="&lt;a href=&quot;http://sourceforge.net/projects/mondrian&quot;&gt;&lt;img src=&quot;http://sflogo.sourceforge.net/sflogo.php?group_id=35302&#38;type=15&quot; width=&quot;150&quot; height=&quot;40&quot; border=&quot;0&quot; alt=&apos;Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads&apos;&gt;&lt;/a&gt;"
        author="true"
        source="${javac.source}"
        access="package"
        Windowtitle="Mondrian OLAP Engine, version ${project.revision}"
        additionalparam="-linksource"
      >
      <tag name="pre" description="Pre-condition:"
           scope="constructors,methods"/>
      <tag name="post" description="Post-condition:"
           scope="constructors,methods"/>
      <tag name="testcase" description="Test-case:"
           scope="constructors,methods,types"/>
      <link href="http://java.sun.com/javase/7/docs/api/"/>
      <link href="http://www.olap4j.org/api/"/>
      <link href="http://junit.sourceforge.net/javadoc"/>
      <link href="http://java.sun.com/products/servlet/2.2/javadoc/"/>
      <link href="http://eigenbase.sourceforge.net/resgen/api/"/>
      <link href="http://farrago.sourceforge.net/api/"/>
      <doclet
          name="ydoc.doclets.YStandard"
          path="${ydoc.home}/lib/ydoc.jar${ps}${ydoc.home}/lib/class2svg.jar${ps}${ydoc.home}/resources${ps}${ydoc.home}/doc">
        <param name="-author"/>
        <param name="-generic"/>
        <param name="-umlautogen"/>
        <param name="-tag" value="y.precondition"/>
        <param name="-tag" value="y.postcondition"/>
        <param name="-tag" value="y.complexity"/>
        <param name="-tag" value="param"/>
        <param name="-tag" value="return"/>
        <param name="-tag" value="see"/>
        <param name="-tag" value="y.uml"/>
      </doclet>
    </javadoc>
    <copy file="${java.dir}/mondrian/olap/Mondrian.xml"
        todir="${javadoc.dir}/mondrian/olap"/>
  </target>

  <!-- Ensure that javadoc has no warnings/errors. -->
  <target name="checkJavadoc">
    <record name="javadoc-complaints.log" action="start"
      emacsmode="true" loglevel="warn"/>
    <antcall target="javadoc-strict"/>
    <record name="javadoc-complaints.log" action="stop"/>
    <loadfile srcFile="javadoc-complaints.log" property="javadoc.complaints">
      <filterchain>
        <!-- only interested in lines that are errors or warnings -->
        <linecontainsregexp>
            <regexp pattern=":[0-9]+: "/>
        </linecontainsregexp>
        <striplinebreaks />
      </filterchain>
    </loadfile>
    <fail if="javadoc.complaints"
        message="Javadoc reported warnings or errors; see javadoc-complaints.log for details: ${javadoc.complaints}"/>
    <delete file="javadoc-complaints.log"/>
    <!-- Save disk space since we're just checking. -->
    <antcall target="cleanJavadoc"/>
  </target>

  <target name="cleanJavadoc">
    <delete includeEmptyDirs="true" quiet="true">
      <fileset dir="${javadoc.dir}" includes="**/*"/>
    </delete>
  </target>

  <target name="checkCodeFormatting">
    <!-- Only runs on unix currently, because it's a shell script.
         On Windows/cygwin, you can run bin/checkFile.sh manually. -->
    <exec osfamily="unix" executable="${basedir}/bin/checkFile.sh" failonerror="true">
        <arg line="--under ."/>
    </exec>
  </target>

  <target name="compile-with-workbench">
    <echo message="setting include.workbench to true" />
    <antcall target="compile">
      <param name="include.workbench" value="true" />
    </antcall>    
  </target>

  <target name="workbench" depends="resolve-for-workbench,compile-with-workbench,jar"> 
    <jar jarfile="${workbench.jar.file}" update="true">
      <fileset
          dir="${classes.dir}"
          includes="mondrian/gui/**/*.class"/>
      <fileset
          dir="${java.dir}"
          includes="mondrian/gui/**/*.gif,mondrian/gui/**/*.png,mondrian/gui/**/*.properties,mondrian/gui/**/*.html"/>
      <manifest>
          <attribute name="Main-Class" value="${workbench.main.class}"/>
      </manifest>
    </jar>
    <copy todir="${classes.dir}">
      <fileset
          dir="${java.dir}"
          includes="mondrian/gui/**/*.gif,mondrian/gui/**/*.png,mondrian/gui/**/*.properties,mondrian/gui/**/*.html"/>
    </copy>
  </target>

  <path id="workbench.run.classpath">
    <pathelement path="${workbench.jar.file}"/>
    <path refid="test.classpath"/>
    <pathelement path="lib/jlfgr.jar"/>
  </path>

  <target name="workbench-run" >

    <available classname="${mondrian.jdbcDrivers}"
           classpathref="workbench.run.classpath" property="driver.present.for.workbench"/>

    <available classname="${workbench.main.class}"
           classpathref="workbench.run.classpath" property="workbench.main.present"/>

    <!-- check if mondrian.jar and workbench jar file exists -->
    <available file="${jar.file}" property="mondrian.jar.exists"/>
    <available file="${workbench.jar.file}" property="workbench.jar.exists"/>

    <java  classpathref="workbench.run.classpath"  classname="${workbench.main.class}"  fork="yes">
        <sysproperty key="log4j.configuration" value="${log4j.configuration}"/>
    </java>
  </target>

    
  <target name="resolve-oss-licenses" depends="install-ivy">
    <ivy:resolve file="${ivyfile}" conf="oss-licenses" />
    <ivy:retrieve conf="oss-licenses" pattern="${bin.dir}/[module].[ext]" />
  </target>

  <target name="workbench-dist" 
      depends="resolve-workbench-runtime-deps,resolve-oss-licenses,version,workbench">
    <mkdir dir="${dist.dir}" />
    <delete file="${dist.dir}/${workbench.zip-dist.file}"/>
    <zip destfile="${dist.dir}/${workbench.zip-dist.file}">
        <zipfileset dir="." prefix="${workbench.dist.name}" filemode="755" includes="*.sh"/>
        <zipfileset dir="."  prefix="${workbench.dist.name}" includes="
                ${doc.dir}/**/*.pdf,
                lib/mondrian.jar,
                lib/workbench.jar,
                lib/log4j.jar,
                lib/x*.jar,
                lib/eigenbase*.jar,
                lib/commons*.jar,
                lib/javacup.jar,
                lib/jlfgr.jar,
                lib/olap4j.jar,
                lib/pentaho-application-launcher.jar,
                lib/*.dtd,
                lib/*.xsd,
                demo/FoodMart.xml,
                LICENSE.html"
                  excludes="
                **/*~,
                **/_vti*/*,
                **/*.psp,
                **/*.sh,
                **/**JavaApplicationStub,
                ${doc.dir}/api/src-html/**/*"/>
        <zipfileset filemode="755"
          dir="workbench"
          prefix="${workbench.dist.name}">
            <include name="**/*.sh" />
              <include name="**/*.command"/>
            <include name="**/**JavaApplicationStub" />
           </zipfileset>
        <zipfileset
          dir="workbench"
          prefix="${workbench.dist.name}">
            <include name="**/*"/>
            <exclude name="**/assembly_ivy.xml"/>
            <exclude name="**/*.sh"/>
            <exclude name="**/*.command"/>
            <exclude name="**/plugins/*-source.jar"/>
            <exclude name="**/plugins/*-javadoc.jar"/>
            <exclude name="**/plugins/junit.jar"/>
            <exclude name="**/**JavaApplicationStub" />
        </zipfileset>
        <zipfileset src="${bin.dir}/oss-licenses.zip" prefix="${workbench.dist.name}" includes="PentahoSchemaWorkbench_OSS_Licenses.html"/>
    </zip>
  </target>

  <!--=======================================================================
         publish-workbench-jar
              
         Deploys the workbench jar to a maven repository
      ====================================================================-->

  <target name="publish-workbench-jar" depends="install-antcontrib, workbench">
    <antcall target="maven-publish-jar">
      <param name="publish.groupId" value="${ivy.artifact.group}" />
      <param name="publish.version" value="${project.revision}" />
      <param name="publish.artifactId" value="workbench" />
      <param name="publish.file" value="${workbench.jar.file}" />
      <param name="publish.packaging" value="jar" />
      <param name="publish.generatePom" value="${publish.generatePom}" />
    </antcall>
  </target>

  <!--=======================================================================
          maven-publish-artifact
          
          A generic function that deploys an artifact to a maven repository
      ====================================================================-->
  <target name="maven-publish-jar">
    <sequential>
      <fail message="No file found at: ${publish.file}">
        <condition>
          <not>
            <available file="${publish.file}" />
          </not>
        </condition>
      </fail>
      <echo message="Publishing ${publish.file} to ${ivy.repository.publish}..." />
      <if>
        <isset property="isWindows" />
        <then>
          <exec executable="cmd" failonerror="true">
            <arg value="/c" />
            <arg value="mvn.bat" />
            <arg value="deploy:deploy-file" />
            <arg value="-DrepositoryId=${ivy.repository.id}" />
            <arg value="-Durl=${ivy.repository.publish}" />
            <arg value="-DgroupId=${publish.groupId}" />
            <arg value="-DartifactId=${publish.artifactId}" />
            <arg value="-Dversion=${publish.version}" />
            <arg value="-Dfile=${publish.file}" />
            <arg value="-Dpackaging=${publish.packaging}" />
            <arg value="-DgeneratePom=${publish.generatePom}" />
          </exec>
        </then>
        <else>
          <exec executable="mvn" failonerror="true">
            <arg value="deploy:deploy-file" />
            <arg value="-DrepositoryId=${ivy.repository.id}" />
            <arg value="-Durl=${ivy.repository.publish}" />
            <arg value="-DgroupId=${publish.groupId}" />
            <arg value="-DartifactId=${publish.artifactId}" />
            <arg value="-Dversion=${publish.version}" />
            <arg value="-Dfile=${publish.file}" />
            <arg value="-Dpackaging=${publish.packaging}" />
            <arg value="-DgeneratePom=${publish.generatePom}" />
          </exec>
        </else>
      </if>
    </sequential>
  </target>

  <target name="ivy-report">
    <antcall target="subfloor.ivy-report"/>
    <ivy:resolve file="workbench/${ivyfile}" conf="${ivy.configs}" />
    <ivy:report xml="true" todir="${ivy.reports.dir}" />
  </target>

    <!-- ======================================== EULA assembly packaging ========================================= -->

    <target name="package-eula">

        <property name="pentaho.resolve.repo" value="http://nexus.pentaho.org:8081/content/groups/omni" />

        <get
            src="${pentaho.resolve.repo}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
            dest="dist/ant-contrib-1.0b3.jar"
            verbose="true"
        />
        <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="dist/ant-contrib-1.0b3.jar" />

        <condition property="isWindows">
            <os family="windows" />
        </condition>
        
        <if>
            <not>
                <isset property="pentaho-eula-assembly-pom.version"/>
            </not>
            <then>
                <property name="pentaho-eula-assembly-pom.version" value="1.0.13" />
                <echo>pentaho-eula-assembly-pom.version not set, assuming default of ${pentaho-eula-assembly-pom.version}</echo>
            </then>
        </if>
        
        <if>
            <not>
                <isset property="artifactName"/>
            </not>
            <then>
                <property name="artifactName" value="${package.basename}" />
                <echo>artifactName not set, assuming default of ${artifactName}</echo>
            </then>
        </if>
        
        <if>
            <not>
                <available file="dist/pentaho-eula-assembly-pom-${pentaho-eula-assembly-pom.version}-pom.xml" type="file" />
            </not>
            <then>
                <get src="${pentaho.resolve.repo}/com/pentaho/pentaho-eula-assembly-pom/${pentaho-eula-assembly-pom.version}/pentaho-eula-assembly-pom-${pentaho-eula-assembly-pom.version}-pom.xml" 
                      dest="dist/pentaho-eula-assembly-pom-${pentaho-eula-assembly-pom.version}-pom.xml" 
                      verbose="true" />
            </then>
        </if>

        <echo>
                  mvn
                  -f dist/pentaho-eula-assembly-pom-${pentaho-eula-assembly-pom.version}-pom.xml
                  -DartifactName=${artifactName}
                  -Ddist.dir=
                  package
        </echo>
        <if>
            <isset property="isWindows" />
            <then>
                <exec executable="cmd">
                    <arg value="/c" />
                    <arg value="mvn.bat" />
                    <arg value="-f" />
                    <arg value="dist/pentaho-eula-assembly-pom-${pentaho-eula-assembly-pom.version}-pom.xml" />
                    <arg value="-DartifactName=${artifactName}" />
                    <arg value="-Ddist.dir=" />
                    <arg value="package" />
                </exec>
            </then>
            <else>
                <exec executable="mvn">
                    <arg value="-f" />
                    <arg value="dist/pentaho-eula-assembly-pom-${pentaho-eula-assembly-pom.version}-pom.xml" />
                    <arg value="-DartifactName=${artifactName}" />
                    <arg value="-Ddist.dir=" />
                    <arg value="package" />
                </exec>
            </else>
        </if>
        
        <delete file="dist/ant-contrib-1.0b3.jar" />

    </target>
    

</project>

<!-- End build.xml -->
