<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- $Id: samples-build.xml 487703 2006-12-15 22:57:00Z joerg $ -->
<project name="samples">

  <description>
    Samples Targets
  </description>

  <target name="samples" depends="prepare, clover.off"
          unless="internal.exclude.webapp.samples">
    <mkdir dir="${build.samples}"/>

    <javac srcdir="${samples}"
           destdir="${build.samples}"
           debug="${compiler.debug}"
           optimize="${compiler.optimize}"
           deprecation="${compiler.deprecation}"
           target="${target.vm}"
           source="${source.vm}"
           compiler="${compiler}"
           classpathref="classpath"/>

    <!-- copy sample files -->
    <copy todir="${build.webapp.samples}" filtering="on">
      <fileset dir="${webapp.samples}">
        <exclude name="samples.xwelcome"/>
        <exclude name="old_sitemap.xmap"/>
        <exclude name="**/*.jpg"/>
        <exclude name="**/*.gif"/>
        <exclude name="**/*.png"/>
        <exclude name="**/*.zip"/>
        <exclude name="**/*.sxw"/>
        <!-- filtering breaks UTF-8 files -->
        <exclude name="i18n/**"/>
        <exclude name="hello-world/style/**"/>
      </fileset>
    </copy>

    <copy todir="${build.webapp.samples}" filtering="off">
      <fileset dir="${webapp.samples}">
        <include name="**/*.jpg"/>
        <include name="**/*.gif"/>
        <include name="**/*.png"/>
        <include name="**/*.zip"/>
        <include name="**/*.sxw"/>
        <!-- filtering breaks UTF-8 files -->
        <include name="i18n/**"/>
        <include name="hello-world/style/**"/>
      </fileset>
    </copy>

    <!-- copy gump.xml which is used to create block samples page -->
    <copy file="${gump.descriptor}" todir="${build.webapp.samples}/blocks"/>

    <!-- copy sample classes -->
    <copy todir="${build.webapp.classes}" filtering="off">
      <fileset dir="${build.samples}"/>
    </copy>

    <!-- patch the welcome page to tell we have samples to show -->
    <xpatch file="${build.webapp}/welcome.xml"
            srcdir="${webapp.samples}"
            includes="**/*.xwelcome"/>
  </target>

  <target name="block-samples" depends="prepare" unless="internal.exclude.webapp.samples">
    <ant antfile="${build.temp}/blocks-build.xml"
         inheritAll="true"
         inheritRefs="false"
         target="samples"/>
  </target>
</project>
