Blame


1 1d126b15 2021-10-13 op (ns build
2 a399554d 2021-10-13 op (:require
3 a399554d 2021-10-13 op [clojure.tools.build.api :as b]
4 a399554d 2021-10-13 op [deps-deploy.deps-deploy :as d]))
5 1d126b15 2021-10-13 op
6 a399554d 2021-10-13 op (def repo "github.com/omar-polo/gemini.git")
7 1d126b15 2021-10-13 op (def lib 'com.omarpolo/gemini)
8 c84244ac 2021-10-15 op (def version (format "0.2.0"))
9 1d126b15 2021-10-13 op (def class-dir "target/classes")
10 1d126b15 2021-10-13 op (def basis (b/create-basis {:project "deps.edn"}))
11 1d126b15 2021-10-13 op (def jar-file (format "target/%s-%s.jar" (name lib) version))
12 a399554d 2021-10-13 op (def pom-file (format "%s/META-INF/maven/%s/pom.xml" class-dir lib))
13 1d126b15 2021-10-13 op
14 1d126b15 2021-10-13 op (defn clean [_]
15 1d126b15 2021-10-13 op (b/delete {:path "target"}))
16 1d126b15 2021-10-13 op
17 1d126b15 2021-10-13 op (defn compile [_]
18 1d126b15 2021-10-13 op (b/javac {:src-dirs ["src"]
19 1d126b15 2021-10-13 op :class-dir class-dir
20 1d126b15 2021-10-13 op :basis basis
21 1d126b15 2021-10-13 op :javac-opts ["-source" "11" "-target" "11"]}))
22 1d126b15 2021-10-13 op
23 1d126b15 2021-10-13 op (defn jar [_]
24 1d126b15 2021-10-13 op (compile nil)
25 a399554d 2021-10-13 op (b/write-pom {:class-dir class-dir
26 a399554d 2021-10-13 op :lib lib
27 a399554d 2021-10-13 op :version version
28 a399554d 2021-10-13 op :basis basis
29 a399554d 2021-10-13 op :src-dirs ["src"]
30 a399554d 2021-10-13 op :scm {:connection (str "scm:git:git://" repo)
31 a399554d 2021-10-13 op :developerConnection (str "scm:git:ssh://git@" repo)
32 a399554d 2021-10-13 op :tag version
33 a399554d 2021-10-13 op :url (str "https://" repo)}})
34 1d126b15 2021-10-13 op (b/copy-dir {:src-dirs ["src"]
35 1d126b15 2021-10-13 op :target-dir class-dir})
36 1d126b15 2021-10-13 op (b/jar {:class-dir class-dir
37 1d126b15 2021-10-13 op :jar-file jar-file}))
38 a399554d 2021-10-13 op
39 a399554d 2021-10-13 op ;; NB: set CLOJARS_USERNAME and CLOJARS_PASSWORD
40 a399554d 2021-10-13 op (defn deploy [_]
41 a399554d 2021-10-13 op (when-not (or (System/getenv "CLOJARS_USERNAME")
42 a399554d 2021-10-13 op (System/getenv "CLOJARS_PASWORD"))
43 a399554d 2021-10-13 op (throw (Exception. "Missing CLOJARS_USERNAME or PASSWORD!")))
44 a399554d 2021-10-13 op (jar nil)
45 a399554d 2021-10-13 op ;; deploy both locally *and* on clojars
46 a399554d 2021-10-13 op (doseq [place [:local :remote]]
47 a399554d 2021-10-13 op (d/deploy {:artifact jar-file
48 a399554d 2021-10-13 op :pom-file pom-file
49 a399554d 2021-10-13 op :installer place
50 a399554d 2021-10-13 op :sign-releases? true})))