-
-
Notifications
You must be signed in to change notification settings - Fork 97
/
bb.edn
139 lines (102 loc) · 5.83 KB
/
bb.edn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{:min-bb-version "0.8.0"
:pods {;since babashka 0.8.0, can only be declared in bb.edn
org.babashka/tools-deps-native {:version "0.1.6"}
clj-kondo/clj-kondo {:version "2024.05.24"}}
:deps {datahike/bb {:local/root "bb"}}
:tasks {:requires [[babashka.fs :as fs]
[clojure.edn :as edn]
[pod.borkdude.clj-kondo :as clj-kondo]
[tools.build :as build]
[tools.deploy :as deploy]
[tools.release :as release]
[tools.test :as test]
[tools.version :as version]]
:init (do (def config-file "config.edn")
(def config (edn/read-string (slurp config-file)))
(def deps (edn/read-string (slurp "deps.edn"))))
; tools
bench {:doc "Run benchmarks"
:task (clojure "-M:benchmark" "measure")}
ffix {:doc "Format source files"
:task (clojure "-M:ffix")}
; checks
format {:doc "Test formatting"
:task (clojure "-M:format")}
lint {:doc "Run clj-kondo linter"
:require [[pod.borkdude.clj-kondo :as clj-kondo]]
:task (clj-kondo/print! (clj-kondo/run! {:lint "."}))}
test {:doc "Run all tests or restrict to 'native-image', 'back-compat' or a kaocha test id (see tests.edn)"
:depends [jcompile]
:task (apply test/-main config *command-line-args*)}
kaocha {:doc "Run kaocha with arbitrary arguments"
:task (apply test/kaocha *command-line-args*)}
outdated {:doc "Find outdated libraries"
:task (clojure "-M:outdated")}
check {:doc "Run all checks"
:depends [test format lint outdated]}
; build and release
inc {:doc "Increment the project version: [major|minor] <version>"
:task (apply version/inc config-file *command-line-args*)}
tag {:doc "Return current version as a tag"
:task (println (version/as-tag config))}
clean {:doc "Remove build files"
:task (build/clean (-> config :build :clj))}
jcompile {:doc "Compile java classes"
:depends [clean]
:task (build/compile-java (-> config :build :clj))}
ccompile {:doc "Compile clojure namespaces"
:task (build/compile-clojure (-> config :build :clj))}
pom {:doc "Create pom file"
:task (build/pom config (-> config :build :clj))}
jar {:doc "Build jar"
:depends [jcompile pom]
:task (build/jar config (-> config :build :clj))}
install {:doc "Install jar locally"
:task (deploy/local config (-> config :build :clj))}
clojars {:doc "Install jar to clojars"
:task (deploy/remote config (-> config :build :clj))}
release {:doc "Build and release jar to GitHub"
:task (release/-main config *command-line-args*)}
;; http server build and release
http-server-clean {:doc "Remove build files"
:task (build/clean (-> config :build :http-server-clj))}
http-server-jcompile {:doc "Compile java classes"
:depends [http-server-clean]
:task (build/compile-java (-> config :build :http-server-clj))}
http-server-ccompile {:doc "Compile clojure namespaces"
:task (build/compile-clojure (-> config :build :http-server-clj))}
http-server-pom {:doc "Create pom file"
:task (build/pom config (-> config :build :http-server-clj))}
http-server-uber {:doc "Build jar"
:depends [http-server-jcompile http-server-pom http-server-ccompile]
:task (build/uber config (-> config :build :http-server-clj))}
http-server-install {:doc "Install uber jar locally"
:task (deploy/local config (-> config :build :http-server-clj))}
http-server-release {:doc "Build and release jar to GitHub"
:depends [http-server-uber]
:task (let [jar (build/jar-path config (-> config :build :http-server-clj))]
(release/gh-release jar config))}
;; native image
ni-check {:doc "Check for 'native-image' program"
:task (try (shell "which" "native-image")
(println "Program native-image found!")
(catch Exception _
(println "PATH does not contain native-image! Make sure to add your GraalVM to it.")
(System/exit 1)))}
ni-cli {:doc "Build native image cli"
:depends [jcompile ni-check]
:task (clojure "-M:native-cli")}
ni-ccompile {:doc "Create native cpp library"
:task (build/compile-clojure (-> config :build :native))}
ni-uber {:doc "Build native image uber jar"
:depends [jcompile ccompile ni-ccompile]
:task (build/uber config (-> config :build :native))}
ni-compile {:doc "Create native cpp library"
:depends [ni-uber]
:task (build/native-compile config (-> config :build :native))}
ni-release {:doc "Build and release native assets to GitHub"
:depends [ni-compile]
:task (let [{:keys [artifact target-dir]} (-> config :build :native)]
(fs/zip artifact [target-dir])
(release/gh-release artifact config)
(fs/delete artifact))}}}