-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.clj
36 lines (31 loc) · 975 Bytes
/
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
(ns build
(:require
[clojure.tools.build.api :as b]))
(defmacro ignore-exceptions
"Simple macro which wraps the given expression in a try/catch block and ignores the exception if caught."
{:style/indent 0}
[& body]
`(try ~@body (catch Throwable ~'_)))
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def uber-file "target/ubinote.jar")
(defn clean []
(b/delete {:path "target/"}))
(defn- build-uberjar
[]
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/compile-clj {:basis basis
:src-dirs ["src"]
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file uber-file
:basis basis
:main 'ubinote})
(println (format "Jar built: %s" uber-file)))
(defn uberjar [_]
(println "Build start")
(clean)
(println "Cleaned artifacts")
(build-uberjar)
(println "Built successfully!"))