Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
244 lines (216 sloc) 9.29 KB
<project name="clojure-contrib" default="jar" xmlns:mvn="urn:maven-artifact-ant">
<description>
Pack all clojure-contrib sources into a JAR. Compile those that can
be compiled standalone if the clojure.jar property points us to
clojure.jar.
</description>
<property name="src" location="src"/>
<property name="build" location="classes"/>
<available property="hasclojure" file="${clojure.jar}"/>
<!-- The JAR file to create. -->
<property name="jarfile" location="clojure-contrib.jar"/>
<property name="slimjarfile" location="clojure-contrib-slim.jar"/>
<!-- These make sense for building on tapestry.formos.com -->
<property name="snapshot.repo.dir" location="/var/www/maven-snapshot-repository"/>
<property name="stable.repo.dir" location="/var/www/maven-repository"/>
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="clean" description="Remove generated files and directories.">
<delete file="${jarfile}"/>
<delete file="${slimjarfile}"/>
<delete dir="${build}"/>
</target>
<target name="test_contrib"
description="Run contrib tests"
if="hasclojure">
<java classname="clojure.main">
<classpath>
<path location="${build}"/>
<path location="${src}"/>
<path location="${clojure.jar}"/>
</classpath>
<arg value="-e"/>
<arg value="(require '(clojure.contrib [test-contrib :as main])) (main/run)"/>
</java>
</target>
<target name="test_datalog"
description="Run datalog tests"
if="hasclojure">
<java classname="clojure.main">
<classpath>
<path location="${build}"/>
<path location="${src}"/>
<path location="${clojure.jar}"/>
</classpath>
<arg value="-e"/>
<arg value="(require '(clojure.contrib.datalog.tests [test :as main])) (main/run)"/>
</java>
</target>
<target name="test" depends="test_contrib,test_datalog"
description="Run all tests"/>
<target name="check_hasclojure"
description="Print a warning message if clojure.jar is undefined"
unless="hasclojure">
<echo>WARNING: You have not defined a path to clojure.jar so I can't compile files.
This will cause some parts of clojure.contrib not to work (e.g., pretty print).
To enable compiling, run "ant -Dclojure.jar=&lt;...path to clojure.jar..&gt;"
</echo>
</target>
<target name="compile_classes" depends="init,check_hasclojure"
description="Compile the clojure files that have gen-class."
if="hasclojure">
<java classname="clojure.lang.Compile">
<classpath>
<path location="${build}"/>
<path location="${src}"/>
<path location="${clojure.jar}"/>
</classpath>
<sysproperty key="clojure.compile.path" value="${build}"/>
<arg value="clojure.contrib.pprint.ColumnWriter"/>
<arg value="clojure.contrib.pprint.PrettyWriter"/>
<arg value="clojure.contrib.fnmap.PersistentFnMap"/>
<arg value="clojure.contrib.condition.Condition"/>
</java>
</target>
<target name="compile_clojure" depends="init,check_hasclojure"
description="Compile Clojure sources."
if="hasclojure">
<java classname="clojure.lang.Compile">
<classpath>
<path location="${build}"/>
<path location="${src}"/>
<path location="${clojure.jar}"/>
</classpath>
<sysproperty key="clojure.compile.path" value="${build}"/>
<sysproperty key="java.awt.headless" value="true"/>
<arg value="clojure.contrib.accumulators"/>
<arg value="clojure.contrib.agent-utils"/>
<arg value="clojure.contrib.classpath"/>
<arg value="clojure.contrib.combinatorics"/>
<arg value="clojure.contrib.command-line"/>
<arg value="clojure.contrib.complex-numbers"/>
<arg value="clojure.contrib.cond"/>
<arg value="clojure.contrib.condition"/>
<arg value="clojure.contrib.condt"/>
<arg value="clojure.contrib.core"/>
<arg value="clojure.contrib.dataflow"/>
<arg value="clojure.contrib.datalog"/>
<arg value="clojure.contrib.datalog.database"/>
<arg value="clojure.contrib.datalog.literals"/>
<arg value="clojure.contrib.datalog.magic"/>
<arg value="clojure.contrib.datalog.rules"/>
<arg value="clojure.contrib.datalog.softstrat"/>
<arg value="clojure.contrib.datalog.util"/>
<arg value="clojure.contrib.def"/>
<arg value="clojure.contrib.duck-streams"/>
<arg value="clojure.contrib.error-kit"/>
<arg value="clojure.contrib.except"/>
<arg value="clojure.contrib.fcase"/>
<arg value="clojure.contrib.find-namespaces"/>
<arg value="clojure.contrib.fnmap"/>
<arg value="clojure.contrib.gen-html-docs"/>
<arg value="clojure.contrib.generic"/>
<arg value="clojure.contrib.generic.arithmetic"/>
<arg value="clojure.contrib.generic.collection"/>
<arg value="clojure.contrib.generic.comparison"/>
<arg value="clojure.contrib.generic.functor"/>
<arg value="clojure.contrib.generic.math-functions"/>
<arg value="clojure.contrib.graph"/>
<arg value="clojure.contrib.greatest-least"/>
<arg value="clojure.contrib.import-static"/>
<arg value="clojure.contrib.jar"/>
<arg value="clojure.contrib.java-utils"/>
<arg value="clojure.contrib.javadoc.browse"/>
<arg value="clojure.contrib.javadoc.browse-ui"/>
<arg value="clojure.contrib.json.read"/>
<arg value="clojure.contrib.json.write"/>
<arg value="clojure.contrib.lazy-seqs"/>
<arg value="clojure.contrib.lazy-xml"/>
<arg value="clojure.contrib.macro-utils"/>
<arg value="clojure.contrib.macros"/>
<arg value="clojure.contrib.map-utils"/>
<arg value="clojure.contrib.math"/>
<arg value="clojure.contrib.miglayout"/>
<arg value="clojure.contrib.miglayout.internal"/>
<arg value="clojure.contrib.mmap"/>
<arg value="clojure.contrib.monads"/>
<arg value="clojure.contrib.ns-utils"/>
<arg value="clojure.contrib.pprint.ColumnWriter"/>
<arg value="clojure.contrib.pprint.PrettyWriter"/>
<arg value="clojure.contrib.pprint"/>
<arg value="clojure.contrib.pprint.utilities"/>
<arg value="clojure.contrib.probabilities.finite-distributions"/>
<arg value="clojure.contrib.probabilities.monte-carlo"/>
<arg value="clojure.contrib.probabilities.random-numbers"/>
<arg value="clojure.contrib.prxml"/>
<arg value="clojure.contrib.repl-ln"/>
<arg value="clojure.contrib.repl-utils"/>
<arg value="clojure.contrib.seq-utils"/>
<arg value="clojure.contrib.server-socket"/>
<arg value="clojure.contrib.set"/>
<arg value="clojure.contrib.shell-out"/>
<arg value="clojure.contrib.singleton"/>
<arg value="clojure.contrib.sql"/>
<arg value="clojure.contrib.sql.internal"/>
<arg value="clojure.contrib.str-utils"/>
<arg value="clojure.contrib.stream-utils"/>
<arg value="clojure.contrib.swing-utils"/>
<arg value="clojure.contrib.trace"/>
<arg value="clojure.contrib.types"/>
<arg value="clojure.contrib.with-ns"/>
<arg value="clojure.contrib.zip-filter"/>
<arg value="clojure.contrib.zip-filter.xml"/>
</java>
</target>
<target name="jar" description="Create jar files." depends="compile_clojure">
<jar jarfile="${jarfile}">
<fileset file="epl-v10.html"/>
<fileset dir="${src}" includes="**/*.clj"/>
<fileset dir="${build}" includes="**/*.class"/>
<manifest>
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
<jar jarfile="${slimjarfile}">
<fileset file="epl-v10.html"/>
<fileset dir="${src}" includes="**/*.clj"/>
<manifest>
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
</target>
<target name="-setup-maven" description="Load Maven typedefs, read POM, establish dependencies.">
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"/>
<mvn:pom file="pom.xml" id="contrib.pom"/>
<mvn:dependencies pomRefId="contrib.pom"/>
</target>
<target name="clean-build" depends="clean,compile_clojure,test,jar"
description="Builds clojure-contrib from scratch and runs all tests."/>
<target name="ci-build" depends="-setup-maven"
description="Build clojure-contrib using Clojure obtained via Maven.">
<antcall target="clean-build">
<param name="clojure.jar" value="${org.clojure:clojure-lang:jar}"/>
</antcall>
<mvn:install file="${jarfile}" pomrefid="contrib.pom">
<attach file="${slimjarfile}" classifier="slim"/>
</mvn:install>
</target>
<macrodef name="deploy">
<attribute name="target-dir" description="Root of Maven repository"/>
<sequential>
<mvn:deploy file="${jarfile}" pomrefid="contrib.pom">
<attach file="${slimjarfile}" classifier="slim"/>
<remoteRepository url="file:@{target-dir}"/>
</mvn:deploy>
</sequential>
</macrodef>
<target name="nightly-build" depends="ci-build"
description="Build and deploy to nightly (snapshot) repository.">
<deploy target-dir="${snapshot.repo.dir}"/>
</target>
<target name="stable-build" depends="ci-build" description="Build and deploy to stable repository.">
<deploy target-dir="${stable.repo.dir}"/>
</target>
</project>