<project
  xmlns:j="jelly:core"
  xmlns:define="jelly:define"
  xmlns:deploy="deploy">

  <!-- ===================================================================== -->
  <!-- T I N Y  T E S T  A P P                                               -->
  <!-- ===================================================================== -->

  <define:taglib uri="summit">
    <define:tag name="webapp">
    </define:tag>
  </define:taglib>

  <goal name="tiny-app">

    <delete file="${maven.build.dir}/summit.war"/>
    <delete dir="${maven.build.dir}/war/WEB-INF"/>
    <delete file="${maven.build.dir}/tiny.war"/>

    <copy todir="${maven.build.dir}/war/WEB-INF">
      <fileset dir="${maven.src.dir}/test/WEB-INF"/>
    </copy>
    
    <deploy:copy-deps 
      todir="${maven.build.dir}/war/WEB-INF/lib"
      excludes="avalon-framework,servletapi,plexus,plexus+velocity,junit,commons-logging,xml-apis,ant"
    />

    <mkdir dir="${maven.build.dir}/tiny"/>
    
    <copy todir="${maven.build.dir}/tiny">
      <fileset dir="${maven.src.dir}/test/app">
        <exclude name="templates/**"/>
      </fileset>
    </copy>

    <copy todir="${maven.build.dir}/war">
      <fileset dir="${maven.src.dir}/test/app/templates">
        <include name="css/*"/>
        <include name="images/*"/>
        <include name="js/*"/>
      </fileset>
    </copy>

    <jar 
      jarfile="${maven.build.dir}/tiny/templates.jar"
      basedir="${maven.src.dir}/test/app/templates"
    />

    <jar
      jarfile="${maven.build.dir}/tiny.jar"
      basedir="${maven.build.dir}/tiny">
    </jar>

    <copy 
      file="${maven.build.dir}/tiny.jar"
      todir="${maven.build.dir}/war/WEB-INF/application-views"
    />

  </goal>

  <goal name="dt" prereqs="clean,tiny-app,war">

    <copy 
      file="${maven.build.dir}/plexus-summit.war"
      tofile="${maven.build.dir}/tiny.war"
    />
    
    <copy 
      file="${maven.build.dir}/tiny.war" 
      todir="../.."
      overwrite="true"
    />
    
  </goal>

</project>
