-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.clj
75 lines (60 loc) · 2.27 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
(ns build
(:require [clojure.tools.build.api :as b]
[clojure.tools.deps.cli.api :as cli]
[deps-deploy.deps-deploy :as dd]))
(def -version [0 2 6])
(let [[major minor patch] -version]
(def release-version (format "%s.%s.%s" major minor patch))
(def snapshot-version (format "%s.%s.%s-SNAPSHOT" major (inc minor) 0)))
(def lib 'de.active-group/active-openid)
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(defn jar-file
[version]
(format "target/%s-%s.jar" (name lib) version))
(defn clean [_]
(b/delete {:path "target"}))
(def git-scm-url (b/git-process {:git-args "config --get remote.origin.url"}))
(defn- parse-github-url
"Parses a GitHub URL returning a [username repo] pair."
[url]
(if url
(next
(or (re-matches #"(?:[A-Za-z-]{2,}@)?github.com:([^/]+)/([^/]+).git" url)
(re-matches #"[^:]+://(?:[A-Za-z-]{2,}@)?github.com/([^/]+)/([^/]+?)(?:.git)?" url)))))
(defn- github-url [url]
(if-let [[user repo] (parse-github-url url)]
(str "https://github.com/" user "/" repo)))
(defn build-jar!
[version]
(let [jar-file (jar-file version)]
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src"]
:scm {:url (github-url git-scm-url)}
:pom-data [[:licenses
[:license
[:name "Eclipse Public License 1.0"]
[:url "https://opensource.org/license/epl-1-0/"]
[:distribution "repo"]]]]})
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file})
jar-file))
(defn jar [_]
(build-jar! release-version))
(defn deploy!
[version]
(dd/deploy {:installer :remote
:artifact (build-jar! version)
:pom-file (b/pom-path {:lib lib
:class-dir class-dir})}))
(defn deploy [_]
(deploy! release-version))
(defn deploy-snapshot [_]
(deploy! snapshot-version))
(defn install-snapshot [_]
(cli/mvn-install {:jar (build-jar! snapshot-version)}))