diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2023-06-22 19:45:32 +0200 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2023-06-22 19:45:58 +0200 |
commit | cc7d14514cada7a81d72612d612889b8c6f2e59e (patch) | |
tree | cfa12d7e43befe513bce3eeb77c044ceb6c63c1b | |
parent | c794f2d1c433d6762333bfa2a65f71b484ebe095 (diff) |
feat: Add tools.build script
-rw-r--r-- | build.clj | 36 | ||||
-rw-r--r-- | deps.edn | 4 |
2 files changed, 39 insertions, 1 deletions
diff --git a/build.clj b/build.clj new file mode 100644 index 0000000..02ca14e --- /dev/null +++ b/build.clj @@ -0,0 +1,36 @@ +(ns build + (:require + [shadow.cljs.devtools.api :as shadow] + [clojure.tools.build.api :as b])) + +(def lib 'tubo) +(def version (format "0.1.%s" (b/git-count-revs nil))) +(def class-dir "target/classes") +(def basis (b/create-basis {:project "deps.edn"})) +(def uber-file (format "target/%s-%s.jar" (name lib) version)) + +(defn clean [_] + (b/delete {:path "target"})) + +(defn aot-compile [_] + (println "Compiling AOT namespaces...") + (b/compile-clj {:basis basis + :src-dir ["src"] + :class-dir class-dir + :ns-compile ['tubo.downloader-impl]}) + (println "Compiled AOT namespaces")) + +(defn uberjar [_] + (clean nil) + (aot-compile nil) + (b/copy-dir {:src-dirs ["src/clj" "resources"] + :target-dir class-dir}) + (b/compile-clj {:basis basis + :src-dir ["src"] + :class-dir class-dir}) + (shadow/release :tubo) + (b/uber {:class-dir class-dir + :uber-file uber-file + :basis basis + :main 'tubo.core}) + (println "Uberjar: " uber-file)) @@ -13,7 +13,9 @@ :paths ["src/backend" "resources" "classes"] :mvn/repos {"jitpack" {:url "https://jitpack.io"}} :aliases - {:frontend + {:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.4"}} + :ns-default build} + :frontend {:extra-paths ["src/frontend"] :extra-deps {thheller/shadow-cljs {:mvn/version "2.20.1"} cider/cider-nrepl {:mvn/version "0.28.4"} |