Skip to content

Commit 7bac58d

Browse files
committed
dev: update scripts to use babashka v3.1
Babashka now allows us to specify our path and deps in a bb.edn file. This is a nice addition that cleans up our bb scripts. Note that our bb scripts no longer fail fast if a minimum bb version is not met. My tests for this were depending on recent bb version features and therefore really made no sense.
1 parent 11adbfc commit 7bac58d

26 files changed

+139
-235
lines changed

bb.edn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{:paths ["script"]
2+
:deps {org.clojure/data.zip {:mvn/version "1.0.0"}
3+
io.aviso/pretty {:mvn/version "0.1.36"}
4+
docopt/docopt {:git/url "https://github.com/nubank/docopt.clj"
5+
:sha "98814f559d2e50fdf10f43cbe3b7da0ca3cca423"}
6+
doric/doric {:mvn/version "0.9.0"}
7+
version-clj/version-clj {:mvn/version "0.1.2"}}}

doc/02-developer-guide.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ On Windows we only test against JDK11 as tool setup for JDK8 on Windows seemed o
2121
* NodeJs v12 or above
2222
* Clojure v1.10.1.697 or above for `clojure` command
2323
** Note that rewrite-clj v1 itself supports Clojure v1.9 and above
24-
* Babashka v0.2.3 or above
24+
* Babashka v0.3.1 or above
2525
* GraalVM v21.0.0 (if you want to run GraalVM native image tests)
2626

2727
=== Windows Notes

script/apply_import_vars.clj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/usr/bin/env bb
22

33
(ns apply-import-vars
4-
(:require [babashka.classpath :as cp]))
5-
6-
(cp/add-classpath "./script")
7-
(require '[helper.env :as env]
8-
'[helper.shell :as shell]
9-
'[helper.status :as status])
4+
(:require [helper.env :as env]
5+
[helper.shell :as shell]
6+
[helper.status :as status]))
107

118
(defn main[args]
129
(env/assert-min-versions)

script/ci_tests.clj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
#!/usr/bin/env bb
22

33
(ns ci-tests
4-
(:require [babashka.classpath :as cp]))
5-
6-
(cp/add-classpath "./script")
7-
(require '[helper.env :as env]
8-
'[helper.fs :as fs]
9-
'[helper.shell :as shell]
10-
'[helper.status :as status])
4+
(:require [helper.env :as env]
5+
[helper.fs :as fs]
6+
[helper.shell :as shell]
7+
[helper.status :as status]))
118

129
(defn clean []
1310
(doseq [dir ["target" ".cpcache .shadow-cljs"]]

script/clj_tests.clj

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#!/usr/bin/env bb
22

3-
(ns clj_tests
4-
(:require [babashka.classpath :as cp]
5-
[clojure.string :as string]
6-
[clojure.tools.cli :as cli] ))
7-
8-
(cp/add-classpath "./script")
9-
(require '[helper.env :as env]
10-
'[helper.shell :as shell]
11-
'[helper.status :as status])
3+
(ns clj-tests
4+
(:require [clojure.string :as string]
5+
[clojure.tools.cli :as cli]
6+
[helper.env :as env]
7+
[helper.shell :as shell]
8+
[helper.status :as status]))
129

1310
(def allowed-clojure-versions '("1.9" "1.10"))
1411
(def default-clojure-version "1.10")

script/clj_watch.clj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/usr/bin/env bb
22

33
(ns clj-watch
4-
(:require [babashka.classpath :as cp]))
5-
6-
(cp/add-classpath "./script")
7-
(require '[helper.env :as env]
8-
'[helper.shell :as shell]
9-
'[helper.status :as status])
4+
(:require [helper.env :as env]
5+
[helper.shell :as shell]
6+
[helper.status :as status]))
107

118
(env/assert-min-versions)
129
(status/line :info "launching kaocha watch on clojure sources")

script/cljdoc_preview.clj

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
#!/usr/bin/env bb
22

33
(ns cljdoc-docker-preview
4-
(:require [babashka.classpath :as cp]
5-
[babashka.curl :as curl]
6-
[babashka.deps :as deps]
4+
(:require [babashka.curl :as curl]
5+
[clojure.data.xml :as xml]
6+
[clojure.data.zip.xml :as zxml]
77
[clojure.java.browse :as browse]
8-
[clojure.string :as string]))
9-
10-
(cp/add-classpath "./script")
11-
(deps/add-deps "{:deps {org.clojure/data.zip {:mvn/version \"1.0.0\"}}}")
12-
(require '[clojure.data.xml :as xml]
13-
'[clojure.data.zip.xml :as zxml]
14-
'[clojure.zip :as zip]
15-
'[helper.fs :as fs]
16-
'[helper.shell :as shell]
17-
'[helper.status :as status])
8+
[clojure.string :as string]
9+
[clojure.zip :as zip]
10+
[helper.fs :as fs]
11+
[helper.shell :as shell]
12+
[helper.status :as status]))
1813

1914
;;
2015
;; constants
@@ -49,7 +44,7 @@
4944
;;
5045
(defn get-from-pom [& tag-path]
5146
(let [xml (-> "./pom.xml"
52-
slurp
47+
slurp
5348
(xml/parse-str :namespace-aware false)
5449
zip/xml-zip)]
5550
(apply zxml/xml1-> (concat [xml] tag-path [zxml/text]))))

script/cljs_tests.clj

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
#!/usr/bin/env bb
22

33
(ns cljs-tests
4-
(:require [babashka.classpath :as cp]
5-
[clojure.java.io :as io]
4+
(:require [clojure.java.io :as io]
65
[clojure.string :as string]
7-
[clojure.tools.cli :as cli]))
8-
9-
(cp/add-classpath "./script")
10-
(require '[helper.env :as env]
11-
'[helper.fs :as fs]
12-
'[helper.shell :as shell]
13-
'[helper.status :as status])
6+
[clojure.tools.cli :as cli]
7+
[helper.env :as env]
8+
[helper.fs :as fs]
9+
[helper.shell :as shell]
10+
[helper.status :as status]))
1411

1512
(def valid-envs '("node" "chrome-headless" "planck"))
1613
(def valid-optimizations '("none" "advanced"))

script/cljs_watch.clj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/usr/bin/env bb
22

33
(ns cljs-watch
4-
(:require [babashka.classpath :as cp]))
5-
6-
(cp/add-classpath "./script")
7-
(require '[helper.env :as env]
8-
'[helper.shell :as shell]
9-
'[helper.status :as status])
4+
(:require [helper.env :as env]
5+
[helper.shell :as shell]
6+
[helper.status :as status]))
107

118
(env/assert-min-versions)
129
(status/line :detail "compiling code, then opening repl, afterwich your web browser will automatically open to figwheel test run summary")

script/coverage.clj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/usr/bin/env bb
22

33
(ns coverage
4-
(:require [babashka.classpath :as cp]))
5-
6-
(cp/add-classpath "./script")
7-
(require '[helper.env :as env]
8-
'[helper.shell :as shell]
9-
'[helper.status :as status])
4+
(:require [helper.env :as env]
5+
[helper.shell :as shell]
6+
[helper.status :as status]))
107

118
(defn generate-doc-tests []
129
(status/line :info "Generating tests for code blocks in documents")

0 commit comments

Comments
 (0)