-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.clj
51 lines (37 loc) · 1.7 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
(ns build
(:require [clojure.tools.build.api :as b]))
(def build-folder "target")
(def jar-content (str build-folder "/classes"))
(def basis (b/create-basis {:project "deps.edn"}))
(def version "0.0.1")
(defn clean [_]
(b/delete {:path "target"})
(println (format "Build folder \"%s\" removed" build-folder)))
(defn api-service [_]
(let [app-name "api-service"
uber-file-name "api-service.jar"]
(clean nil)
(b/copy-dir {:src-dirs ["resources"] ; copy resources
:target-dir jar-content})
(b/compile-clj {:basis basis ; compile clojure code
:src-dirs ["src/clj/api"]
:class-dir jar-content})
(b/uber {:class-dir jar-content ; create uber file
:uber-file uber-file-name
:basis basis
:main 'api.main}) ; here we specify the entry point for uberjar
(println (format "Uber file created: \"%s\"" uber-file-name))))
(defn worker-service [_]
(let [app-name "worker-service"
uber-file-name "worker-service.jar"]
(clean nil)
(b/copy-dir {:src-dirs ["resources"] ; copy resources
:target-dir jar-content})
(b/compile-clj {:basis basis ; compile clojure code
:src-dirs ["src/clj/worker"]
:class-dir jar-content})
(b/uber {:class-dir jar-content ; create uber file
:uber-file uber-file-name
:basis basis
:main 'worker.main}) ; here we specify the entry point for uberjar
(println (format "Uber file created: \"%s\"" uber-file-name))))