<?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.

   $Header:$
 -->

<project name="Beehive/NetUI/Compiler (apt)" default="build" basedir=".">

    <import file="../../netui-imports.xml"/>

    <property name="module.name" value="compiler-apt"/>
    <property name="module.dir" location="${src.dir}/${module.name}"/>
    <property name="module.classes.dir" location="${classes.dir}/${module.name}"/>
    <property name="compiler-core.classes.dir" location="${classes.dir}/compiler-core"/>

    <path id="module.classpath">
        <pathelement path="${compiler-core.classes.dir}"/>
    </path>

    <target name="build">
        <echo>compile module: ${module.name}</echo>
        <property name="classpath" refid="module.classpath"/>
        <echo>module classpath: ${classpath}</echo>
        <echo>basedir: ${basedir}</echo>
 
        <mkdir dir="${module.classes.dir}"/>

        <javac srcdir="${module.dir}"
               destdir="${module.classes.dir}"
               classpathref="module.classpath"
               debug="${compile.debug}"
               deprecation="${compile.deprecation}"
               optimize="${compile.optimize}"
               source="1.5">
            <include name="**/*.java"/>
        </javac>

        <!-- copy class files from the compiler-core module -->
        <copy todir="${module.classes.dir}">
            <fileset dir="${compiler-core.classes.dir}" includes="**/*"/>
        </copy>

        <copy todir="${module.classes.dir}">
            <fileset dir="${module.dir}" includes="**/*.properties"/>
            <fileset dir="${module.dir}" includes="**/*.xml"  excludes="build.xml"/>
            <fileset dir="${module.dir}" includes="META-INF/**"/>
        </copy>

        <jar jarfile="${jars.dir}/${compiler.jar.name}" basedir="${module.classes.dir}">
            <metainf dir="${beehive.home}">
                <include name="LICENSE.txt"/>
                <include name="NOTICE.txt"/>
            </metainf>
            <manifest>
                <attribute name="Extension-Name" value="Beehive NetUI Compiler"/>
                <attribute name="Specification-Title" value="Beehive NetUI Compiler"/>
                <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
                <attribute name="Specification-Version" value="${beehive.version}"/>
                <attribute name="Implementation-Title" value="Beehive NetUI Compiler"/>
                <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
                <attribute name="Implementation-Version" value="${beehive.version}"/>
                <attribute name="Beehive-Version" value="${beehive.version}"/>
            </manifest>
        </jar>
    </target>

    <target name="clean">
        <delete dir="${module.classes.dir}"/>
        <delete file="${jars.dir}/${compiler.jar.name}"/>
    </target>

</project>
