-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.clj
69 lines (60 loc) · 1.95 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
69
(ns build
(:require [clojure.tools.build.api :as b]))
(def lib 'sno/probematic)
(def version (format "%s" (b/git-process {:git-args "rev-parse --short HEAD"})))
(def main 'app.main)
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn" :user :standard}))
(defn- uber-opts [opts]
(assoc opts
:lib lib
:main main
:version version
:uber-file (format "target/%s-%s.jar" lib version)
:basis basis
:class-dir class-dir
:src-dirs ["src"]
:ns-compile [main]))
;; (defn tests "Run tests" [opts]
;; (-> opts
;; (assoc :lib lib :version version :main main)
;; ;(bb/run-task [:eastwood])
;; (bb/run-tests)))
;; (defn clean "Clean build dir" [opts]
;; (-> opts
;; (assoc :lib lib :version version :main main)
;; (bb/clean)))
(defn clean [_]
(b/delete {:path "target"}))
(defn compile-java-dev [_]
(b/javac {:src-dirs ["src/java"]
:class-dir "src/java-classes"
:basis basis
:javac-opts ["-source" "17" "-target" "17"]}))
(defn compile-java-prod [_]
(b/javac {:src-dirs ["src/java"]
:class-dir class-dir
:basis basis
:javac-opts ["-source" "17" "-target" "17"]}))
(defn uberjar "build the uberjar" [_]
(let [opts (uber-opts {})]
(clean nil)
(compile-java-prod nil)
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src"]})
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/compile-clj {:basis basis
:src-dirs ["src"]
:class-dir class-dir})
(b/uber opts)))
;; (defn ci "Run tests and build the jar" [opts]
;; (-> opts
;; (assoc :lib lib :version version :main main)
;; ;(bb/run-task [:eastwood])
;; (bb/clean)
;; (bb/run-tests)
;; (bb/uber)))