<!-- jd.xslt ant build file, works with ant 1.5.1 -->

<project name="jd.xslt" default="help" basedir=".">

<!-- Properties -->

<property name="name" value="jd.xslt"/>
<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="build.classes" value="${build}/classes"/>
<property name="build.doc" value="${build}/api"/>
<property name="build.lib" value="${build}/lib"/>

<!-- these libraries are needed to compile the sources-->
<property name="bsf.jar" value="bsf.jar"/>		<!-- Bean Scripting Framework-->
<property name="xpp.jar" value="xpp3_1_1_2.jar"/>	<!-- XML Pull Parser XPP3 -->
<property name="j2se.javadoc" value="http://java.sun.com/j2se/1.4.2/docs/api/"/>
<property name="xpp3.javadoc" value="http://www.xmlpull.org/v1/doc/api/"/>
<property name="bsf.javadoc" value=""/>


<!-- Targets -->

<target name="help" description="Print a help message">
<echo>
jd.xslt buildfile - available targets:

ant clean    -> cleanup the build directories
ant classes  -> compile the classes
ant jar      -> build the jar file
ant javadoc  -> build the javadoc comments
ant all      -> build the jar and javadocs
</echo>
</target>


<target name="prepare" description="Prepare build directories">
  <mkdir dir="${build}"/>
  <mkdir dir="${build.classes}"/>
  <mkdir dir="${build.lib}"/>
  <mkdir dir="${build.doc}"/>
</target>


<target name="clean" description="Delete all the created directories">
  <delete dir="${build}"/>
</target>


<target name="classes" depends="prepare" description="Build classes">
  <available file="${bsf.jar}" property="bsf.present"/>
  <available file="${xpp.jar}" property="xpp.present"/>
  <fail unless="bsf.present">
    Cannot compile because the Bean Scripting Framework library 
    ${bsf.jar} seems not to be available. 
  </fail>
  <fail unless="xpp.present">
    Cannot compile because the pull parser library 
    ${xpp.jar} seems not to be available. 
  </fail>
  <javac 
    srcdir="${src}" 
    destdir="${build.classes}"
    classpath="${src};${bsf.jar};${xpp.jar}"
    excludes="com/datapower/**"/>
</target>


<target name="jar" depends="classes" description="Build jar archives">
  <jar destfile="${build.lib}/jdxslt.jar"
       basedir="${build.classes}"
       index="true">
    <manifest>
      <attribute name="Main-Class" value="jd.xml.xslt.Stylesheet" />
    </manifest>
    <metainf dir="src/META-INF" includes="services/*" />
  </jar>
</target>


<target name="javadoc" depends="prepare" description="Build the full JavaDocs">
  <javadoc sourcepath="${src}"
          destdir="${build.doc}"
          doctitle="${name} JavaDoc"
          windowtitle="${name} JavaDoc"
          package="true"
          author="true"
          version="true"
          packagenames="jd.*,org.w3c.xsl.*"
          use="true">
      <link href="${j2se.javadoc}"/>
      <link href="${xpp3.javadoc}"/>
      <link href="${bsf.javadoc}"/>
    </javadoc>

</target>


<target name="all" depends="jar,javadoc" description="Build everything"/>


</project>
