-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.clj
95 lines (79 loc) · 2.95 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
92
93
94
95
(ns build
(:refer-clojure :exclude [test])
(:require
[camel-snake-kebab.core :as csk]
[clj-yaml.core :as yaml]
[clojure.java.io :as io]
[clojure.pprint :as pp]
[clojure.tools.build.api :as b] ; for b/git-count-revs
[org.corfield.build :as bb]))
(def lib 'org.scicloj/metamorph.ml)
; alternatively, use MAJOR.MINOR.COMMITS:
;; (def version (format "6.2.%s" (b/git-count-revs nil)))
(def version "0.9.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 test "Run the tests." [opts]
(-> opts
(assoc :aliases [:runner])
(bb/run-tests)))
(defn- pom-template [version]
[[:description "Machine learning functions for tech.ml.dataset"]
[:url "https://github.com/scicloj/metamorph.ml"]
[:licenses
[:license
[:name "Eclipse Public License"]
[:url "http://www.eclipse.org/legal/epl-v10.html"]]]
[:developers
[:developer
[:name "Carsten Behring"]]]
[:scm
[:url "https://github.com/scicloj/metamorph.ml"]
[:connection "scm:git:https://github.com/scicloj/metamorph.ml.git"]
[:developerConnection "scm:git:https://github.com/scicloj/metamorph.ml.git"]
[:tag (str "v" version)]]])
(defn jar [_]
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:pom-data (pom-template version)
:src-dirs ["src"]})
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
(-> opts
(assoc :lib lib :version version
:aliases [:runner])
(bb/run-tests)
(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 build-glance-columns [ops]
(with-open [w (io/writer "resources/columms-glance.edn")]
(-> (slurp "https://raw.githubusercontent.com/alexpghayes/modeltests/main/data-raw/columns_glance.yaml")
(yaml/parse-string
:key-fn #(-> % :key csk/->kebab-case-keyword))
(pp/pprint w))))
(defn build-tidy-columns [opts]
(with-open [w (io/writer "resources/columms-tidy.edn")]
(-> (slurp "https://raw.githubusercontent.com/alexpghayes/modeltests/main/data-raw/columns_tidy.yaml")
(yaml/parse-string
:key-fn #(-> % :key csk/->kebab-case-keyword))
(pp/pprint w))))
(defn build-augment-columns [ops]
(with-open [w (io/writer "resources/columms-augment.edn")]
(-> (slurp "https://raw.githubusercontent.com/alexpghayes/modeltests/main/data-raw/columns_augment.yaml")
(yaml/parse-string
:key-fn #(-> % :key csk/->kebab-case-keyword))
(pp/pprint w))))