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"
(:refer-clojure :exclude [test])
(: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)
(defn- the-version [patch] (format "1.3.%s" patch))
(def version (the-version (b/git-count-revs nil)))
(def snapshot (the-version "999-SNAPSHOT"))
(def class-dir "target/classes")
(defn test "Run all the tests." [opts]
(reduce (fn [opts alias]
(bb/run-tests (assoc opts :aliases [alias])))
opts
[:1.10 :1.11 :master])
(doseq [alias [:1.10 :1.11 :master]]
(println "\nRunning tests for Clojure" (name alias))
(let [basis (b/create-basis {:aliases [:test alias]})
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)
(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]
(-> opts
(assoc :lib lib :version (if (:snapshot opts) snapshot version))
(test)
(bb/clean)
(assoc :src-pom "template/pom.xml")
(bb/jar)))
(test opts)
(b/delete {:path "target"})
(let [opts (jar-opts opts)]
(println "\nWriting pom.xml...")
(b/write-pom opts)
(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]
(-> opts
(assoc :lib lib :version (if (:snapshot opts) snapshot version))
(bb/deploy)))
(let [{:keys [jar-file] :as opts} (jar-opts opts)]
(dd/deploy {:installer :remote :artifact (b/resolve-path jar-file)
: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"}}
:aliases
{;; for help: clojure -A:deps -T:build help/doc
:build {:deps {io.github.seancorfield/build-clj
{:git/tag "v0.8.3" :git/sha "7ac1f8d"}}
:build {:deps {io.github.clojure/tools.build
{:git/tag "v0.9.2" :git/sha "fe6b140"}
slipset/deps-deploy {:mvn/version "0.2.0"}}
:ns-default build}
;; versions to test against:
@ -41,11 +42,11 @@
com.microsoft.sqlserver/mssql-jdbc {:mvn/version "11.2.0.jre11"}
;; supplementary test stuff
;; 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:
org.apache.logging.log4j/log4j-1.2-api {:mvn/version "2.18.0"}
org.apache.logging.log4j/log4j-jcl {:mvn/version "2.18.0"}
org.apache.logging.log4j/log4j-jul {:mvn/version "2.18.0"}
org.apache.logging.log4j/log4j-slf4j-impl {: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.19.0"}
org.apache.logging.log4j/log4j-jul {:mvn/version "2.19.0"}
org.apache.logging.log4j/log4j-slf4j-impl {:mvn/version "2.19.0"}}
:jvm-opts ["-Dlog4j2.configurationFile=log4j2-info.properties"]
:exec-fn cognitect.test-runner.api/test}}}