Skip to content

A set of Ant tasks for compiling and testing Clojure code [actually works with Clojure 1.2]

Notifications You must be signed in to change notification settings

alamar/clojure-ant-tasks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clojure Ant Tasks

by J. McConnell forked by Ilya Kasnacheev

Overview

This package provides Ant tasks to aid in the building and testing of Clojure projects. Up 'til now, most Clojure projects are built by manually calling out to the clojure.lang.Compile class using the Ant task. Similarly, they are normally tested by using the Ant task to load the namespaces to be tested and running a (run-all-tests). Besides being tedious and copy-and-paste prone, these both have the problem that, unless extra care is taken, compilation and test failures still result in a "successful" build, in Ant's eyes.

The tasks in this package aim to DRY out the building and testing of Clojure code in Ant while at the same time improve the status reporting of failed builds and tests.

UPD: As if somebody cared, I made clojure-ant-tasks to run with Clojure 1.2

Here is the checklist of things I want to implement but hasn't yet in case I forget something:

  • Fix a bug where compilepath property on clojure-compile is relative to current work dir, not to the project build root.
  • Add support of junit/TAP output for clojure-test.
  • Possibly write Teamcity output.

Otherwise it works just fine.

Use

Compilation

Define the task with ("clojure-compile" could be whatever name you like):

<taskdef name="clojure-compile"
  classname="com.ubermensch.ant.clojure.CompileTask"
  classpath="lib/clojure-ant-tasks.jar:lib/clojure.jar:lib/clojure-contrib.jar" />

Then you can use your new task to compile Clojure code with:

<clojure-compile>
  <classpath>
    <pathelement location="${src.dir}" />
    <pathelement location="${classes.dir}" />
    <path refid="references.paths.are.also.supported" />
  </classpath>
  <namespace>com.foo.first.namespace.to.compile</namespace>
  <namespace>com.foo.second.namespace.to.compile</namespace>
  <fileset dir="other/clojure/files" includes="**/*.clj" />
</clojure-compile>

If you would like to override Clojure's default compile path of "classes", you can add a compilepath attribute to your clojure-compile element, such as:

<clojure-compile compilepath="/non/default/path">
  ...
</clojure-compile>

Testing

Define the task with ("clojure-test" could be whatever name you like):

<taskdef name="clojure-test"
  classname="com.ubermensch.ant.clojure.TestTask"
  classpath="lib/clojure-ant-tasks.jar:lib/clojure.jar:lib/clojure-contrib.jar" />

Then you can use your new task to test Clojure code with:

<clojure-test>
  <classpath>
    <pathelement location="${classes.dir}" />
  </classpath>
  <namespace>com.foo.first.namespace.to.test</namespace>
  <namespace>com.foo.second.namespace.to.test</namespace>
</clojure-test>

License

Copyright (c) J. McConnell. All rights reserved.

The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html 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.

About

A set of Ant tasks for compiling and testing Clojure code [actually works with Clojure 1.2]

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 96.6%
  • Java 3.4%