-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.clj
59 lines (50 loc) · 1.49 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
(ns build
(:refer-clojure :exclude [test])
(:require [clojure.tools.build.api :as b]
[borkdude.gh-release-artifact :as gh]
[org.corfield.build :as bb]))
(def lib 'io.replikativ/incognito)
(def version (format "0.3.%s" (b/git-count-revs nil)))
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file (format "target/%s-%s.jar" (name lib) version))
(defn clean
[_]
(b/delete {:path "target"}))
(defn jar
[opts]
(-> opts
(assoc :class-dir class-dir
:src-pom "./template/pom.xml"
:lib lib
:version version
:basis basis
:jar-file jar-file
:src-dirs ["src"])
bb/jar))
(defn test "Run the tests." [opts]
(bb/run-tests opts))
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
(-> opts
(assoc :lib lib :version version)
(bb/run-tests)
(bb/clean)
(bb/jar)))
(defn install "Install the JAR locally." [opts]
(-> opts
jar
bb/install))
(defn deploy "Deploy the JAR to Clojars." [opts]
(-> opts
(assoc :lib lib :version version)
(bb/deploy)))
(defn release
[_]
(-> (gh/overwrite-asset {:org "replikativ"
:repo (name lib)
:tag version
:commit (gh/current-commit)
:file jar-file
:content-type "application/java-archive"})
:url
println))