Source

neman / common.xml

<!--
  Copyright (c) 2008 Krešimir Šojat. All rights reserved.  The use and
  distribution terms for this software are covered by the Common
  Public License 1.0 (http://www.opensource.org/licenses/cpl1.0.php)
  which can be found in the file CPL.TXT at the root of this
  distribution.  By using this software in any fashion, you are
  agreeing to be bound by the terms of this license.  You must not
  remove this notice, or any other, from this software.
-->
<project name='common' xmlns:ivy='antlib:org.apache.ivy.ant'>
    <property name='build' location='${basedir}/build'/>
    <property name='dist'  location='${basedir}/dist'/>
    <property name='lib'   location='${basedir}/lib'/>
    <property name='src'   location='${basedir}/src'/>
    <property name='test' location='${basedir}/tests'/>

    <property name='doc.src'        location='${basedir}/docs'/>
    <property name='doc.build'      location='${build}/docs'/>
    <property name='doc.dist'       location='${dist}/docs'/>
    <property name='doc.stylesheet' value='style.css'/>


    <property file='${basedir}/local.properties'/>
    <property file='${basedir}/build.properties'/>

    <macrodef name='clojure'>
        <attribute name='classpath' default=''/>
        <attribute name='classpathref' default=''/>
        <attribute name='file'/>
        <element name='args' optional='yes' implicit='true'/>
        <sequential>
            <java
                fork='true'
                classname='clojure.lang.Script'
                classpath='@{classpath}'
                classpathref='@{classpathref}'>
                <arg value='@{file}'/>
                <arg value='--'/>
                <args/>
            </java>
        </sequential>
    </macrodef>

    <!--
    Apache Ivy (http://ant.apache.org/ivy/).
    -->

    <target name='ivy-download' unless='skip.ivy'>
        <mkdir dir='${ivy.jar.dir}'/>
        <get
            src='${ivy.jar.src}' dest='${ivy.jar.dst}' usetimestamp='yes'/>
    </target>

    <target name='ivy-install' depends='ivy-download'>
        <path id='ivy.lib.path'>
            <fileset dir='${ivy.jar.dir}' includes='*.jar'/>
        </path>
        <taskdef
            resource='org/apache/ivy/ant/antlib.xml'
            uri='antlib:org.apache.ivy.ant'
            classpathref='ivy.lib.path'/>
    </target>

    <!--
    Documentation generation with textile-j.
    -->

    <target name='textile-config' depends='resolve'>
        <path id='textile.classpath'>
            <fileset dir='${lib}'>
                <include name='**/*.jar'/>
            </fileset>
        </path>
        <taskdef
            classpathref="textile.classpath"
            resource="net/java/textilej/util/anttask/tasks.properties"/>
    </target>

    <target name='build-docs' depends='textile-config'>
        <mkdir dir='${doc.build}'/>
        <copy todir='${doc.build}'>
            <fileset dir='${doc.src}'/>
        </copy>
        <textile-to-html>
            <fileset dir='${doc.build}'>
                <include name='**/*.textile'/>
            </fileset>
            <stylesheet url='${doc.stylesheet}'/>
        </textile-to-html>
    </target>

    <target name='dist-docs' depends='build-docs'>
        <mkdir dir='${doc.dist}'/>
        <copy todir='${doc.dist}'>
            <fileset dir='${doc.build}'>
                <exclude name='**/*.textile'/>
            </fileset>
        </copy>
    </target>

    <!--
    Clean.
    -->

    <target name='clean'>
        <delete>
            <fileset dir='${build}'/>
            <fileset dir='${dist}'/>
        </delete>
    </target>

    <!--
    Clojure targets.
    -->

    <target name='clojure-repl'>
        <echo file='${basedir}/clojure'>
        CLOJURE_CP=$JAVA_CLASSPATH:${lib}/*:${src}:${build.classes}
        java -cp $CLOJURE_CP jline.ConsoleRunner clojure.lang.Repl
        </echo>
        <chmod file='${basedir}/clojure' perm='+x'/>
    </target>
</project>