-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.clj
48 lines (42 loc) · 1.41 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
(ns build
(:require
[clojure.tools.build.api :as b]
[clojure.string :as str]))
(def lib 'org.clojars.darkleaf/di)
(def version "3.0.0")
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file (format "target/%s.jar" (name lib)))
(def scm-url "[email protected]:darkleaf/di.git")
(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 clean [_]
(b/delete {:path "target"}))
(defn jar [_]
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src"]
:scm {:tag (sha nil)
:connection (str "scm:git:" scm-url)
:developerConnection (str "scm:git:" scm-url)
:url scm-url}})
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))
(defn sync-pom [_]
(b/copy-file {:src (str class-dir "/META-INF/maven/org.clojars.darkleaf/di/pom.xml")
:target "pom.xml"}))
(defn all [_]
(clean nil)
(jar nil)
(sync-pom nil))