<?xml version="1.0" encoding="UTF-8"?>
<!--
    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.
-->

<project name="Security Kernel Stub JAR Build"
         default="warn" basedir=".">

    <description>Build for security kernel stub jar</description>

    <!-- import common properties -->
    <property name="hy.hdk" location="${basedir}/../../deploy" />
    <import file="${hy.hdk}/build/ant/properties.xml" />

    <property name="hy.jdk" location="../../deploy/jdk" />
    <property name="hy.build" location="../../build/classes" />
    <property name="stub.jar"
              location="${hy.jdk}/jre/lib/boot/security-kernel-stubs.jar" />

    <fileset id="classes" dir="${hy.build}">
        <or>
            <present targetdir="src/main/java" />
            <present targetdir="src/main/java">
                <mapper type="regexp"
                        from="^(.*?)(\$$[^/\\\.]*)?\.class$$"
                        to="\1.java"/>
            </present>
        </or>
    </fileset>

    <target name="warn">
        <fail>...

This module is a non-functional stub.  It is intended only for use by
the top-level build.

        </fail>
    </target>

    <target name="build" depends="svn-info">
        <jar destfile="${stub.jar}" manifest="META-INF/MANIFEST.MF">
            <fileset refid="classes" />
            <manifest>
                <attribute name="Implementation-Version" value="${svn.info}"/> 
            </manifest>

            <metainf refid="hy.required.metainf-files"/>
        </jar>
    </target>

    <target name="clean">
        <delete file="${stub.jar}" />
        <delete failonerror="false">
            <fileset refid="classes" />
        </delete>
    </target>

    <target name="-test-module">
        <!-- just to match "API" for other modules. -->
    </target>

</project>
