Skip to content

Commit 5daff1b

Browse files
committed
compile-clj - add simple spec for :basis arg
1 parent 62c7e5a commit 5daff1b

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
===========
33

4+
* next
5+
* compile-clj - add simple spec for :basis arg
6+
* v0.10.1 on Apr 28, 2024
7+
* compile-clj - add required check on :basis arg
48
* v0.10.0 3a2c484 on Mar 8, 2024
59
* Updated deps to latest tools.deps and Clojure 1.11.2
610
* v0.9.6 8e78bcc on Oct 6, 2023

src/main/clojure/clojure/tools/build/api.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@
314314
:class-dir ::specs/path
315315
:src-dirs ::specs/paths
316316
:compile-opts map?
317-
:bindings map?)
317+
:bindings map?
318+
:basis ::specs/basis)
318319
((requiring-resolve 'clojure.tools.build.tasks.compile-clj/compile-clj) params))
319320

320321
(defn javac

src/main/clojure/clojure/tools/build/api/specs.clj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33

44
(s/def ::lib qualified-ident?)
55
(s/def ::path string?)
6-
(s/def ::paths (s/coll-of string?))
6+
(s/def ::paths (s/coll-of string?))
7+
8+
;; there are better specs in clojure.tools.deps.specs, but no basis spec yet
9+
;; just doing a simple check here
10+
(s/def ::basis (s/nilable map?))

src/test/clojure/clojure/tools/build/tasks/test_compile_clj.clj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@
7676
(api/compile-clj (assoc compile-params :bindings {#'clojure.core/*assert* false})) ;; turn off asserts
7777
(is (= {:exit 0, :out (str "100" (System/lineSeparator))} (invoke))))))
7878

79+
(deftest test-accidental-basis-delay
80+
(with-test-dir "test-data/p1"
81+
(api/set-project-root! (.getAbsolutePath *test-dir*))
82+
(is (thrown? clojure.lang.ExceptionInfo
83+
(api/compile-clj {:class-dir "target/classes"
84+
:src-dirs ["src"]
85+
:basis (delay (api/create-basis nil))})))))
86+
7987
(comment
8088
(run-tests)
8189
)

0 commit comments

Comments
 (0)