-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.clj
More file actions
76 lines (67 loc) · 2.47 KB
/
build.clj
File metadata and controls
76 lines (67 loc) · 2.47 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
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
75
76
(ns build
(:require
[clojure.tools.build.api :as b]
[deps-deploy.deps-deploy :as deploy]))
(def lib 'co.multiply/conc)
(def version "0.1.3")
(def class-dir "target/classes")
(def jar-file (format "target/%s-%s.jar" (name lib) version))
(def basis (delay (b/create-basis {:project "deps.edn"})))
(defn clean [_]
(b/delete {:path "target"}))
(defn compile-java
"Compile Java sources. Requires Java 21+."
[_]
(b/javac {:src-dirs ["java"]
:class-dir class-dir
:basis @basis
:javac-opts ["--release" "21"]}))
(def scm-url "https://github.com/multiplyco/conc")
(defn jar [_]
(clean nil)
(compile-java nil)
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis @basis
:src-dirs ["src"]
:scm {:url scm-url
:connection (str "scm:git:" scm-url)
:developerConnection (str "scm:git:" scm-url)
:tag (str "v" version)}
:pom-data [[:licenses
[:license
[:name "Eclipse Public License 2.0"]
[:url "https://www.eclipse.org/legal/epl-2.0/"]]]]})
(b/copy-dir {:src-dirs ["src"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file})
(println "Built:" jar-file))
(defn install [_]
(jar nil)
(b/install {:basis @basis
:lib lib
:version version
:jar-file jar-file
:class-dir class-dir})
(println "Installed:" lib version))
(defn version-str
"Print the current version string."
[_]
(println version))
(defn tag
"Create and push a version tag."
[_]
(let [tag (str "v" version)]
(b/git-process {:git-args ["tag" tag]})
(b/git-process {:git-args ["push" "origin" tag]})
(println "Tagged and pushed:" tag)))
(defn deploy [_]
(jar nil)
(deploy/deploy {:installer :remote
:artifact jar-file
:pom-file (str class-dir "/META-INF/maven/co.multiply/conc/pom.xml")
:repository {"clojars" {:url "https://clojars.org/repo"
:username (System/getenv "CLOJARS_DEPLOY_MAVEN_USERNAME")
:password (System/getenv "CLOJARS_DEPLOY_MAVEN_PASSWORD")}}}))