catch exceptions hook, line, and sinker

Move to clein

+10 -72
-69
build.clj
··· 1 - (ns build 2 - (:refer-clojure :exclude [test]) 3 - (:require [clojure.tools.build.api :as b] 4 - [deps-deploy.deps-deploy :as dd])) 5 - 6 - (def lib 'net.clojars.noahtheduke/sinker) 7 - (def version "0.1.0-SNAPSHOT") 8 - #_ ; alternatively, use MAJOR.MINOR.COMMITS: 9 - (def version (format "1.0.%s" (b/git-count-revs nil))) 10 - (def class-dir "target/classes") 11 - 12 - (defn test "Run all the tests." [opts] 13 - (let [basis (b/create-basis {:aliases [:test]}) 14 - cmds (b/java-command 15 - {:basis basis 16 - :main 'clojure.main 17 - :main-args ["-m" "lazytest.main"]}) 18 - {:keys [exit]} (b/process cmds)] 19 - (when-not (zero? exit) (throw (ex-info "Tests failed" {})))) 20 - opts) 21 - 22 - (defn- pom-template [version] 23 - [[:description "FIXME: my new library."] 24 - [:url "https://github.com/noahtheduke/sinker"] 25 - [:licenses 26 - [:license 27 - [:name "Eclipse Public License"] 28 - [:url "http://www.eclipse.org/legal/epl-v10.html"]]] 29 - [:developers 30 - [:developer 31 - [:name "Noah"]]] 32 - [:scm 33 - [:url "https://github.com/noahtheduke/sinker"] 34 - [:connection "scm:git:https://github.com/noahtheduke/sinker.git"] 35 - [:developerConnection "scm:git:ssh:git@github.com:noahtheduke/sinker.git"] 36 - [:tag (str "v" version)]]]) 37 - 38 - (defn- jar-opts [opts] 39 - (assoc opts 40 - :lib lib :version version 41 - :jar-file (format "target/%s-%s.jar" lib version) 42 - :basis (b/create-basis {}) 43 - :class-dir class-dir 44 - :target "target" 45 - :src-dirs ["src"] 46 - :pom-data (pom-template version))) 47 - 48 - (defn ci "Run the CI pipeline of tests (and build the JAR)." [opts] 49 - (test opts) 50 - (b/delete {:path "target"}) 51 - (let [opts (jar-opts opts)] 52 - (println "\nWriting pom.xml...") 53 - (b/write-pom opts) 54 - (println "\nCopying source...") 55 - (b/copy-dir {:src-dirs ["resources" "src"] :target-dir class-dir}) 56 - (println "\nBuilding JAR..." (:jar-file opts)) 57 - (b/jar opts)) 58 - opts) 59 - 60 - (defn install "Install the JAR locally." [opts] 61 - (let [opts (jar-opts opts)] 62 - (b/install opts)) 63 - opts) 64 - 65 - (defn deploy "Deploy the JAR to Clojars." [opts] 66 - (let [{:keys [jar-file] :as opts} (jar-opts opts)] 67 - (dd/deploy {:installer :remote :artifact (b/resolve-path jar-file) 68 - :pom-file (b/pom-path (select-keys opts [:lib :class-dir]))})) 69 - opts)
+10 -3
deps.edn
··· 26 26 27 27 :runner {:main-opts ["-m" "lazytest.main"]} 28 28 29 - :build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.9"} 30 - slipset/deps-deploy {:mvn/version "0.2.2"}} 31 - :ns-default build}}} 29 + :clein {:deps {io.github.noahtheduke/clein {:mvn/version "0.5.0"}} 30 + :main-opts ["-m" "noahtheduke.clein"]} 31 + :clein/build {:lib noahtheduke.sinker 32 + :main noahtheduke.sinker 33 + :version "resources/SINKER_VERSION" 34 + :url "https://tangled.sh/@noahbogart.com/sinker" 35 + :license {:name "MPL-2.0" 36 + :url "https://mozilla.org/MPL/2.0"} 37 + :src-dirs ["src"] 38 + :resource-dirs ["resources"]}}}