-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.clj
74 lines (53 loc) · 2.18 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
(ns ^:no-doc build
(:require [clojure.tools.build.api :as build]))
(def lib 'net.clojars.t_d_c/hiccup-server-components)
(def base-dir "target")
(def class-dir (str base-dir "/classes"))
(def basis (build/create-basis {:project "deps.edn"}))
(def uber-file (str base-dir "/hiccup-server-components.jar"))
(defn version [{:keys [major-version minor-version patch-version]
:or {major-version 0
patch-version (build/git-count-revs nil)}}]
;; All version parts must be supplied
(if (or (nil? major-version)
(nil? minor-version)
(nil? patch-version))
(throw (Exception. (str "Major, minor and patch version must be supplied: "
{:major-version major-version
:minor-version minor-version
:patch-version patch-version}))))
(format "%s.%s.%s"
major-version minor-version patch-version))
(defn clean [_]
(build/delete {:path base-dir})
(println "Build: Deleted base directory:" base-dir))
(defn prep [args]
(let [latest-version (version args)]
(println "Build: Preping pom.xml for version"
(str "(" latest-version ")")
" and copying source to" class-dir)
(build/write-pom
{:class-dir class-dir
:lib lib
:version latest-version
:basis basis
:scm {:url "https://github.com/TenDaysOfClojure/hiccup-server-components"
:connection "scm:git:https://github.com/TenDaysOfClojure/hiccup-server-components.git"
:developerConnection "scm:git:https://github.com/TenDaysOfClojure/hiccup-server-components.git"}
:src-dirs ["src"]})
(build/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})))
(defn uber [_]
(println "Build: Compiling uberjar" uber-file)
(build/compile-clj {:basis basis
:src-dirs ["src"]
:class-dir class-dir})
(build/uber {:class-dir class-dir
:uber-file uber-file
:basis basis
:main 'ten-d-c.hiccup-server-components.core})
(println "Build: Compile complete"))
(defn all [args]
(clean args)
(prep args)
(uber args))