Lancet is a build DSL written in Clojure, and a sample app in the book  
[1]. It combines ant tasks with a Clojure build language, and uses  
Chouser's shell-out to implement a system call for jumping to OS level  
stuff.

Lancet's own build script is below. There isn't much in the way of  
docs, but if you are interested please take a look at the repos [2].  
Feedback welcomed!

Stuart

[1] http://www.pragprog.com/titles/shcloj/programming-clojure
[2] http://github.com/stuarthalloway/lancet/tree/master

(use 'clojure.contrib.shell-out 'lancet)

(def clojure-home (or (env :CLOJURE_HOME) "/Users/stuart/repos/ 
clojure"))
(def contrib-home (or (env :CLOJURE_CONTRIB_HOME) "/Users/stuart/repos/ 
clojure-contrib"))

(def lib-dir "lib")
(def build-dir "build")

(deftarget build-clojure "Build Clojure from source"
   (with-sh-dir clojure-home
     (system "git svn rebase")
     (system "ant jar")))

(deftarget build-contrib "Build Contrib from source"
   (with-sh-dir contrib-home
     (system "git svn rebase")
     (system "ant clean jar")))

(deftarget init "Prepare for build"
   (mkdir {:dir lib-dir})
   (mkdir {:dir build-dir}))

(deftarget build-dependencies "Build dependent libraries"
   (init)
   (build-clojure)
   (build-contrib)
   (copy {:file (str clojure-home "/clojure.jar")
          :todir lib-dir})
   (copy {:file (str contrib-home "/clojure-contrib.jar")
          :todir lib-dir}))

(deftarget compile-lancet "compile lancet"
   (init)
   (system (str "java -Dclojure.compile.path="
               build-dir
               " -cp lib/ant.jar:lib/ant-launcher.jar:lib/clojure.jar:lib/ 
clojure-contrib.jar:build:. clojure.lang.Compile lancet")))

(deftarget create-jar "jar up lancet"
   (init)
   (unjar {:src (str lib-dir "/clojure.jar")
          :dest build-dir})
   (unjar {:src (str lib-dir "/clojure-contrib.jar")
          :dest build-dir})
   (unjar {:src (str lib-dir "/ant.jar")
          :dest build-dir})
   (unjar {:src (str lib-dir "/ant-launcher.jar")
          :dest build-dir})
   (compile-lancet)
   (jar {:jarfile (str lib-dir "/lancet.jar")
        :basedir "build"
        :manifest "MANIFEST.MF"}))

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to