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

<!-- ====================================================================== -->
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above.        -->
<!-- ====================================================================== -->

<project name="ARTIFACT_ID" default="package" basedir=".">

  <!-- ====================================================================== -->
  <!-- Import maven-build.xml into the current project                        -->
  <!-- ====================================================================== -->

  <import file="maven-build.xml"/>
  
  <!-- ====================================================================== -->
  <!-- Help target                                                            -->
  <!-- ====================================================================== -->

  <target name="help">
    <echo message="Please run: $ant -projecthelp"/>
  </target>

  <property name="bnd.version" value="BND_VERSION"/>

  <target name="get-bnd"
          depends="test-offline"
          description="Download BND tool"
          unless="maven.mode.offline">
    <mkdir dir="${maven.repo.local}"/>
    <mkdir dir="${maven.repo.local}/biz/aQute/bnd/${bnd.version}"/>
    <get src="http://www.aqute.biz/repo/biz/aQute/bnd/${bnd.version}/bnd-${bnd.version}.jar"
         dest="${maven.repo.local}/biz/aQute/bnd/${bnd.version}/bnd-${bnd.version}.jar"
         usetimestamp="true"
         ignoreerrors="true"/>
  </target>

  <target name="package" depends="compile,test,get-bnd" description="Package the bundle">
    <taskdef resource="aQute/bnd/ant/taskdef.properties">
      <classpath>
        <pathelement location="${maven.repo.local}/biz/aQute/bnd/${bnd.version}/bnd-${bnd.version}.jar"/>
      </classpath>
    </taskdef>
    <pathconvert property="bnd.classpath" refid="build.classpath" pathsep=","/>
    <bnd files="maven-build.bnd" classpath="${maven.build.outputDir},${bnd.classpath}"/>
  </target>

</project>
