This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.clj
68 lines (58 loc) · 1.88 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
;; SPDX-License-Identifier: MIT
;; Copyright (C) 2023 Roland Csaszar
;;
;; Project: Clojure-Template
;; File: build.clj
;; Date: 12.Feb.2023
;;
;; ==============================================================================
(ns build
(:require [clojure.string :as str]
[clojure.tools.build.api :as b]))
(def prog "The programs namespace." 'clojure-template)
(def version
"Get the current version from the biggest Git tag that matches `v*`."
(format "%s" (first (str/split
(b/git-process {:dir "."
:git-command "git"
:git-args ["tag"
"--list"
"--sort=-version:refname"
"v*"]})
#"\n"))))
(def class-dir
"Java classes are saved in this directory."
"target/classes")
(def basis
"Read deps.edn for dependencies."
(b/create-basis {:project "deps.edn"}))
(def uber-file
"The filename of the überjar."
(format "target/%s-%s-standalone.jar" (name prog) version))
(comment
(name prog)
:rcf)
(defn clean
"Delete everything the directory `target`."
[_]
(b/delete {:path "target"}))
(defn uber
"Generate an überjar."
[_]
(clean nil)
(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 'clojure-template.core}))
(defn doc
"Generate ReadTheDocs documentation."
[_]
(b/process {:dir "."
:command-args ["pipenv" "install" "--dev"]})
(b/process {:dir "."
:command-args ["pipenv" "run" "mkdocs" "serve"]}))