-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.clj
60 lines (54 loc) · 2.52 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
(ns build
(:require [clojure.tools.build.api :as b]
[deps-deploy.deps-deploy :as dd]))
(def lib 'com.eldrix/concierge)
(def version (format "1.0.%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 [_]
(clean nil)
(println "Building :" lib version)
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src"]
:scm {:url "https://github.com/wardle/concierge"
:tag (str "v" version)
:connection "scm:git:git://github.com/wardle/concierge.git"
:developerConnection "scm:git:ssh://git@github.com/wardle/concierge.git"}
:pom-data [[:description "A suite of health and care integration modules, abstracting and simplifying integrations with underlying health and care systems"]
[:developers
[:developer
[:id "wardle"] [:name "Mark Wardle"] [:email "mark@wardle.org"] [:url "https://wardle.org"]]]
[:organization [:name "Eldrix Ltd"]]
[:licenses [:license
[:name "Eclipse Public License v2.0"]
[:url "https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html"]
[:distribution "repo"]]]]})
(b/copy-dir {:src-dirs ["src" "resources"], :target-dir class-dir})
(b/copy-file {:src "LICENSE" :target "target/classes/META-INF/LICENSE"})
(b/jar {:class-dir class-dir, :jar-file jar-file}))
(defn install
"Installs pom and library jar in local maven repository"
[_]
(jar nil)
(println "Installing :" lib version)
(b/install {:basis basis
:lib lib
:class-dir class-dir
:version version
:jar-file jar-file}))
(defn deploy
"Deploy library to clojars.
Environment variables CLOJARS_USERNAME and CLOJARS_PASSWORD must be set."
[_]
(install nil)
(println "Deploying :" lib version)
(dd/deploy {:installer :remote
:artifact jar-file
:pom-file (b/pom-path {:lib lib
:class-dir class-dir})}))