-
Notifications
You must be signed in to change notification settings - Fork 2
/
bb.edn
73 lines (66 loc) · 2.49 KB
/
bb.edn
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
{:paths ["."]
:tasks
{:requires ([babashka.fs :as fs]
[babashka.tasks :as tasks]
[build-shared :as bs]
[clojure.string :as str])
:init
(do
(def windows? (str/starts-with? (System/getProperty "os.name")
"Windows"))
(defn clojure
"Clojure defaulting to stderr output"
[opts & args]
(let [[opts args] (if (map? opts)
[opts args]
[nil (cons opts args)])
[arg & args] args]
(apply tasks/clojure opts (str "-J-Dclojure.main.report=stderr " arg) args))))
uber {:doc "Build uberjar for testing"
:task (let [uber-file (str "output-" bs/graalvm-version ".jar")]
(clojure {:dir bs/dir} "-T:build uber" {:uber-file uber-file})
uber-file)}
graalvm {:doc "Checks GRAALVM_HOME env var"
:task
(let [env (System/getenv "GRAALVM_HOME")]
(assert env "Set GRAALVM_HOME")
env)}
native-image
{:doc "Builds native image"
:depends [graalvm uber]
:task (do (apply shell {:dir bs/dir}
(str (fs/file graalvm
"bin"
(if windows?
"native-image.cmd"
"native-image")))
"-jar" uber
(concat
["--initialize-at-build-time=example"
"--verbose"
"--no-fallback"
"--no-server"
"-J-Dclojure.spec.skip.macros=true"
"-J-Dclojure.compiler.direct-linking=true"
"-J-Xmx8g"
"-Ob"
"-H:+ReportExceptionStackTraces"
"-H:Name=native-test"]
(or (:flags (read-string (slurp (str bs/dir "/deps.edn")))) []))))}
native-image-test
{:doc "Run integration test"
:depends [native-image]
:task (shell {:dir bs/dir}
(if windows?
"./native-test.exe"
"./native-test"))}
recipe
{:task
(do
(let [lib-dir (fs/file "config" bs/org bs/lib)
conf-dir (fs/file lib-dir "resources" "META-INF" "native-image" bs/org bs/lib)]
(fs/create-dirs conf-dir)
(fs/copy-tree "recipe" lib-dir {:replace-existing true})
(spit (fs/file conf-dir "native-image.properties") "")))}
,}
,}