-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.boot
More file actions
197 lines (164 loc) · 8.57 KB
/
build.boot
File metadata and controls
197 lines (164 loc) · 8.57 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
(set-env!
:dependencies '[[nrepl "0.8.3" :scope "test"]
[org.slf4j/slf4j-nop "1.7.13" :scope "test"]
[adzerk/boot-jar2bin "1.2.0" :scope "test"]
[adzerk/boot-reload "0.6.1" :scope "test"]
;; [javax.inject/javax.inject "1" :scope "provided"]
;; [org.eclipse.sisu/org.eclipse.sisu.inject "0.3.4" :scope "provided"]
;; Client and server
#_[org.clojure/core.async "1.3.610"]
[org.clojure/data.xml "0.0.8"]
[org.slf4j/slf4j-simple "1.7.5"]
[juji/editscript "0.5.4"]
;; Server-side dependencies
[org.clojure/clojure "1.10.3"]
[ns-tracker "0.4.0"]
[potemkin "0.4.3"]
;; Git
]
:repositories #(conj %
'["artifactory.openntf.org" {:url "https://artifactory.openntf.org/openntf"}]
'["eclipse.org.p2" {:url "http://download.eclipse.org/releases/2021-09"
:layout "p2"}])
:source-paths #{"src" "test" "resources"}
:resource-paths #{"src" "resources" "lib"})
(require
'[boot.pod :as pod]
'[boot.task.built-in :refer :all]
'[adzerk.boot-jar2bin :refer :all]
'[boot.core :as boot]
'[clojure.java.io :as io]
'[adzerk.boot-reload :refer [reload]])
(task-options!
pom {:project 'insideout
:version "0.1.0"})
(deftask ui-scale [m multiplier VAL str "The user interface scale multiplier for Swing and JavaFX"]
(System/setProperty "sun.java2d.uiScale" multiplier)
(System/setProperty "glass.gtk.uiScale" multiplier)
identity)
(deftask cider
"Add dependencies for development tools that expect Cider/IDE middleware in the REPL."
[]
(require 'boot.repl)
(swap! @(resolve 'boot.repl/*default-dependencies*)
concat '[[cider/cider-nrepl "0.27.2"]
[refactor-nrepl "3.0.0"]])
(swap! @(resolve 'boot.repl/*default-middleware*)
concat '[cider.nrepl/cider-middleware
refactor-nrepl.middleware/wrap-refactor])
identity)
(deftask reveal
"Make the repl display a 'reveal' data browser"
[]
#_(System/setProperty "vlaaad.reveal.prefs" ":theme :dark")
(require 'boot.repl)
(swap! @(resolve 'boot.repl/*default-dependencies*)
concat '[[vlaaad/reveal "1.3.196"]
[lambdaisland/deep-diff2 "2.0.108"]])
(swap! @(resolve 'boot.repl/*default-middleware*)
concat '[vlaaad.reveal.nrepl/middleware])
identity)
(deftask kaocha
"Run tests with Kaocha."
[c config-file FILE file "Config file to read."
H test-help bool "Display Kaocha-boot usage information."
_ print-config bool "Print out the fully merged and normalized config, then exit."
_ print-test-plan bool "Load tests, build up a test plan, then print out the test plan and exit."
_ print-result bool "Print the test result map as returned by the Kaocha API."
_ fail-fast bool "Stop testing after the first failure."
_ color bool "Enable ANSI color codes in output."
_ no-color bool "Disable ANSI color codes in output."
_ watch bool "Watch filesystem for changes and re-run tests."
_ no-watch bool "Don't watch filesystem for changes."
_ reporter SYMBOL sym "Change the test reporter, can be specified multiple times."
_ plugin KEYWORD [kw] "Load the given plugins."
_ version bool "Print version information and quit."
s suite KEYWORD [kw] "Test suite(s) to run."
o options EDN edn "Extra command line flags"]
(let [deps '[[lambdaisland/kaocha "1.0.829" :exclusions [org.clojure/clojure]]
[lambdaisland/kaocha-cucumber "0.0-53"]
[lambdaisland/kaocha-cloverage "1.0.75"]]
;; Turn the middleware symbols into strings to prevent an attempt to
;; resolve the namespaces when the list is processed in the Boot pod.
;; Boot's middleware configuration is read outside of the pod to ensure
;; that the user-specific Boot configuration is also captured.
middlewares (conj (map str @@(resolve 'boot.repl/*default-middleware*)) 'list)
pod (pod/make-pod (update-in (boot/get-env) [:dependencies]
into deps))
test! (fn []
(pod/with-eval-in pod
(require '[kaocha.config :as config]
'[kaocha.plugin :as plugin]
'[kaocha.api :as api]
'[kaocha.jit :refer [jit]]
'[kaocha.runner :as runner]
'[kaocha.classpath :as classpath]
'[clojure.set :as set]
'[clojure.string :as str]
'[clojure.tools.cli :as cli]
'[slingshot.slingshot :refer [try+]])
(defn plugin-option-summary [specs]
(apply str
"\n"
" -o, --options EDN EDN map of additional options.\n\n"
"Plugin-specific options can be specified using map syntax, e.g.\n\n"
" boot kaocha --options '{:randomize false}'\n\n"
"These additional options are recognized:\n\n"
(interpose "\n"
(map (fn [{:keys [id required desc]}]
(format " %-30s %s" (str id " " (or required "BOOL")) desc))
(#'cli/compile-option-specs specs)))))
(try+
(with-redefs [classpath/add-classpath boot.pod/add-classpath]
(let [options (merge (cond-> ~*opts*
~no-color (assoc :color false)
~no-watch (assoc :watch false)
:always (dissoc :no-color :no-watch))
~options)
config (config/load-config (:config-file options "tests.edn"))
plugin-chain (plugin/load-all (concat (:kaocha/plugins config) ~plugin))
plugin-options (plugin/run-hook* plugin-chain :kaocha.hooks/cli-options [])
{:keys [summary]} (cli/parse-opts [] @#'runner/cli-options)
config (-> config
(config/apply-cli-opts options)
(config/apply-cli-args ~suite))
exit-code
(plugin/with-plugins plugin-chain
(runner/run {:config config
:options options
:summary (str "USAGE:\n\nboot kaocha [OPTIONS]...\n\n"
" -s, --suite SUITE Test suite(s) to run.\n"
summary (plugin-option-summary plugin-options))
:suites ~suite}))]
(when (not= 0 exit-code)
(System/exit exit-code))))
(catch :kaocha/early-exit {exit-code :kaocha/early-exit}
(when (not= 0 exit-code)
(System/exit exit-code))))))]
(boot/with-pre-wrap fileset
(test!)
fileset)))
(deftask dev
"Build for local development."
[]
(comp
(cider)
(watch)
(notify :audible true :visual true :theme "woodblock")
(javac)
(kaocha)
(reload)
(repl
:port 8008
:server true
:init-ns 'insideout.core
:eval '(-main))))
(deftask prod
"Build for production deployment."
[]
(comp #_(aot :namespace #{'insideout.boot})
(javac)
(pom)
(uber)
(jar :main 'loader.Main :file "io.jar")
(bin :output-dir "bin")))