-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.clj
46 lines (40 loc) · 1.36 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
(ns build
(:refer-clojure :exclude [test])
(:require [clojure.tools.build.api :as b] ; for b/git-count-revs
[org.corfield.build :as bb]
[clojure.string :as str]))
(def lib 'com.github.yapsterapp/slip)
(def web-url "https://github.com/yapsterapp/slip")
(def scm-url "[email protected]:yapsterapp/slip.git")
(def version (format "0.0.%s" (b/git-count-revs nil)))
(defn sha
"the git sha is needed to tag a release in the pom.xml for cljdocs"
[{: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 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
:scm {:tag (sha nil)
:connection (str "scm:git:" scm-url)
:developerConnection (str "scm:git:" scm-url)
:url web-url})
(bb/run-tests)
(bb/clean)
(bb/jar)))
(defn install "Install the JAR locally." [opts]
(-> opts
(assoc :lib lib :version version)
(bb/install)))
(defn deploy "Deploy the JAR to Clojars." [opts]
(-> opts
(assoc :lib lib :version version)
(bb/deploy)))