Skip to content

Instantly share code, notes, and snippets.

@erp12
Created Aug 5, 2021
Embed
What would you like to do?
tools.build with multiple basis to control classes that end up in uberjar
(ns build
(:require [clojure.tools.build.api :as b]))
(def lib 'com.nortia-solutions/ppi-core)
(def version "0.0.1")
(def class-dir "target/classes")
(def uber-file (format "target/%s-%s-standalone.jar" (name lib) version))
(def full-basis
(b/create-basis {:project "deps.edn"
:aliases [:spark :clark/repl]}))
(def jar-basis
(b/create-basis {:project "deps.edn"}))
;; Entry ;;;;;;;;;;
(defn clean
[_]
(b/delete {:path "target"}))
(defn prep
[_]
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis jar-basis
:src-dirs ["src"]})
(b/copy-dir {:src-dirs ["src"]
:target-dir class-dir}))
(defn uber [_]
(println "Compiling")
(b/compile-clj {:basis full-basis
:src-dirs ["src"]
:class-dir class-dir})
(println "Creating Jar")
(b/uber {:class-dir class-dir
:uber-file uber-file
:basis jar-basis}))
(defn all
[opts]
(println "Cleaning")
(clean nil)
(println "Preparing")
(prep nil)
(println "Assembling")
(uber nil))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment