build.clj 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. (ns build
  2. (:require
  3. [shadow.cljs.devtools.api :as shadow]
  4. [clojure.tools.build.api :as b]))
  5. (def lib 'tubo)
  6. (def version (format "0.1.%s" (b/git-count-revs nil)))
  7. (def class-dir "target/classes")
  8. (def basis (b/create-basis {:project "deps.edn"}))
  9. (def uber-file (format "target/%s-%s.jar" (name lib) version))
  10. (defn clean [_]
  11. (b/delete {:path "target"}))
  12. (defn aot-compile [_]
  13. (println "Compiling AOT namespaces...")
  14. (b/compile-clj {:basis basis
  15. :src-dir ["src"]
  16. :class-dir class-dir
  17. :ns-compile ['tubo.downloader-impl]})
  18. (println "Compiled AOT namespaces"))
  19. (defn uberjar [_]
  20. (clean nil)
  21. (aot-compile nil)
  22. (b/copy-dir {:src-dirs ["src/clj" "resources"]
  23. :target-dir class-dir})
  24. (b/compile-clj {:basis basis
  25. :src-dir ["src"]
  26. :class-dir class-dir})
  27. (shadow/release :tubo)
  28. (b/uber {:class-dir class-dir
  29. :uber-file uber-file
  30. :basis basis
  31. :main 'tubo.core})
  32. (println "Uberjar: " uber-file))