<?xml version="1.0" encoding="UTF-8"?>
<project default="jar"
         xmlns:j="jelly:core"
         xmlns:u="jelly:util"
         xmlns:deploy="deploy"
         xmlns:ant="jelly:ant"
         xmlns:maven="jelly:maven"
         xmlns:define="jelly:define">

    <j:set var="dist.name" value="${pom.artifactId}-${pom.currentVersion}"/>
    <!--<j:set var="dist.dir" value="target/dist"/>-->
    <j:set var="nhttp.dir" value="target/nhttp"/>

    <postGoal name="test:compile">
        <mkdir dir="${nhttp.dir}"/>
        <attainGoal name="nhttp"/>
    </postGoal>

    <goal name="nhttp">
        <mkdir dir="${nhttp.dir}"/>
        <mkdir dir="target/dist"/>
        <mkdir dir="${nhttp.dir}/META-INF"/>
        <ant:copy todir="${nhttp.dir}">
            <ant:fileset dir="target/classes">
                <ant:include name="**/**"/>
            </ant:fileset>
        </ant:copy>
        <!--<ant:copy todir="${nhttp.dir}/META-INF">
            <ant:fileset dir="src/META-INF">
                <ant:include name="**/**"/>
            </ant:fileset>
            <ant:fileset file="../../LICENSE.txt"/>
        </ant:copy>-->
        
        <ant:copy file="../../NOTICE-JAR.txt"
                  tofile="src/META-INF/NOTICE.txt"/>

        <manifest file="target/MANIFEST.MF">
            <attribute name="Extension-Name" value="org.apache.synapse"/>
            <attribute name="Specification-Title" value="${pom.artifactId}"/>
            <attribute name="Specification-Vendor"
                       value="Apache Software Foundation"/>
            <attribute name="Specification-Version"
                       value="${pom.currentVersion}"/>
            <attribute name="Implementation-Title" value="Apache Synapse"/>
            <attribute name="Implementation-Vendor-Id" value="org.apache"/>
            <attribute name="Implementation-Vendor"
                       value="Apache Software Foundation"/>
            <attribute name="Implementation-Version"
                       value="${pom.currentVersion}"/>
        </manifest>

        <jar jarfile="target/dist/nhttp.jar"
             basedir="${nhttp.dir}" manifest="target/MANIFEST.MF">
            <include name="**/**"/>
        </jar>
        <ant:delete dir="${nhttp.dir}"/>
    </goal>
</project>
