-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.clj
More file actions
42 lines (36 loc) · 1.45 KB
/
build.clj
File metadata and controls
42 lines (36 loc) · 1.45 KB
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
(ns build
(:require
[clojure.java.io :as io]
[clojure.tools.build.api :as b]))
(def lib 'practitest/practitest-firecracker)
; Create new tag v<Major>.<Minor> when starting working on new major/minor version branch
(def major-version 2)
(def minor-version 2)
(def commits-count (b/git-process {:git-args (format "rev-list v%s.%s..HEAD --count" major-version minor-version)}))
(def version (format "%s.%s.%s" major-version minor-version commits-count))
(def class-dir "target/classes")
(def uber-file (format "target/%s-%s-standalone.jar" (name lib) version))
;; delay to defer side effects (artifact downloads)
(def basis (delay (b/create-basis {:project "deps.edn"})))
(defn clean [_]
(println "Cleaning directories")
(b/delete {:path "target"}))
(defn uber [_]
(println "Building uberjar for" version)
(clean nil)
(b/copy-dir {:src-dirs ["src"]
:target-dir class-dir})
(b/copy-dir {:src-dirs ["resources"]
:target-dir class-dir})
(println "Compiling clojure code")
(b/compile-clj {:basis @basis
:ns-compile '[practitest-firecracker.core]
:class-dir class-dir})
(println "Packing JAR file")
(spit (io/file class-dir "practitest_firecracker" "firecracker_version.txt")
version)
(b/uber {:class-dir class-dir
:uber-file uber-file
:basis @basis
:manifest {"Implementation-Version" version}
:main 'practitest-firecracker.core}))