1. Krešimir Šojat
  2. Eciton

Source

Eciton /

Filename Size Date modified Message
src/eciton
36 B
1.8 KB
199 B
12.3 KB
317 B
1.3 KB
1.9 KB
Eciton is a wrapper for Apache Ant in Clojure.

Primary purpose of the library is to expose Ant tasks to Clojure
applications, but it can also be used as a light build system.

If you are a Clojars user see http://clojars.org/eciton for
more info on how to use Eciton with Clojars repository.

All of the functionality required to use Eciton from your own
code is contained in eciton.core namespace.

Task syntax is similar to the one used by the Ant in xml
build files but when translated in to the Clojure following
rules apply:
  - All element attributes are placed in a map where keys
    as keywords represent attribute name and values equivalent
    values in a Ant xml.
  - Each child element is defined as a vector with the same
    syntax as a task itself.

Example:
  (require '[eciton.core :as ant])

  (def p (ant/project
           :basedir "."
           :desc    "Example project"))

  ; Simple echo task
  (ant/task p :echo {:message "Hello, ant world!"})

  ; More complex call to jar taks
  (ant/task p :jar {:destfile "example.jar"}
    [:fileset {:dir "src"}]
    [:fileset {:dir "." :includes "LICENSE.txt"}])

You can also use Eciton as a build system if you wish. In this case you
should use macros and functions provided by eciton.script namespace.

Example:
  (use 'eciton.script)

  (project :name "Example" :basedir "." :default :run
    (target :init
      (task :echo {:message "Init executed."}))

    (target :run :deps [:init]
      (task :jar {:destfile "example.jar"}
        [:fileset {:dir "src"}]
        [:fileset {:dir "." :includes "LICENSE.txt"}])))

If example script is saved in file 'build.clj' in the root directory
of your project, you can execute the build with:

  java -cp clojure.jar:ant.jar:ant-launcher.jar clojure.main -i build.clj

Where jars placed on the classpath should be replaced with their real names.