drop use of build-clj; update deps

This commit is contained in:
Sean Corfield 2023-01-23 22:57:42 -08:00
parent 7fca17e7d2
commit 482b26ade7
2 changed files with 48 additions and 21 deletions

View file

@ -12,29 +12,55 @@
clojure -A:deps -T:build help/doc" clojure -A:deps -T:build help/doc"
(:refer-clojure :exclude [test]) (:refer-clojure :exclude [test])
(:require [clojure.tools.build.api :as b] (:require [clojure.tools.build.api :as b]
[org.corfield.build :as bb])) [clojure.tools.deps :as t]
[deps-deploy.deps-deploy :as dd]))
(def lib 'com.github.seancorfield/next.jdbc) (def lib 'com.github.seancorfield/next.jdbc)
(defn- the-version [patch] (format "1.3.%s" patch)) (defn- the-version [patch] (format "1.3.%s" patch))
(def version (the-version (b/git-count-revs nil))) (def version (the-version (b/git-count-revs nil)))
(def snapshot (the-version "999-SNAPSHOT")) (def snapshot (the-version "999-SNAPSHOT"))
(def class-dir "target/classes")
(defn test "Run all the tests." [opts] (defn test "Run all the tests." [opts]
(reduce (fn [opts alias] (doseq [alias [:1.10 :1.11 :master]]
(bb/run-tests (assoc opts :aliases [alias]))) (println "\nRunning tests for Clojure" (name alias))
opts (let [basis (b/create-basis {:aliases [:test alias]})
[:1.10 :1.11 :master]) combined (t/combine-aliases basis [:test alias])
cmds (b/java-command
{:basis basis
:java-opts (:java-opts combined)
:main 'clojure.main
:main-args ["-m" "cognitect.test-runner"]})
{:keys [exit]} (b/process cmds)]
(when-not (zero? exit) (throw "Tests failed"))))
opts) opts)
(defn- jar-opts [opts]
(let [version (if (:snapshot opts) snapshot version)]
(assoc opts
:lib lib :version version
:jar-file (format "target/%s-%s.jar" lib version)
:scm {:tag (str "v" version)}
:basis (b/create-basis {})
:class-dir class-dir
:target "target"
:src-dirs ["src"]
:src-pom "template/pom.xml")))
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts] (defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
(-> opts (test opts)
(assoc :lib lib :version (if (:snapshot opts) snapshot version)) (b/delete {:path "target"})
(test) (let [opts (jar-opts opts)]
(bb/clean) (println "\nWriting pom.xml...")
(assoc :src-pom "template/pom.xml") (b/write-pom opts)
(bb/jar))) (println "\nCopying source...")
(b/copy-dir {:src-dirs ["resources" "src"] :target-dir class-dir})
(println "\nBuilding JAR...")
(b/jar opts))
opts)
(defn deploy "Deploy the JAR to Clojars." [opts] (defn deploy "Deploy the JAR to Clojars." [opts]
(-> opts (let [{:keys [jar-file] :as opts} (jar-opts opts)]
(assoc :lib lib :version (if (:snapshot opts) snapshot version)) (dd/deploy {:installer :remote :artifact (b/resolve-path jar-file)
(bb/deploy))) :pom-file (b/pom-path (select-keys opts [:lib :class-dir]))}))
opts)

View file

@ -6,8 +6,9 @@
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.3"}} camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.3"}}
:aliases :aliases
{;; for help: clojure -A:deps -T:build help/doc {;; for help: clojure -A:deps -T:build help/doc
:build {:deps {io.github.seancorfield/build-clj :build {:deps {io.github.clojure/tools.build
{:git/tag "v0.8.3" :git/sha "7ac1f8d"}} {:git/tag "v0.9.2" :git/sha "fe6b140"}
slipset/deps-deploy {:mvn/version "0.2.0"}}
:ns-default build} :ns-default build}
;; versions to test against: ;; versions to test against:
@ -41,11 +42,11 @@
com.microsoft.sqlserver/mssql-jdbc {:mvn/version "11.2.0.jre11"} com.microsoft.sqlserver/mssql-jdbc {:mvn/version "11.2.0.jre11"}
;; supplementary test stuff ;; supplementary test stuff
;; use log4j 2.x: ;; use log4j 2.x:
org.apache.logging.log4j/log4j-api {:mvn/version "2.18.0"} org.apache.logging.log4j/log4j-api {:mvn/version "2.19.0"}
;; bridge into log4j: ;; bridge into log4j:
org.apache.logging.log4j/log4j-1.2-api {:mvn/version "2.18.0"} org.apache.logging.log4j/log4j-1.2-api {:mvn/version "2.19.0"}
org.apache.logging.log4j/log4j-jcl {:mvn/version "2.18.0"} org.apache.logging.log4j/log4j-jcl {:mvn/version "2.19.0"}
org.apache.logging.log4j/log4j-jul {:mvn/version "2.18.0"} org.apache.logging.log4j/log4j-jul {:mvn/version "2.19.0"}
org.apache.logging.log4j/log4j-slf4j-impl {:mvn/version "2.18.0"}} org.apache.logging.log4j/log4j-slf4j-impl {:mvn/version "2.19.0"}}
:jvm-opts ["-Dlog4j2.configurationFile=log4j2-info.properties"] :jvm-opts ["-Dlog4j2.configurationFile=log4j2-info.properties"]
:exec-fn cognitect.test-runner.api/test}}} :exec-fn cognitect.test-runner.api/test}}}