<?xml version="1.0" encoding="UTF-8"?>

<!--
  Copyright (c) 2005-2023 Leisenfels GmbH. All rights reserved.
  Use is subject to license terms.
-->

<project name="jarinfo" basedir=".">

    <target name="jar" description="Creates a JAR file including JarInfo.">

        <!-- Create a temporary directory for the classes and resources. -->
        <property name="TEMP_DIR" value="C:\Temp\jarinfo"/>
        <mkdir dir="${TEMP_DIR}"/>

        <!-- Copy the classes and resources. -->
        <property name="SRC_DIR" value="L:\lf\commons\src"/>
        <copy todir="${TEMP_DIR}/com">
            <fileset dir="${SRC_DIR}/com"/>
        </copy>

        <!-- Set the jarinfo.properties for this package. -->
        <copy todir="${TEMP_DIR}/com/lf/commons/info/resource" overwrite="true">
            <fileset file="jarinfo.properties"/>
        </copy>

        <!-- Copy some extra resources for JarInfo. -->
        <copy todir="${TEMP_DIR}/com/lf/commons/info/resource">
            <fileset file="${SRC_DIR}/com/lf/commons/resource/cubes_16.png"/>
        </copy>

        <!-- Create the JAR including the JarInfo component. -->
        <jar jarfile="sample.jar"
             basedir="${TEMP_DIR}" excludes="**/*.java **/*.jfd **/*.html **/Thumbs.db"
             level="9" includes="com/lf/commons/info/**">
            <manifest>
                <attribute name="Main-Class" value="com.lf.commons.info.JarInfo"/>
            </manifest>
        </jar>

        <!-- Cleanup. -->
        <delete quiet="true" dir="${TEMP_DIR}"/>

    </target>

</project>
