Repository navigation
Expand file tree
/
Copy pathcl-cli.asd
More file actions
262 lines (253 loc) · 12.6 KB
/
Copy pathcl-cli.asd
File metadata and controls
262 lines (253 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
;;;; This form comes FIRST, before anything else. ASDF binds *package* to
;;;; ASDF-USER only for a file it loads itself; read any other way — a REPL
;;;; `load`, an editor evaluating the buffer, flake.nix parsing :version — the
;;;; file is read in whatever package happens to be current, and the
;;;; unqualified forms below would land in the wrong package.
(in-package #:asdf-user)
(defparameter +cl-cli-repository-url+
"https://github.com/nerima-lisp/cl-cli")
(defparameter +cl-cli-issues-url+
"https://github.com/nerima-lisp/cl-cli/issues")
(defparameter +cl-cli-readme+
(when *load-pathname*
(uiop:read-file-string (merge-pathnames #P"README.md" *load-pathname*))))
(asdf:defsystem "cl-cli"
:description "Composable Common Lisp CLI parsing and dispatch primitives."
:long-description +cl-cli-readme+
:author "takeokunn <bararararatty@gmail.com>"
:maintainer "takeokunn <bararararatty@gmail.com>"
:license "MIT"
:version "1.4.0"
:homepage +cl-cli-repository-url+
:bug-tracker +cl-cli-issues-url+
:source-control (:git +cl-cli-repository-url+)
;; CL-HOST-KIT is SBCL-only (see its own README), and this system's own
;; portability gate (checks.ecl in flake.nix) compiles on ECL too. The
;; reader conditional keeps ECL from ever seeing the dependency name, the
;; same way cl-tty-kit.asd conditions its sb-posix dependency, and the same
;; way src/runtime.lisp's own #+sbcl/#-sbcl split keeps ECL off
;; HOST-KIT:COMMAND-LINE-ARGUMENTS.
:depends-on ("uiop" #+sbcl "cl-host-kit")
:serial t
;; Component names carry their own directory rather than using :pathname,
;; because the test system below has to reach one file in examples/ that a
;; system-wide :pathname "t" would put out of reach.
:components ((:file "src/package")
(:file "src/conditions")
(:file "src/core")
(:file "src/model-helpers")
(:file "src/model-value-typing")
(:file "src/model-structs")
(:file "src/model-lookup")
(:file "src/option-relations")
(:file "src/model-option")
(:file "src/model-option-groups")
(:file "src/model-positional")
(:file "src/model-command")
(:file "src/model-validation")
(:file "src/model-app")
(:file "src/model-dsl-clauses")
(:file "src/model-dsl")
(:file "src/util")
(:file "src/terminal")
(:file "src/parser-lookup")
(:file "src/parser-relation-validation")
(:file "src/parser-option-consumption")
(:file "src/parser-consumption")
(:file "src/parser-cps")
(:file "src/parser-defaults")
(:file "src/parser-values")
(:file "src/parser-value-storage")
(:file "src/parser-core")
(:file "src/parser-dispatch")
(:file "src/help-style")
(:file "src/help-metadata")
(:file "src/help-renderers")
(:file "src/help-printers")
(:file "src/help-commands")
(:file "src/runtime")
(:file "src/completion-quoting")
(:file "src/completion-helpers")
(:file "src/completion-renderer-helpers")
(:file "src/completion-renderers-bash")
(:file "src/completion-renderers-zsh")
(:file "src/completion-renderers-fish")
(:file "src/completion-renderers-powershell")
(:file "src/completion-renderers-nushell")
(:file "src/completion-renderers-elvish")
(:file "src/doc-helpers")
(:file "src/doc-renderers-manpage")
(:file "src/doc-renderers-markdown")
(:file "src/doc-renderers-json-writer")
(:file "src/doc-renderers-json")
(:file "src/doc-commands")
(:file "src/completion-dynamic")
(:file "src/completion-commands"))
:in-order-to ((asdf:test-op (asdf:test-op "cl-cli/test"))))
;;; The one executable this repository ships, and the only system here with a
;;; `:build-operation`. It lives in its own `demo/` directory and its own
;;; system rather than inside `cl-cli` above, because PACKAGE_STANDARD.md keeps
;;; a library's `:components` flat and readable as a table of contents, and
;;; because a library must never drag a `program-op` entry point into a
;;; consumer's image. `cl-regex-kit/cli` is the org precedent for this shape.
;;;
;;; `:depends-on ("cl-cli")` and nothing else: the demo exists to show that the
;;; library alone is enough to build a real CLI.
(asdf:defsystem "cl-cli/demo"
:description "cl-cli-demo: a runnable CLI built from cl-cli's own primitives."
:author "takeokunn <bararararatty@gmail.com>"
:maintainer "takeokunn <bararararatty@gmail.com>"
:license "MIT"
:version "1.4.0"
:homepage +cl-cli-repository-url+
:bug-tracker +cl-cli-issues-url+
:source-control (:git +cl-cli-repository-url+)
:depends-on ("cl-cli")
;; `:pathname` here where the main system above deliberately avoids it: that
;; system's components must be able to reach examples/, this one's must not
;; reach anywhere. It also fixes where ASDF writes the program -- `program-op`
;; resolves `:build-pathname` against the system's `component-pathname`, so
;; the binary lands at `demo/cl-cli-demo`, which is what flake.nix's
;; `programPath` names.
:pathname "demo"
:serial t
:components ((:file "package")
(:file "main"))
:build-operation "program-op"
:build-pathname "cl-cli-demo"
:entry-point "cl-cli/demo:main")
;;; The test suite is split in two so that the portable half stays loadable on
;;; every implementation. `cl-cli/test' is the core suite; its dependencies
;;; are all portable Common Lisp. `cl-cli/test/shell-verification' adds the
;;; checks that shell out to bash/zsh/fish/mandoc, and only that half needs
;;; `cl-process-kit' (whose transitive `cl-log-kit' dependency is SBCL-only --
;;; https://github.com/nerima-lisp/cl-log-kit/issues/1). Keeping the split at
;;; the system boundary means a non-SBCL implementation runs the core suite for
;;; real instead of failing to compile the whole thing.
#+sbcl
(asdf:defsystem "cl-cli/concurrent"
:description "Bounded concurrent parsing of independent cl-cli argv batches."
:author "takeokunn <bararararatty@gmail.com>"
:maintainer "takeokunn <bararararatty@gmail.com>"
:license "MIT"
:version "1.4.0"
:homepage +cl-cli-repository-url+
:bug-tracker +cl-cli-issues-url+
:source-control (:git +cl-cli-repository-url+)
:depends-on ("cl-cli" "cl-concurrent-kit")
:serial t
:components ((:file "src/concurrent-package")
(:file "src/concurrent")))
(asdf:defsystem "cl-cli/test"
:description "Core test system for cl-cli."
:author "takeokunn <bararararatty@gmail.com>"
:maintainer "takeokunn <bararararatty@gmail.com>"
:license "MIT"
:version "1.4.0"
:homepage +cl-cli-repository-url+
:bug-tracker +cl-cli-issues-url+
:source-control (:git +cl-cli-repository-url+)
;; `cl-cli/demo` belongs to the PORTABLE half: it depends on nothing but
;; `cl-cli`, so t/demo-test.lisp runs under the ECL gate too -- which is the
;; only thing that would notice the demo growing an SBCL-only form.
:depends-on ("cl-cli" "cl-cli/demo" "cl-weave" "cl-prolog-kit/weave" "cl-json-kit"
#+sbcl "cl-cli/concurrent")
:serial t
:components ((:file "t/package")
(:file "t/helpers-fixtures")
(:file "examples/consumer-migrations")
(:file "t/helpers-gates")
(:file "t/helpers-assertions")
(:file "t/helpers-parser")
(:file "t/helpers-prolog")
(:file "t/test-runner")
(:file "t/package-test")
(:file "t/parser-dispatch-test")
(:file "t/parser-cps-test")
(:file "t/parser-cps-rest-positional-test")
(:file "t/parser-dispatch-property-test")
(:file "t/model-helpers-mutation-test")
(:file "t/parser-dispatch-fuzz-test")
(:file "t/parser-dispatch-benchmark-test")
(:file "t/model-dsl-test")
(:file "t/parser-option-consumption-test")
(:file "t/model-value-typing-test")
(:file "t/parser-value-storage-count-test")
(:file "t/parser-value-storage-delimited-test")
(:file "t/parser-values-config-test")
(:file "t/parser-values-source-test")
(:file "t/model-helpers-deprecated-test")
(:file "t/parser-values-positional-choices-test")
(:file "t/parser-lookup-abbreviation-test")
(:file "t/parser-dispatch-subcommands-test")
(:file "t/help-printers-option-groups-test")
(:file "t/util-response-files-test")
(:file "t/parser-core-positional-arity-test")
(:file "t/parser-core-default-command-test")
(:file "t/help-style-color-test")
(:file "t/terminal-test")
(:file "t/help-style-wrap-test")
(:file "t/util-auto-help-test")
(:file "t/core-negative-numbers-test")
(:file "t/parser-value-storage-key-value-test")
(:file "t/parser-option-consumption-multi-value-test")
(:file "t/parser-option-consumption-variadic-test")
(:file "t/parser-relation-validation-inclusive-group-test")
(:file "t/core-suggestions-test")
(:file "t/parser-dispatch-require-command-test")
(:file "t/parser-relation-validation-conditional-test")
(:file "t/model-validation-test")
(:file "t/parser-values-validation-test")
(:file "t/parser-value-storage-boolean-test")
(:file "t/option-relations-queries")
(:file "t/option-relations-test")
(:file "t/help-printers-test")
(:file "t/help-printers-command-footer-test")
(:file "t/help-renderers-usage-synopsis-test")
(:file "t/runtime-exit-codes-test")
(:file "t/completion-renderers-bash-test")
(:file "t/completion-renderers-zsh-test")
(:file "t/completion-renderers-fish-test")
(:file "t/completion-renderers-powershell-test")
(:file "t/completion-renderers-nushell-test")
(:file "t/completion-renderers-elvish-test")
(:file "t/completion-commands-test")
(:file "t/completion-helpers-positional-test")
(:file "t/completion-helpers-value-hints-test")
(:file "t/completion-dynamic-test")
(:file "t/completion-dynamic-flat-shells-test")
(:file "t/completion-commands-builtin-args-test")
(:file "t/doc-renderers-manpage-test")
(:file "t/doc-renderers-manpage-metadata-test")
(:file "t/doc-renderers-markdown-test")
(:file "t/doc-renderers-json-test")
(:file "t/doc-commands-test")
(:file "t/consumer-migrations-test")
(:file "t/demo-test")
#+sbcl (:file "t/concurrent-test"))
;; Not UIOP:SYMBOL-CALL, and not a sibling-package prefix either: a .asd is
;; read by the plain CL reader before :depends-on is ever consulted, so any
;; PKG:SYMBOL token here must resolve against a package already present in
;; the image. UIOP is safe only because ASDF ships it; CL-HOST-KIT is not
;; loaded yet at this point regardless of implementation. FIND-SYMBOL/
;; FIND-PACKAGE/FUNCALL are CL, always present, and sidestep the problem
;; entirely -- this is what UIOP:SYMBOL-CALL itself boils down to.
:perform (asdf:test-op (op c)
(funcall (find-symbol "RUN-TESTS" (find-package "CL-CLI/TEST")))))
(asdf:defsystem "cl-cli/test/shell-verification"
:description
"Tests that run cl-cli's generated scripts through the real shells and mandoc."
:author "takeokunn <bararararatty@gmail.com>"
:maintainer "takeokunn <bararararatty@gmail.com>"
:license "MIT"
:version "1.4.0"
:homepage +cl-cli-repository-url+
:bug-tracker +cl-cli-issues-url+
:source-control (:git +cl-cli-repository-url+)
:depends-on ("cl-cli/test" "cl-process-kit")
:serial t
:components ((:file "t/completion-commands-shell-verification-test"))
;; See cl-cli/test's :perform above: a .asd is read before :depends-on is
;; consulted, so this cannot use a CL-HOST-KIT-prefixed symbol either.
:perform (asdf:test-op (op c)
(funcall (find-symbol "RUN-TESTS" (find-package "CL-CLI/TEST")))))