Skip to content

Instantly share code, notes, and snippets.

@holyjak
Last active October 2, 2023 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holyjak/a5e02ef7a3e598790ecec092ebd6a386 to your computer and use it in GitHub Desktop.
Save holyjak/a5e02ef7a3e598790ecec092ebd6a386 to your computer and use it in GitHub Desktop.
;; Based on https://github.com/borkdude/fly_io_clojure
(ns build
(:require [clojure.tools.build.api :as b]))
(def lib 'cz.holyjak.rohan-erp/app)
(def version "0.0.1")
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def uber-file (format "target/%s-%s-standalone.jar" (name lib) version))
(def jar-file (format "target/%s-%s.jar" (name lib) version))
(defn clean [_]
(b/delete {:path "target"}))
(defn jar [_]
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src"]})
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))
(defn uber [_]
(clean nil)
(b/copy-dir {:src-dirs ["src/main" "resources"]
:target-dir class-dir})
;; NOTE: Can comment out compilation to skip AOT => be much faster
;; (but then we must start via `clojure.main -m <ns>`)
;#_ ; let's skip AOT for now...
(b/compile-clj {:basis basis
:src-dirs ["src/main"]
:class-dir class-dir
:ns-compile '[cz.rohan-erp.components.server]})
(b/uber {:class-dir class-dir
:uber-file uber-file
:basis basis
:main 'cz.rohan-erp.components.server})
(println "Uberjar written to" uber-file))
{:about "clojurescript file"}
(str "This is " #?(:clj "Clojure" :cljs "ClojureScript") " file")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment