-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.clj
91 lines (73 loc) · 2.65 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
(ns build
(:refer-clojure :exclude [test])
(:require [clojure.tools.build.api :as b] ; for b/git-count-revs
[org.corfield.build :as bb]
[deps-deploy.deps-deploy :as dd]))
(def lib 'org.scicloj/scicloj.ml.xgboost)
; alternatively, use MAJOR.MINOR.COMMITS:
;; (def version (format "7.0.%s" (b/git-count-revs nil)))
(def version "6.2.0")
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
;;(def jar-file (format "target/%s-%s.jar" (name lib) version))
(defn compile [_]
(b/javac {:src-dirs ["java"]
:class-dir class-dir
:basis basis
;;:javac-opts ["-source" "8" "-target" "8"]
}))
(defn test "Run the tests." [opts]
(bb/run-tests opts))
(defn- pom-template []
[[:description "xgboost models for metamorph.ml and scicloj.ml"]
[:url "https://github.com/scicloj/scicloj.ml.xgboost"]
[:licenses
[:license
[:name "Eclipse Public License - v 1.0"]
[:url "https://www.eclipse.org/legal/epl-1.0/"]]]
[:scm
[:url "https://github.com/scicloj/scicloj.ml.xgboost"]
[:connection "scm:git:https://github.com/scicloj/scicloj.ml.xgboost.git"]
[:developerConnection "scm:git:https://github.com/scicloj/scicloj.ml.xgboost.git"]
[:tag (str "v" version)]]])
(defn- jar-opts [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"]
:pom-data (pom-template)))
(defn jar [_]
(compile nil)
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src"]
:pom-data (pom-template)})
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file (:jar-file (jar-opts {}))}))
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
(-> opts
(assoc :lib lib :version version
:aliases [:run-tests])
(test)
(bb/clean)
(jar)))
(defn install "Install the JAR locally." [opts]
(-> opts
(assoc :lib lib :version version)
(bb/install)))
;; (defn deploy "Deploy the JAR to Clojars." [opts]
;; (-> opts
;; (assoc :lib lib :version version)
;; (bb/deploy)))
(defn deploy "Deploy the JAR to Clojars." [opts]
(let [{:keys [jar-file] :as opts} (jar-opts opts)]
(dd/deploy {:installer :remote :artifact (b/resolve-path jar-file)
:pom-file (b/pom-path (select-keys opts [:lib :class-dir]))}))
opts)