-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.clj
More file actions
72 lines (65 loc) · 2.02 KB
/
build.clj
File metadata and controls
72 lines (65 loc) · 2.02 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
(ns build
(:require [clojure.tools.build.api :as b]
[deps-deploy.deps-deploy :as dd]))
(def lib 'org.scicloj/ripple)
(def version "0.1.1")
(def snapshot (str version "-SNAPSHOT"))
(def class-dir "target/classes")
(defn- get-version [opts]
(if (:snapshot opts)
snapshot
version))
(defn- jar-opts [opts]
(let [version (get-version opts)]
(assoc opts
:lib lib
:version version
:jar-file (format "target/%s-%s.jar" lib version)
:basis (b/create-basis {})
:class-dir class-dir
:target "target"
:src-dirs ["src"]
:resource-dirs [])))
(defn run-tests
"Run tests via cognitect test runner"
[opts]
(b/process {:command-args ["clojure" "-M:test" "-m" "cognitect.test-runner"]})
opts)
(defn- pom-template [version]
[[:description "Signal processing library for MALDI-TOF mass spectrometry"]
[:url "https://github.com/scicloj/ripple"]
[:licenses
[:license
[:name "MIT License"]
[:url "https://opensource.org/licenses/MIT"]]]
[:developers
[:developer
[:name "scicloj"]]]
[:scm
[:url "https://github.com/scicloj/ripple"]
[:connection "scm:git:https://github.com/scicloj/ripple.git"]
[:developerConnection "scm:git:ssh:git@github.com:scicloj/ripple.git"]
[:tag (str "v" version)]]])
(defn ci
"Run the CI pipeline (test, clean, build JAR)"
[opts]
(run-tests opts)
(b/delete {:path "target"})
(let [opts (jar-opts opts)
version (get-version opts)]
(println "\nWriting pom.xml...")
(b/write-pom (assoc opts :pom-data (pom-template version)))
(println "\nCopying source...")
(b/copy-dir {:src-dirs ["src"] :target-dir class-dir})
(println "\nBuilding JAR..." (:jar-file opts))
(b/jar opts))
opts)
(defn deploy
"Deploy to Clojars"
[opts]
(let [opts (jar-opts opts)]
(dd/deploy (merge {:installer :remote
:artifact (:jar-file opts)
:pom-file (b/pom-path opts)}
opts)))
opts)