-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.clj
44 lines (37 loc) · 1.13 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
(ns build
(:refer-clojure :exclude [test])
(:require [clojure.tools.build.api :as b] ; for b/git-count-revs
[org.corfield.build :as bb]))
(def lib 'org.clojars.roklenarcic/memento)
(def version (format "2.0.%s" (b/git-count-revs nil)))
(def java-src-dir "java")
(defn add-defaults [opts]
(assoc opts :lib lib :version version))
(defn compile-java [{:keys [basis class-dir target] :as opts}]
(-> opts
add-defaults
(assoc :javac-opts ["-source" "11" "-target" "11"]
:basis (bb/default-basis basis)
:src-dirs [java-src-dir]
:class-dir (bb/default-class-dir class-dir target))
b/javac)
opts)
(defn test "Run the tests." [opts]
(compile-java opts)
(bb/run-tests opts))
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
(-> opts
add-defaults
(test)
(bb/clean)
compile-java
(bb/jar)))
(defn install "Install the JAR locally." [opts]
(-> opts
add-defaults
(bb/install)))
(defn deploy "Deploy the JAR to Clojars." [opts]
(-> opts
add-defaults
(assoc :sign-releases? true)
(bb/deploy)))