|
3 | 3 | #_{:local/root "../../quickdoc"}
|
4 | 4 | {:git/url "https://github.com/borkdude/quickdoc"
|
5 | 5 | :git/sha "32e726cd6d785d00e49d4e614a05f7436d3831c0"}
|
6 |
| - org.clj-commons/digest {:mvn/version "1.4.100"} } |
| 6 | + org.clj-commons/digest {:mvn/version "1.4.100"}} |
| 7 | + |
7 | 8 | :tasks
|
8 |
| - {:requires ([babashka.fs :as fs]) |
| 9 | + {:requires ([babashka.cli :as cli] |
| 10 | + [babashka.fs :as fs]) |
| 11 | + :init (do |
| 12 | + (def shell-opts {:extra-env |
| 13 | + {(if (fs/windows?) "Path" "PATH") |
| 14 | + (str (fs/canonicalize "target/test/on-path") fs/path-separator (System/getenv "PATH"))}}) |
| 15 | + (defn parse-repl-args [args] |
| 16 | + (let [cli-spec {:spec |
| 17 | + {:host {:desc "Bind to host (use 0.0.0.0 to allow anyone to connect)" |
| 18 | + :alias :h |
| 19 | + :default "localhost"}} |
| 20 | + :restrict true}] |
| 21 | + (cli/parse-opts args cli-spec)))) |
9 | 22 | clean {:doc "Delete build work"
|
10 | 23 | :task (do
|
11 | 24 | (fs/delete-tree "target")
|
12 | 25 | (shell {:dir "test-native"} "bb clean"))}
|
| 26 | + |
| 27 | + dev:jvm {:doc "Start a jvm nREPL server with PATH appropriatly setup for tests" |
| 28 | + :task (let [opts (parse-repl-args *command-line-args*) |
| 29 | + host (:host opts)] |
| 30 | + (shell shell-opts |
| 31 | + "clj" "-M:clj-1.11:test:nrepl/jvm" "-h" host "-b" host))} |
| 32 | + |
| 33 | + -bb {:doc "Internal - launched by dev:bb, test:bb" |
| 34 | + :extra-paths ["test"] |
| 35 | + :extra-deps {;; inherit base deps from deps.edn |
| 36 | + babashka/process {:local/root "."} |
| 37 | + ;; repeat necessary :test deps from deps.edn |
| 38 | + io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}} |
| 39 | + :requires ([cognitect.test-runner]) |
| 40 | + :task (let [target (cli/coerce (first *command-line-args*) :keyword) ;; should be either :test or :dev |
| 41 | + args (rest *command-line-args*)] |
| 42 | + ;; flag: sub-process should reload babashka.process |
| 43 | + (System/setProperty "babashka.process.test.reload" "true") |
| 44 | + ;; flag: force use of bb even if natively compiled version of run-exec exists |
| 45 | + (System/setProperty "babashka.process.test.run-exec" "bb") |
| 46 | + ;; run from babashka.process sources, not built-in babaska.process |
| 47 | + (require '[babashka.process] :reload) |
| 48 | + (case target |
| 49 | + :test (apply cognitect.test-runner.-main args) |
| 50 | + :dev (let [opts (parse-repl-args args)] |
| 51 | + (babashka.nrepl.server/start-server! opts) |
| 52 | + (deref (promise)))))} |
| 53 | + |
| 54 | + dev:bb {:doc "Start a bb nREPL server with PATH appropriately setup for tests" |
| 55 | + :task (apply shell shell-opts |
| 56 | + "bb -bb :dev" *command-line-args*)} |
| 57 | + |
13 | 58 | quickdoc {:doc "Invoke quickdoc"
|
14 | 59 | :requires ([quickdoc.api :as api])
|
15 | 60 | :task (api/quickdoc {:git/branch "master"
|
|
22 | 67 |
|
23 | 68 | test:native {:doc "Run exec tests with native runner (requires GraalVM compilation)."
|
24 | 69 | :depends [-prep-native-exec]
|
25 |
| - :task (apply clojure "-M:test:clj-1.11" "--namespace" "babashka.process-exec-test" *command-line-args*)} |
| 70 | + :task (apply clojure shell-opts |
| 71 | + "-M:test:clj-1.11" "--namespace" "babashka.process-exec-test" *command-line-args*)} |
26 | 72 |
|
27 | 73 | test:bb {:doc "Run all tests under bb"
|
28 |
| - :extra-paths ["test"] |
29 |
| - :extra-deps {;; inherit base deps from deps.edn |
30 |
| - babashka/process {:local/root "."} |
31 |
| - ;; repeat necessary :test deps from deps.edn |
32 |
| - io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}} |
33 |
| - :requires ([cognitect.test-runner]) |
34 |
| - :task (do |
35 |
| - ;; flag: sub-process should reload babashka.process |
36 |
| - (System/setProperty "babashka.process.test.reload" "true") |
37 |
| - ;; flag: force use of bb even if natively compiled version of run-exec exists |
38 |
| - (System/setProperty "babashka.process.test.run-exec" "bb") |
39 |
| - ;; run from babashka.process sources, not built-in babaska.process |
40 |
| - (require '[babashka.process] :reload) |
41 |
| - (apply cognitect.test-runner.-main *command-line-args*))} |
| 74 | + :task (apply shell shell-opts |
| 75 | + "bb -bb :test" *command-line-args*)} |
42 | 76 |
|
43 | 77 | test:jvm {:doc "Run jvm tests, optionally specify clj-version (ex. :clj-1.10 :clj-1.11(default) or :clj-all)"
|
44 | 78 | :requires ([clojure.string :as str]
|
|
72 | 106 | (doseq [alias aliases]
|
73 | 107 | (do
|
74 | 108 | (println (format "-[Running jvm tests for %s]-" alias))
|
75 |
| - (apply clojure (str "-M:test" alias) "--namespace" "babashka.process-test" args))))} |
| 109 | + (apply clojure |
| 110 | + shell-opts |
| 111 | + (str "-M:test" alias) "--namespace" "babashka.process-test" args))))} |
76 | 112 |
|
77 | 113 | ;; hidden CI support tasks
|
78 | 114 | -ci-install-jdk {:doc "Helper to download and install jdk under ~/tools on circleci"
|
|
0 commit comments