build.clj 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. [_]
  12. (b/delete {:path "target"}))
  13. (defn aot-compile
  14. [_]
  15. (println "Compiling AOT namespaces...")
  16. (b/compile-clj {:basis basis
  17. :src-dir ["src"]
  18. :class-dir class-dir
  19. :ns-compile ['tubo.downloader-impl]})
  20. (println "Compiled AOT namespaces"))
  21. (defn uberjar
  22. [_]
  23. (clean nil)
  24. (aot-compile nil)
  25. (b/copy-dir {:src-dirs ["src/clj" "resources"]
  26. :target-dir class-dir})
  27. (b/compile-clj {:basis basis
  28. :src-dir ["src"]
  29. :class-dir class-dir})
  30. (shadow/release :tubo)
  31. (b/uber {:class-dir class-dir
  32. :uber-file uber-file
  33. :basis basis
  34. :main 'tubo.core})
  35. (println "Uberjar: " uber-file))