<?xml version="1.0"?>

<!--
==============================================================================

 Sample build file

Authors:
 Peter Donald <donaldp@apache.org>

Legal:
  Copyright (c) 2000 The Apache Software Foundation. All Rights Reserved.

==============================================================================
-->

<project name="MySample" default="main" basedir=".">

  <projectref name="prim" location="primitive-tests.ant" />

  <property name="year" value="2000"/>

  <target name="main" depends="typedef-test, converterdef-test, datatype-test, namespace-test, ant1-tasklib-test" />

  <target name="xp-deployer-test" depends="typedef-test, prim->undefined-task" />

  <target name="all" depends="property-test, typedef-test, converterdef-test, ant-call-test, datatype-test, namespace-test, ant1-tasklib-test, prim->main" />

<!--    
    <register-tasklib lib="../../dist/lib/core.atl" />
-->

  <target name="property-test">
    <property name="blah" value="fred" />
    <property name="${blah}" value="barney" />

    <echo message="Doing the funky Echo with ${blah} ${fred} Year=${year}!"/>
  </target>

  <target name="typedef-test">
    <typedef name="echo2" 
             type="task" 
             classname="org.apache.myrmidon.libs.core.Echo" 
             lib="../../dist/lib/core.atl" />

    <echo2 message="Luke to Echo base. Can you hear me?"/>
  </target>

  <target name="converterdef-test">
    <converterdef classname="org.apache.myrmidon.libs.core.StringToClassConverter"
                  source-type="java.lang.String"
                  destination-type="java.lang.Class"
                  lib="../../dist/lib/core.atl" />
  </target> 

  <target name="ant-call-test">
    <!-- test elided until we decide scope and necessity of ant-call -->
    <echo message="AntCall test elided until we decide scope and necessity of ant-call"/>
<!--
    <ant-call target="ant-call-test-target">
      <param name="blah" value="blah-value" />
    </ant-call>
-->
  </target>

  <target name="ant-call-test-target">
    <echo message="This should fail ...."/>
    <echo message="${blah}"/>
    <echo message="Whoa - it no fail. You used ant-call to call me and set param blah!"/>
  </target>

  <target name="datatype-test">
    <property name="foo">
      <pattern name="*.java"/>
    </property>

    <pattern id="foo2" name="*.java" if="..." />

    <echo message="foo=${foo}" />
    <echo message="foo2=${foo2}" />
  </target>

  <target name="namespace-test">

    <!-- ant and doc are built in namespaces -->
    <echo ant:fail-on-error="true" message="Some random message">
      <doc:description>
        Test case for aspects
      </doc:description>
      <ant:some-element some-attribute="blah"/>
    </echo>

    <!-- load facility for blee: namespace -->
    <facility namespace="blee">
      <noop/>
    </facility>

    <echo blee:some-param="blah" message="Blee namespace test successful!"/>

  </target>

  <target name="ant1-tasklib-test">

    <ant1-tasklib prefix="a1-" lib="../../dist/lib/ant1-compat.jar"/>

    <a1-echo message="Boo!" />
    <a1-mkdir dir="../../dist/test"/>
    <a1-copy file="../../tools/lib/ant.jar" tofile="../../dist/test/ant1-compat.jar" />

  </target>

</project>