Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bb.edn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:enter (let [{:keys [name]} (current-task)] (status/line :head "TASK %s %s" name (string/join " " *command-line-args*)))
:leave (let [{:keys [name]} (current-task)] (status/line :detail "\nTASK %s done." name))
;; commands
clean {:task clean/-main :doc "delete all build work"}
download-deps {:task download-deps/-main :doc "bring down Clojure deps"}
apply-import-vars {:task apply-import-vars/-main :doc "(check|gen-code) - export APIs statically from templates"}
dev-jvm {:task dev-repl/dev-jvm :doc "launch jvm nREPL for development, --help for usage"}
Expand Down
7 changes: 7 additions & 0 deletions doc/02-developer-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ bb lint --help

Tasks are described throughout this document.

== Clean
Sometimes you want to turf any local build work and caches, you can do so via:

----
bb clean
----

== Code Generation
Rewrite-clj v0 used a version of potemkin import-vars.
Potemkin import-vars copies specified vars from a specified namespace to the current namespace at load time.
Expand Down
18 changes: 18 additions & 0 deletions script/clean.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(ns clean
(:require [babashka.fs :as fs]
[helper.main :as main]))

(defn -main [& args]
(when (main/doc-arg-opt args)
(println "Deleting (d=deleted -=did not exist)")
(run! (fn [d]
(println (format "[%s] %s"
(if (fs/exists? d) "d" "-")
d))
(fs/delete-tree d {:force true}))
["target"
".cpcache"
".clj-kondo/.cache"
".lsp/.cache"
".eastwood"
".shadow-cljs"])))
10 changes: 6 additions & 4 deletions script/download_deps.clj
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
(ns download-deps
(:require [babashka.tasks :as t]))
(:require [babashka.tasks :as t]
[helper.main :as main]))

;; clojure has a -P command, but to bring down all deps we need to specify all aliases
;; bb deps will be brought down just from running bb (which assumedly is how this code is run)

(defn -main [& _args]
;; do all the work from build.clj to avoid repeated JVM launch costs
(t/clojure "-T:build download-deps"))
(defn -main [& args]
(when (main/doc-arg-opt args)
;; do all the work from build.clj to avoid repeated JVM launch costs
(t/clojure "-T:build download-deps")))