-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.clj
68 lines (51 loc) · 1.33 KB
/
build.clj
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
(ns build
(:require [clojure.tools.build.api :as b]
[org.corfield.build :as bb]))
(def lib 'io.github.erp12/fijit)
(def version (format "1.0.%s" (b/git-count-revs nil)))
(def scala-verions [:2.12 :2.13])
(def target "target")
(def class-dir (format "%s/classes" target))
(def aot-class-dir "classes")
(def jar-file (format "%s/%s-%s.jar" target (name (or lib 'application)) version))
;; Utils ;;;;;;;;;;
(defn for-scala-versions
[opts f]
(doseq [scala-ver (if-let [v (:scala-version opts)]
[v]
scala-verions)]
(f (merge {:aliases [scala-ver]}
opts))))
;; Entry ;;;;;;;;;;
(defn tests
[opts]
(for-scala-versions opts bb/run-tests))
(defn jar
[opts]
(-> opts
(assoc :lib lib :version version)
(bb/clean)
(bb/jar)))
(defn gen-docs
[_]
(println "Generating docs")
(let [{:keys [exit out err]} (b/process {:command-args ["clj" "-X:2.13:codox"]})]
(println out)
(println err)
(when-not (zero? exit)
(System/exit exit))))
(defn ci
"Run the CI pipeline. This runs tests for each Scala version and build the jar."
[opts]
(tests opts)
(jar opts))
(defn prepare-release
[opts]
(ci opts)
(gen-docs opts))
(defn publish
[opts]
(-> opts
(assoc :lib lib :version version)
(ci)
(bb/deploy)))