<!--
  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
  ~ and other contributors as indicated by the @author tags.
  ~
  ~ Licensed 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.
  -->

<project name="example-dist" basedir="." default="all">

    <target name="all">
        <delete dir="target/examples"/>
        <copy todir="target/examples/cors" overwrite="true">
            <fileset dir="../../examples/cors">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/cordova" overwrite="true">
            <fileset dir="../../examples/cordova">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/providers" overwrite="true">
            <fileset dir="../../examples/providers">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/saml" overwrite="true">
            <fileset dir="../../examples/saml">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/broker/saml-broker-authentication" overwrite="true">
            <fileset dir="../../examples/broker/saml-broker-authentication">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/js-console" overwrite="true">
            <fileset dir="../../examples/js-console">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/multi-tenant" overwrite="true">
            <fileset dir="../../examples/multi-tenant">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/basic-auth" overwrite="true">
            <fileset dir="../../examples/basic-auth">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/admin-client" overwrite="true">
            <fileset dir="../../examples/admin-client">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/themes" overwrite="true">
            <fileset dir="../../examples/themes">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/preconfigured-demo" overwrite="true">
            <fileset dir="../../examples/demo-template">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/*.unconfigured"/>
                <exclude name="**/subsystem-config.xml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/unconfigured-demo" overwrite="true">
            <fileset dir="../../examples/demo-template">
                <exclude name="**/*.wildfly"/>
                <exclude name="**/*.as7"/>
                <exclude name="**/WEB-INF/jboss-web.xml"/>
                <exclude name="**/keycloak.json"/>
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
                <exclude name="**/README.md"/>
            </fileset>
        </copy>
        <copy todir="target/examples/fuse" overwrite="true">
            <fileset dir="../../examples/fuse">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
            </fileset>
        </copy>
        <copy todir="target/examples/kerberos" overwrite="true">
            <fileset dir="../../examples/kerberos">
                <exclude name="**/target/**"/>
                <exclude name="**/*.iml"/>
            </fileset>
        </copy>
        <copy file="../../examples/README.md" tofile="target/examples/README.md"/>
        <move file="target/examples/unconfigured-demo/README.md.unconfigured" tofile="target/examples/unconfigured-demo/README.md"/>
        <move file="target/examples/unconfigured-demo/customer-app/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/customer-app/src/main/webapp/WEB-INF/web.xml"/>
        <move file="target/examples/unconfigured-demo/product-app/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/product-app/src/main/webapp/WEB-INF/web.xml"/>
        <move file="target/examples/unconfigured-demo/database-service/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/database-service/src/main/webapp/WEB-INF/web.xml"/>
    </target>
</project>
