2021-08-13 02:20:02 +00:00
|
|
|
(ns build
|
|
|
|
|
"HoneySQL's build script.
|
|
|
|
|
|
|
|
|
|
clojure -T:build run-tests
|
|
|
|
|
clojure -T:build run-tests :aliases '[:master]'
|
|
|
|
|
|
|
|
|
|
clojure -T:build ci
|
|
|
|
|
|
|
|
|
|
For more information, run:
|
|
|
|
|
|
|
|
|
|
clojure -A:deps -T:build help/doc"
|
2021-08-28 21:04:36 +00:00
|
|
|
|
2021-08-31 01:08:28 +00:00
|
|
|
(:require [clojure.tools.build.api :as b]
|
|
|
|
|
[org.corfield.build :as bb]))
|
2021-08-13 02:20:02 +00:00
|
|
|
|
|
|
|
|
(def lib 'com.github.seancorfield/honeysql)
|
|
|
|
|
(def version (format "2.0.%s" (b/git-count-revs nil)))
|
|
|
|
|
|
2021-08-28 05:51:49 +00:00
|
|
|
(defn eastwood "Run Eastwood." [opts]
|
|
|
|
|
(-> opts (bb/run-task [:eastwood])))
|
2021-08-13 02:20:02 +00:00
|
|
|
|
2021-08-31 01:08:28 +00:00
|
|
|
(defn gen-doc-tests "Generate tests from doc code blocks." [opts]
|
|
|
|
|
(-> opts (bb/run-task [:gen-doc-tests])))
|
2021-08-13 02:20:02 +00:00
|
|
|
|
2021-08-27 22:16:18 +00:00
|
|
|
(defn run-doc-tests
|
2021-08-28 21:04:36 +00:00
|
|
|
"Generate and run doc tests.
|
2021-08-27 22:16:18 +00:00
|
|
|
|
2021-08-28 21:04:36 +00:00
|
|
|
Optionally specify :plaftorm:
|
2021-08-27 22:16:18 +00:00
|
|
|
:1.9 -- test against Clojure 1.9 (the default)
|
|
|
|
|
:1.10 -- test against Clojure 1.10.3
|
|
|
|
|
:master -- test against Clojure 1.11 master snapshot
|
|
|
|
|
:cljs -- test against ClojureScript"
|
|
|
|
|
[{:keys [platform] :or {platform :1.9} :as opts}]
|
|
|
|
|
(gen-doc-tests opts)
|
2021-08-28 21:04:36 +00:00
|
|
|
(bb/run-tests (assoc opts :aliases
|
|
|
|
|
(conj [:test-doc platform]
|
|
|
|
|
(if (= :cljs platform)
|
|
|
|
|
:test-doc-cljs
|
|
|
|
|
:test-doc-clj)))))
|
2021-08-27 22:16:18 +00:00
|
|
|
|
2021-08-13 02:20:02 +00:00
|
|
|
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
|
|
|
|
|
(-> opts
|
2021-08-28 21:04:36 +00:00
|
|
|
(bb/clean)
|
2021-08-28 05:51:49 +00:00
|
|
|
(assoc :lib lib :version version)
|
2021-08-27 22:16:18 +00:00
|
|
|
(as-> opts
|
2021-08-28 21:04:36 +00:00
|
|
|
(reduce (fn [opts platform]
|
|
|
|
|
(run-doc-tests (assoc opts :platform platform)))
|
|
|
|
|
opts
|
|
|
|
|
[:cljs :1.9 :1.10 :master]))
|
2021-08-13 02:20:02 +00:00
|
|
|
(eastwood)
|
|
|
|
|
(as-> opts
|
|
|
|
|
(reduce (fn [opts alias]
|
2021-08-28 05:51:49 +00:00
|
|
|
(bb/run-tests (assoc opts :aliases [alias])))
|
2021-08-13 02:20:02 +00:00
|
|
|
opts
|
2021-08-13 02:21:35 +00:00
|
|
|
[:cljs :1.9 :1.10 :master]))
|
2021-08-28 05:51:49 +00:00
|
|
|
(bb/clean)
|
|
|
|
|
(bb/jar)))
|
2021-08-23 02:30:04 +00:00
|
|
|
|
|
|
|
|
(defn deploy "Deploy the JAR to Clojars." [opts]
|
2021-08-28 05:51:49 +00:00
|
|
|
(-> opts
|
|
|
|
|
(assoc :lib lib :version version)
|
|
|
|
|
(bb/deploy)))
|