-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.clj
52 lines (42 loc) · 1.17 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
(ns build
(:refer-clojure :exclude [test])
(:require
[clojure.string :as str]
[clojure.tools.build.api :as b]
[org.corfield.build :as bb]))
(def ^:private lib 'io.github.sgepigon/mayo)
(def ^:private version "0.1.0-SNAPSHOT")
(defn- sha
[{:keys [dir path] :or {dir "."}}]
(-> {:command-args (cond-> ["git" "rev-parse" "HEAD"]
path (conj "--" path))
:dir (.getPath (b/resolve-path dir))
:out :capture}
b/process
:out
str/trim))
(defn- add-common-opts [opts]
(assoc opts :lib lib :version version :tag (sha nil)))
(defn test "Run the tests." [opts]
(bb/run-tests opts))
(defn clean "Run clean." [opts]
(-> opts
add-common-opts
bb/clean))
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
(-> opts
add-common-opts
bb/run-tests
bb/clean
bb/jar))
(defn install "Install the JAR locally." [opts]
(-> opts
add-common-opts
bb/install))
(defn deploy "Deploy the JAR to Clojars." [opts]
(-> opts
add-common-opts
bb/deploy))
(comment
;; alternatively, use MAJOR.MINOR.COMMITS:
(def version (format "1.0.%s" (b/git-count-revs nil))))