makefileclojuresconsleiningen

Looking for a Clojure/LISP equivalent to Scons


I have found a Scons, a Python-based build language similar to Make. However, I can not seem to find a Clojure/LISP equivalent to this type of build language tool (despite LISPs being seeming well-suited for this job). Does such a tool exist, and where is it located?

Background: I am considering using Clojure/Leningen as a potential candidate to replace Make as my build language for a C++ project I am working on. Is this a worthwhile effort? Is Clojure and/or LISP really a useful build language for a C++ project?


Solution

  • I doubt you will find anything as concise as Make in the Clojure world since Make is tailored to its purpose.

    However, the next closest thing is probably Babashka. Here's an example of how to work with task dependencies and modification times:

    {:tasks {:requires ([babashka.fs :as fs])
             :init (do (def target-dir  "target")
                       (def jar-file "target/foo.jar"))
             -target {:task (fs/create-dirs target-dir)}
             jar {:depends [-target]
                  :task (when (seq (fs/modified-since jar-file
                                                 (fs/glob "src" "**.clj")))
                          (spit jar-file "test")
                          (println "made jar!"))}
             uberjar {:depends [jar]
                      :task (println "creating uberjar!")}}}