-
Notifications
You must be signed in to change notification settings - Fork 2
/
bb.edn
38 lines (37 loc) · 1.65 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
{:tasks
{:requires ([babashka.fs :as fs])
:init (do
(def libsci (str (first (fs/glob "clj" "LibScimacs.{dylib,lib,so}"))))
(def lib-ext (fs/extension libsci))
(def local-lib (str "scimacs." lib-ext))
(def uberjar "clj/target/uber.jar")
(def rust-lib (str "target/debug/libscimacs." lib-ext)))
javac {:doc "Build libscimacs's JVM bytecode"
:task (when (seq (fs/modified-since uberjar ["clj/src" "clj/build.clj" "clj/deps.edn"]))
(clojure
{:dir "clj"} "-T:build libscimacs"))}
native-image {:doc "Build native-image"
:depends [javac]
:task (when (seq (fs/modified-since libsci uberjar))
(shell
{:dir "clj"}
"native-image"
"-cp" "target/uber.jar"
"--shared"
"-H:Name=LibScimacs"
"--enable-preview"
"-H:+ReportExceptionStackTraces"
"-J-Dclojure.spec.skip-macros=true"
"-J-Dclojure.compiler.direct-linking=true"
"--verbose"
"--no-fallback"
"--no-server"
"-J-Xmx3g"))}
rustc {:doc "Build Rust binary"
:depends [native-image]
:task (when (seq (fs/modified-since rust-lib [libsci "src" "Cargo.toml"]))
(shell "cargo build"))}
all {:doc "Build all"
:depends [rustc]
:task (when-not (fs/exists? local-lib)
(fs/create-sym-link local-lib rust-lib))}}}