forked from replikativ/datahike
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbb.edn
115 lines (83 loc) · 4.45 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
{: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.0.5"}
clj-kondo/clj-kondo {:version "2022.10.05"}}
: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*)}
;; 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))}}}