-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.clj
40 lines (36 loc) · 1.6 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
(ns build
(:require [clojure.tools.build.api :as b]))
(def build-folder "target")
(def jar-content (str build-folder "/classes")) ; folder where we collect files to pack in a jar
(def lib-name 'fi.metosin/oksa)
(def version "1.1.1")
(def is-release (Boolean/parseBoolean (System/getenv "RELEASE")))
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file-name (format "%s/%s.jar" build-folder (name lib-name)))
(defn clean [_]
(b/delete {:path build-folder})
(println (format "Build folder \"%s\" removed" build-folder)))
(defn jar [_]
(clean nil)
(b/copy-dir {:src-dirs ["src"]
:target-dir jar-content})
(b/write-pom {:class-dir jar-content
:lib lib-name
:version (if is-release
version
(str version "-SNAPSHOT"))
:basis basis
:src-dirs ["src"]
:scm {:url "https://github.com/metosin/oksa"
:connection "scm:git:git://github.com/metosin/oksa/oksa.git"
:tag (if is-release
version
(b/git-process {:git-args "rev-parse HEAD"}))}
:pom-data [[:licenses
[:license
[:name "Eclipse Public License 2.0"]
[:url "https://opensource.org/license/epl-2-0/"]
[:distribution "repo"]]]]})
(b/jar {:class-dir jar-content
:jar-file jar-file-name})
(println (format "Jar file created: \"%s\"" jar-file-name)))