1 | \input texinfo @c -*- texinfo -*- |
---|
2 | @c %**start of header |
---|
3 | @setfilename asdf.info |
---|
4 | @settitle ASDF Manual |
---|
5 | @c %**end of header |
---|
6 | |
---|
7 | @c We use @&key, etc to escape & from TeX in lambda lists -- |
---|
8 | @c so we need to define them for info as well. |
---|
9 | @macro AallowOtherKeys |
---|
10 | &allow-other-keys |
---|
11 | @end macro |
---|
12 | @macro Aoptional |
---|
13 | &optional |
---|
14 | @end macro |
---|
15 | @macro Arest |
---|
16 | &rest |
---|
17 | @end macro |
---|
18 | @macro Akey |
---|
19 | &key |
---|
20 | @end macro |
---|
21 | @macro Abody |
---|
22 | &body |
---|
23 | @end macro |
---|
24 | |
---|
25 | @c for install-info |
---|
26 | @dircategory Software development |
---|
27 | @direntry |
---|
28 | * asdf: (asdf). Another System Definition Facility (for Common Lisp) |
---|
29 | @end direntry |
---|
30 | |
---|
31 | @copying |
---|
32 | This manual describes ASDF, a system definition facility |
---|
33 | for Common Lisp programs and libraries. |
---|
34 | |
---|
35 | You can find the latest version of this manual at |
---|
36 | @url{http://common-lisp.net/project/asdf/asdf.html}. |
---|
37 | |
---|
38 | ASDF Copyright @copyright{} 2001-2014 Daniel Barlow and contributors. |
---|
39 | |
---|
40 | This manual Copyright @copyright{} 2001-2014 Daniel Barlow and contributors. |
---|
41 | |
---|
42 | This manual revised @copyright{} 2009-2014 Robert P. Goldman and Francois-Rene Rideau. |
---|
43 | |
---|
44 | Permission is hereby granted, free of charge, to any person obtaining |
---|
45 | a copy of this software and associated documentation files (the |
---|
46 | ``Software''), to deal in the Software without restriction, including |
---|
47 | without limitation the rights to use, copy, modify, merge, publish, |
---|
48 | distribute, sublicense, and/or sell copies of the Software, and to |
---|
49 | permit persons to whom the Software is furnished to do so, subject to |
---|
50 | the following conditions: |
---|
51 | |
---|
52 | The above copyright notice and this permission notice shall be |
---|
53 | included in all copies or substantial portions of the Software. |
---|
54 | |
---|
55 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, |
---|
56 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
---|
57 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
---|
58 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
---|
59 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
---|
60 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
---|
61 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
---|
62 | |
---|
63 | @end copying |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | @titlepage |
---|
68 | @title ASDF: Another System Definition Facility |
---|
69 | |
---|
70 | @c The following two commands start the copyright page. |
---|
71 | @page |
---|
72 | @vskip 0pt plus 1filll |
---|
73 | @insertcopying |
---|
74 | @end titlepage |
---|
75 | |
---|
76 | @c Output the table of contents at the beginning. |
---|
77 | @contents |
---|
78 | |
---|
79 | @c ------------------- |
---|
80 | |
---|
81 | @ifnottex |
---|
82 | |
---|
83 | @node Top, Introduction, (dir), (dir) |
---|
84 | @top asdf: another system definition facility |
---|
85 | |
---|
86 | @insertcopying |
---|
87 | |
---|
88 | @menu |
---|
89 | * Introduction:: |
---|
90 | * Loading ASDF:: |
---|
91 | * Configuring ASDF:: |
---|
92 | * Using ASDF:: |
---|
93 | * Defining systems with defsystem:: |
---|
94 | * The object model of ASDF:: |
---|
95 | * Controlling where ASDF searches for systems:: |
---|
96 | * Controlling where ASDF saves compiled files:: |
---|
97 | * Error handling:: |
---|
98 | * Miscellaneous additional functionality:: |
---|
99 | * Getting the latest version:: |
---|
100 | * FAQ:: |
---|
101 | * TODO list:: |
---|
102 | * Inspiration:: |
---|
103 | * Concept Index:: |
---|
104 | * Function and Class Index:: |
---|
105 | * Variable Index:: |
---|
106 | |
---|
107 | @c @detailmenu |
---|
108 | @c --- The Detailed Node Listing --- |
---|
109 | |
---|
110 | @c Defining systems with defsystem |
---|
111 | |
---|
112 | @c * The defsystem form:: |
---|
113 | @c * A more involved example:: |
---|
114 | @c * The defsystem grammar:: |
---|
115 | @c * Other code in .asd files:: |
---|
116 | |
---|
117 | @c The object model of ASDF |
---|
118 | |
---|
119 | @c * Operations:: |
---|
120 | @c * Components:: |
---|
121 | @c * Functions:: |
---|
122 | |
---|
123 | @c Operations |
---|
124 | |
---|
125 | @c * Predefined operations of ASDF:: |
---|
126 | @c * Creating new operations:: |
---|
127 | |
---|
128 | @c Components |
---|
129 | |
---|
130 | @c * Common attributes of components:: |
---|
131 | @c * Pre-defined subclasses of component:: |
---|
132 | @c * Creating new component types:: |
---|
133 | |
---|
134 | @c properties |
---|
135 | |
---|
136 | @c * Pre-defined subclasses of component:: |
---|
137 | @c * Creating new component types:: |
---|
138 | |
---|
139 | @c @end detailmenu |
---|
140 | @end menu |
---|
141 | |
---|
142 | @end ifnottex |
---|
143 | |
---|
144 | @c ------------------- |
---|
145 | |
---|
146 | @node Introduction, Loading ASDF, Top, Top |
---|
147 | @comment node-name, next, previous, up |
---|
148 | @chapter Introduction |
---|
149 | @cindex ASDF-related features |
---|
150 | @vindex *features* |
---|
151 | @cindex Testing for ASDF |
---|
152 | @cindex ASDF versions |
---|
153 | @cindex :asdf |
---|
154 | @cindex :asdf2 |
---|
155 | @cindex :asdf3 |
---|
156 | |
---|
157 | ASDF is Another System Definition Facility: |
---|
158 | a tool for specifying how systems of Common Lisp software |
---|
159 | are comprised of components (sub-systems and files), |
---|
160 | and how to operate on these components in the right order |
---|
161 | so that they can be compiled, loaded, tested, etc. |
---|
162 | |
---|
163 | ASDF presents three faces: |
---|
164 | one for users of Common Lisp software who want to reuse other people's code, |
---|
165 | one for writers of Common Lisp software who want to specify how to build their systems, |
---|
166 | one for implementers of Common Lisp extensions who want to extend the build system. |
---|
167 | @xref{Using ASDF,,Loading a system}, |
---|
168 | to learn how to use ASDF to load a system. |
---|
169 | @xref{Defining systems with defsystem}, |
---|
170 | to learn how to define a system of your own. |
---|
171 | @xref{The object model of ASDF}, for a description of |
---|
172 | the ASDF internals and how to extend ASDF. |
---|
173 | |
---|
174 | @emph{Nota Bene}: |
---|
175 | We have released ASDF 2.000 on May 31st 2010, |
---|
176 | and ASDF 3.0.0 on May 15th 2013. |
---|
177 | Releases of ASDF 2 and later have since then been included |
---|
178 | in all actively maintained CL implementations that used to bundle ASDF 1, |
---|
179 | plus some implementations that didn't use to, |
---|
180 | and has been made to work with all actively used CL implementations and a few more. |
---|
181 | @xref{FAQ,,``What has changed between ASDF 1 and ASDF 2?''}. |
---|
182 | Furthermore, it is possible to upgrade from ASDF 1 to ASDF 2 or ASDF 3 on the fly. |
---|
183 | For this reason, we have stopped supporting ASDF 1 and ASDF 2. |
---|
184 | If you are using ASDF 1 or ASDF 2 and are experiencing any kind of issues or limitations, |
---|
185 | we recommend you upgrade to ASDF 3 |
---|
186 | --- and we explain how to do that. @xref{Loading ASDF}. |
---|
187 | |
---|
188 | Also note that ASDF is not to be confused with ASDF-Install. |
---|
189 | ASDF-Install is not part of ASDF, but a separate piece of software. |
---|
190 | ASDF-Install is also unmaintained and obsolete. |
---|
191 | We recommend you use Quicklisp instead, |
---|
192 | which works great and is being actively maintained. |
---|
193 | If you want to download software from version control instead of tarballs, |
---|
194 | so you may more easily modify it, we recommend clbuild. |
---|
195 | |
---|
196 | |
---|
197 | @node Loading ASDF, Configuring ASDF, Introduction, Top |
---|
198 | @comment node-name, next, previous, up |
---|
199 | @chapter Loading ASDF |
---|
200 | @vindex *central-registry* |
---|
201 | @cindex link farm |
---|
202 | @findex load-system |
---|
203 | @findex require-system |
---|
204 | @findex compile-system |
---|
205 | @findex test-system |
---|
206 | @cindex system directory designator |
---|
207 | @findex operate |
---|
208 | @findex oos |
---|
209 | |
---|
210 | @c @menu |
---|
211 | @c * Installing ASDF:: |
---|
212 | @c @end menu |
---|
213 | |
---|
214 | |
---|
215 | @section Loading a pre-installed ASDF |
---|
216 | |
---|
217 | Most recent Lisp implementations include a copy of ASDF 2, and soon ASDF 3. |
---|
218 | You can usually load this copy using Common Lisp's @code{require} function: |
---|
219 | |
---|
220 | @lisp |
---|
221 | (require "asdf") |
---|
222 | @end lisp |
---|
223 | |
---|
224 | As of the writing of this manual, |
---|
225 | the following implementations provide ASDF 2 this way: |
---|
226 | abcl allegro ccl clisp cmucl ecl lispworks mkcl sbcl xcl. |
---|
227 | The following implementation doesn't provide it yet but will in an upcoming release: |
---|
228 | scl. |
---|
229 | The following implementations are obsolete, not actively maintained, |
---|
230 | and most probably will never bundle it: |
---|
231 | cormanlisp gcl genera mcl. |
---|
232 | |
---|
233 | If the implementation you are using doesn't provide ASDF 2 or ASDF 3, |
---|
234 | see @pxref{Loading ASDF,,Loading an otherwise installed ASDF} below. |
---|
235 | If that implementation is still actively maintained, |
---|
236 | you may also send a bug report to your Lisp vendor and complain |
---|
237 | about their failing to provide ASDF. |
---|
238 | |
---|
239 | NB: all implementations except clisp also accept |
---|
240 | @code{(require "ASDF")}, @code{(require 'asdf)} and @code{(require :asdf)}. |
---|
241 | For portability's sake, you probably want to use @code{(require "asdf")}. |
---|
242 | |
---|
243 | |
---|
244 | @section Checking whether ASDF is loaded |
---|
245 | |
---|
246 | To check whether ASDF is properly loaded in your current Lisp image, |
---|
247 | you can run this form: |
---|
248 | |
---|
249 | @lisp |
---|
250 | (asdf:asdf-version) |
---|
251 | @end lisp |
---|
252 | |
---|
253 | If it returns a string, |
---|
254 | that is the version of ASDF that is currently installed. |
---|
255 | |
---|
256 | If it raises an error, |
---|
257 | then either ASDF is not loaded, or |
---|
258 | you are using an old version of ASDF. |
---|
259 | |
---|
260 | You can check whether an old version is loaded |
---|
261 | by checking if the ASDF package is present. |
---|
262 | The form below will allow you to programmatically determine |
---|
263 | whether a recent version is loaded, an old version is loaded, |
---|
264 | or none at all: |
---|
265 | |
---|
266 | @lisp |
---|
267 | (when (find-package :asdf) |
---|
268 | (let ((ver (symbol-value (or (find-symbol (string :*asdf-version*) :asdf) |
---|
269 | (find-symbol (string :*asdf-revision*) :asdf))))) |
---|
270 | (etypecase ver |
---|
271 | (string ver) |
---|
272 | (cons (with-output-to-string (s) |
---|
273 | (loop for (n . m) on ver do (princ n s) (when m (princ "." s))))) |
---|
274 | (null "1.0")))) |
---|
275 | @end lisp |
---|
276 | |
---|
277 | If it returns @code{nil} then ASDF is not installed. |
---|
278 | Otherwise it should return a string. |
---|
279 | If it returns @code{"1.0"}, then it can actually be |
---|
280 | any version before 1.77 or so, or some buggy variant of 1.x. |
---|
281 | |
---|
282 | If you are experiencing problems with ASDF, |
---|
283 | please try upgrading to the latest released version, |
---|
284 | using the method below, |
---|
285 | before you contact us and raise an issue. |
---|
286 | |
---|
287 | |
---|
288 | @section Upgrading ASDF |
---|
289 | |
---|
290 | If your implementation provides ASDF 3 or later, |
---|
291 | you only need to @code{(require "asdf")}: |
---|
292 | ASDF will automatically look whether an updated version of itself is available |
---|
293 | amongst the regularly configured systems, before it compiles anything else. |
---|
294 | See @pxref{Configuring ASDF} below. |
---|
295 | |
---|
296 | If your implementation does provide ASDF 2 or later, |
---|
297 | but not ASDF 3 or later, |
---|
298 | and you want to upgrade to a more recent version, |
---|
299 | you need to install and configure your ASDF as above, |
---|
300 | and additionally, you need to explicitly tell ASDF to load itself, |
---|
301 | right after you require your implementation's old ASDF 2: |
---|
302 | |
---|
303 | @lisp |
---|
304 | (require "asdf") |
---|
305 | (asdf:load-system :asdf) |
---|
306 | @end lisp |
---|
307 | |
---|
308 | If on the other hand, your implementation only provides an old ASDF, |
---|
309 | you will require a special configuration step and an old-style loading. |
---|
310 | Take special attention to not omit the trailing directory separator |
---|
311 | @code{/} at the end of your pathname: |
---|
312 | |
---|
313 | @lisp |
---|
314 | (require "asdf") |
---|
315 | (push #p"@var{/path/to/new/asdf/}" asdf:*central-registry*) |
---|
316 | (asdf:oos 'asdf:load-op :asdf) |
---|
317 | @end lisp |
---|
318 | |
---|
319 | Note that ASDF 1 won't redirect its output files, |
---|
320 | or at least won't do it according to your usual ASDF 2 configuration. |
---|
321 | You therefore need write access on the directory |
---|
322 | where you install the new ASDF, |
---|
323 | and make sure you're not using it |
---|
324 | for multiple mutually incompatible implementations. |
---|
325 | At worst, you may have to have multiple copies of the new ASDF, |
---|
326 | e.g. one per implementation installation, to avoid clashes. |
---|
327 | Note that to our knowledge all implementations that provide ASDF |
---|
328 | provide ASDF 2 in their latest release, so |
---|
329 | you may want to upgrade your implementation rather than go through that hoop. |
---|
330 | |
---|
331 | Finally, if you are using an unmaintained implementation |
---|
332 | that does not provide ASDF at all, |
---|
333 | see @pxref{Loading ASDF,,Loading an otherwise installed ASDF} below. |
---|
334 | |
---|
335 | Note that there are some limitations to upgrading ASDF: |
---|
336 | @itemize |
---|
337 | @item |
---|
338 | Previously loaded ASDF extension becomes invalid, and will need to be reloaded. |
---|
339 | This applies to e.g. CFFI-Grovel, or to hacks used by ironclad, etc. |
---|
340 | Since it isn't possible to automatically detect what extensions are present |
---|
341 | that need to be invalidated, |
---|
342 | ASDF will actually invalidate all previously loaded systems |
---|
343 | when it is loaded on top of a different ASDF version, |
---|
344 | starting with ASDF 2.014.8 (as far as releases go, 2.015); |
---|
345 | and it will automatically attempt this self-upgrade as its very first step |
---|
346 | starting with ASDF 3. |
---|
347 | |
---|
348 | @item |
---|
349 | For this an many other reasons, |
---|
350 | it important reason to load, configure and upgrade ASDF (if needed) |
---|
351 | as one of the very first things done by your build and startup scripts. |
---|
352 | Until all implementations provide ASDF 3 or later, |
---|
353 | it is safer if you upgrade ASDF and its extensions as a special step |
---|
354 | at the very beginning of whatever script you are running, |
---|
355 | before you start using ASDF to load anything else; |
---|
356 | even afterwards, it is still a good idea, to avoid having to |
---|
357 | load and reload code twice as it gets invalidated. |
---|
358 | |
---|
359 | @item |
---|
360 | Until all implementations provide ASDF 3 or later, |
---|
361 | it is unsafe to upgrade ASDF as part of loading a system |
---|
362 | that depends on a more recent version of ASDF, |
---|
363 | since the new one might shadow the old one while the old one is running, |
---|
364 | and the running old one will be confused |
---|
365 | when extensions are loaded into the new one. |
---|
366 | In the meantime, we recommend that your systems should @emph{not} specify |
---|
367 | @code{:depends-on (:asdf)}, or @code{:depends-on ((:version :asdf "2.010"))}, |
---|
368 | but instead that they check that a recent enough ASDF is installed, |
---|
369 | with such code as: |
---|
370 | @example |
---|
371 | (unless (or #+asdf2 (asdf:version-satisfies |
---|
372 | (asdf:asdf-version) *required-asdf-version*)) |
---|
373 | (error "FOO requires ASDF ~A or later." *required-asdf-version*)) |
---|
374 | @end example |
---|
375 | @item |
---|
376 | Until all implementations provide ASDF 3 or later, |
---|
377 | it is unsafe for a system to transitively depend on ASDF |
---|
378 | and not directly depend on ASDF; |
---|
379 | if any of the system you use either depends-on asdf, |
---|
380 | system-depends-on asdf, or transitively does, |
---|
381 | you should also do as well. |
---|
382 | @end itemize |
---|
383 | |
---|
384 | |
---|
385 | @section Loading an otherwise installed ASDF |
---|
386 | |
---|
387 | If your implementation doesn't include ASDF, |
---|
388 | if for some reason the upgrade somehow fails, |
---|
389 | does not or cannot apply to your case, |
---|
390 | you will have to install the file @file{asdf.lisp} |
---|
391 | somewhere and load it with: |
---|
392 | |
---|
393 | @lisp |
---|
394 | (load "/path/to/your/installed/asdf.lisp") |
---|
395 | @end lisp |
---|
396 | |
---|
397 | The single file @file{asdf.lisp} is all you normally need to use ASDF. |
---|
398 | |
---|
399 | You can extract this file from latest release tarball on the |
---|
400 | @url{http://common-lisp.net/project/asdf/,ASDF website}. |
---|
401 | If you are daring and willing to report bugs, you can get |
---|
402 | the latest and greatest version of ASDF from its git repository. |
---|
403 | @xref{Getting the latest version}. |
---|
404 | |
---|
405 | For maximum convenience you might want to have ASDF loaded |
---|
406 | whenever you start your Lisp implementation, |
---|
407 | for example by loading it from the startup script or dumping a custom core |
---|
408 | --- check your Lisp implementation's manual for details. |
---|
409 | |
---|
410 | |
---|
411 | @node Configuring ASDF, Using ASDF, Loading ASDF, Top |
---|
412 | @comment node-name, next, previous, up |
---|
413 | |
---|
414 | @chapter Configuring ASDF |
---|
415 | |
---|
416 | @section Configuring ASDF to find your systems |
---|
417 | |
---|
418 | So it may compile and load your systems, ASDF must be configured to find |
---|
419 | the @file{.asd} files that contain system definitions. |
---|
420 | |
---|
421 | Since ASDF 2, the preferred way to configure where ASDF finds your systems is |
---|
422 | the @code{source-registry} facility, |
---|
423 | fully described in its own chapter of this manual. |
---|
424 | @xref{Controlling where ASDF searches for systems}. |
---|
425 | |
---|
426 | The default location for a user to install Common Lisp software is under |
---|
427 | @file{~/.local/share/common-lisp/source/}. |
---|
428 | If you install software there (it can be a symlink), |
---|
429 | you don't need further configuration. |
---|
430 | If you're installing software yourself at a location that isn't standard, |
---|
431 | you have to tell ASDF where you installed it. See below. |
---|
432 | If you're using some tool to install software (e.g. Quicklisp), |
---|
433 | the authors of that tool should already have configured ASDF. |
---|
434 | |
---|
435 | The simplest way to add a path to your search path, |
---|
436 | say @file{/home/luser/.asd-link-farm/} |
---|
437 | is to create the directory |
---|
438 | @file{~/.config/common-lisp/source-registry.conf.d/} |
---|
439 | and there create a file with any name of your choice, |
---|
440 | and with the type @file{conf}, |
---|
441 | for instance @file{42-asd-link-farm.conf} |
---|
442 | containing the line: |
---|
443 | |
---|
444 | @kbd{(:directory "/home/luser/.asd-link-farm/")} |
---|
445 | |
---|
446 | If you want all the subdirectories under @file{/home/luser/lisp/} |
---|
447 | to be recursively scanned for @file{.asd} files, instead use: |
---|
448 | |
---|
449 | @kbd{(:tree "/home/luser/lisp/")} |
---|
450 | |
---|
451 | Note that your Operating System distribution or your system administrator |
---|
452 | may already have configured system-managed libraries for you. |
---|
453 | |
---|
454 | The required @file{.conf} extension allows you to have disabled files |
---|
455 | or editor backups (ending in @file{~}), and works portably |
---|
456 | (for instance, it is a pain to allow both empty and non-empty extension on CLISP). |
---|
457 | Excluded are files the name of which start with a @file{.} character. |
---|
458 | It is customary to start the filename with two digits |
---|
459 | that specify the order in which the directories will be scanned. |
---|
460 | |
---|
461 | ASDF will automatically read your configuration |
---|
462 | the first time you try to find a system. |
---|
463 | You can reset the source-registry configuration with: |
---|
464 | |
---|
465 | @lisp |
---|
466 | (asdf:clear-source-registry) |
---|
467 | @end lisp |
---|
468 | |
---|
469 | And you probably should do so before you dump your Lisp image, |
---|
470 | if the configuration may change |
---|
471 | between the machine where you save it at the time you save it |
---|
472 | and the machine you resume it at the time you resume it. |
---|
473 | Actually, you should use @code{(asdf:clear-configuration)} |
---|
474 | before you dump your Lisp image, which includes the above. |
---|
475 | |
---|
476 | |
---|
477 | @section Configuring ASDF to find your systems --- old style |
---|
478 | |
---|
479 | The old way to configure ASDF to find your systems is by |
---|
480 | @code{push}ing directory pathnames onto the variable |
---|
481 | @code{asdf:*central-registry*}. |
---|
482 | |
---|
483 | You must configure this variable between the time you load ASDF |
---|
484 | and the time you first try to use it. |
---|
485 | Loading and configuring ASDF presumably happen |
---|
486 | as part of some initialization script that builds or starts |
---|
487 | your Common Lisp software system. |
---|
488 | (For instance, some SBCL users used to put it in their @file{~/.sbclrc}.) |
---|
489 | |
---|
490 | The @code{asdf:*central-registry*} is empty by default in ASDF 2 or ASDF 3, |
---|
491 | but is still supported for compatibility with ASDF 1. |
---|
492 | When used, it takes precedence over the above source-registry@footnote{ |
---|
493 | It is possible to further customize |
---|
494 | the system definition file search. |
---|
495 | That's considered advanced use, and covered later: |
---|
496 | search forward for |
---|
497 | @code{*system-definition-search-functions*}. |
---|
498 | @xref{Defining systems with defsystem}.}. |
---|
499 | |
---|
500 | For instance, if you wanted ASDF to find the @file{.asd} file |
---|
501 | @file{/home/me/src/foo/foo.asd} your initialization script |
---|
502 | could after it loads ASDF with @code{(require "asdf")} |
---|
503 | configure it with: |
---|
504 | |
---|
505 | @lisp |
---|
506 | (push "/home/me/src/foo/" asdf:*central-registry*) |
---|
507 | @end lisp |
---|
508 | |
---|
509 | Note the trailing slash: when searching for a system, |
---|
510 | ASDF will evaluate each entry of the central registry |
---|
511 | and coerce the result to a pathname@footnote{ |
---|
512 | ASDF will indeed call @code{eval} on each entry. |
---|
513 | It will also skip entries that evaluate to @code{nil}. |
---|
514 | |
---|
515 | Strings and pathname objects are self-evaluating, |
---|
516 | in which case the @code{eval} step does nothing; |
---|
517 | but you may push arbitrary SEXP onto the central registry, |
---|
518 | that will be evaluated to compute e.g. things that depend |
---|
519 | on the value of shell variables or the identity of the user. |
---|
520 | |
---|
521 | The variable @code{asdf:*central-registry*} is thus a list of |
---|
522 | ``system directory designators''. |
---|
523 | A @dfn{system directory designator} is a form |
---|
524 | which will be evaluated whenever a system is to be found, |
---|
525 | and must evaluate to a directory to look in. |
---|
526 | By ``directory'' here, we mean |
---|
527 | ``designator for a pathname with a supplied DIRECTORY component''. |
---|
528 | } |
---|
529 | at which point the presence of the trailing directory name separator |
---|
530 | is necessary to tell Lisp that you're discussing a directory |
---|
531 | rather than a file. |
---|
532 | |
---|
533 | Typically, however, there are a lot of @file{.asd} files, and |
---|
534 | a common idiom was to have to put |
---|
535 | a bunch of @emph{symbolic links} to @file{.asd} files |
---|
536 | in a common directory |
---|
537 | and push @emph{that} directory (the ``link farm'') |
---|
538 | to the |
---|
539 | @code{asdf:*central-registry*} |
---|
540 | instead of pushing each of the many involved directories |
---|
541 | to the @code{asdf:*central-registry*}. |
---|
542 | ASDF knows how to follow such @emph{symlinks} |
---|
543 | to the actual file location when resolving the paths of system components |
---|
544 | (on Windows, you can use Windows shortcuts instead of POSIX symlinks; |
---|
545 | if you try aliases under MacOS, we are curious to hear about your experience). |
---|
546 | |
---|
547 | For example, if @code{#p"/home/me/cl/systems/"} (note the trailing slash) |
---|
548 | is a member of @code{*central-registry*}, you could set up the |
---|
549 | system @var{foo} for loading with asdf with the following |
---|
550 | commands at the shell: |
---|
551 | |
---|
552 | @example |
---|
553 | $ cd /home/me/cl/systems/ |
---|
554 | $ ln -s ~/src/foo/foo.asd . |
---|
555 | @end example |
---|
556 | |
---|
557 | This old style for configuring ASDF is not recommended for new users, |
---|
558 | but it is supported for old users, and for users who want to programmatically |
---|
559 | control what directories are added to the ASDF search path. |
---|
560 | |
---|
561 | |
---|
562 | @section Configuring where ASDF stores object files |
---|
563 | @findex clear-output-translations |
---|
564 | |
---|
565 | ASDF lets you configure where object files will be stored. |
---|
566 | Sensible defaults are provided and |
---|
567 | you shouldn't normally have to worry about it. |
---|
568 | |
---|
569 | This allows the same source code repository may be shared |
---|
570 | between several versions of several Common Lisp implementations, |
---|
571 | between several users using different compilation options |
---|
572 | and without write privileges on shared source directories, etc. |
---|
573 | This also allows to keep source directories uncluttered |
---|
574 | by plenty of object files. |
---|
575 | |
---|
576 | Starting with ASDF 2, the @code{asdf-output-translations} facility |
---|
577 | was added to ASDF itself, that controls where object files will be stored. |
---|
578 | This facility is fully described in a chapter of this manual, |
---|
579 | @ref{Controlling where ASDF saves compiled files}. |
---|
580 | |
---|
581 | The simplest way to add a translation to your search path, |
---|
582 | say from @file{/foo/bar/baz/quux/} |
---|
583 | to @file{/where/i/want/my/fasls/} |
---|
584 | is to create the directory |
---|
585 | @file{~/.config/common-lisp/asdf-output-translations.conf.d/} |
---|
586 | and there create a file with any name of your choice and the type @file{conf}, |
---|
587 | for instance @file{42-bazquux.conf} |
---|
588 | containing the line: |
---|
589 | |
---|
590 | @kbd{("/foo/bar/baz/quux/" "/where/i/want/my/fasls/")} |
---|
591 | |
---|
592 | To disable output translations for source under a given directory, |
---|
593 | say @file{/toto/tata/} |
---|
594 | you can create a file @file{40-disable-toto.conf} |
---|
595 | with the line: |
---|
596 | |
---|
597 | @kbd{("/toto/tata/")} |
---|
598 | |
---|
599 | To wholly disable output translations for all directories, |
---|
600 | you can create a file @file{00-disable.conf} |
---|
601 | with the line: |
---|
602 | |
---|
603 | @kbd{(t t)} |
---|
604 | |
---|
605 | Note that your Operating System distribution or your system administrator |
---|
606 | may already have configured translations for you. |
---|
607 | In absence of any configuration, the default is to redirect everything |
---|
608 | under an implementation-dependent subdirectory of @file{~/.cache/common-lisp/}. |
---|
609 | @xref{Controlling where ASDF searches for systems}, for full details. |
---|
610 | |
---|
611 | The required @file{.conf} extension allows you to have disabled files |
---|
612 | or editor backups (ending in @file{~}), and works portably |
---|
613 | (for instance, it is a pain to allow both empty and non-empty extension on CLISP). |
---|
614 | Excluded are files the name of which start with a @file{.} character. |
---|
615 | It is customary to start the filename with two digits |
---|
616 | that specify the order in which the directories will be scanned. |
---|
617 | |
---|
618 | ASDF will automatically read your configuration |
---|
619 | the first time you try to find a system. |
---|
620 | You can reset the source-registry configuration with: |
---|
621 | |
---|
622 | @lisp |
---|
623 | (asdf:clear-output-translations) |
---|
624 | @end lisp |
---|
625 | |
---|
626 | And you probably should do so before you dump your Lisp image, |
---|
627 | if the configuration may change |
---|
628 | between the machine where you save it at the time you save it |
---|
629 | and the machine you resume it at the time you resume it. |
---|
630 | (Once again, you should use @code{(asdf:clear-configuration)} |
---|
631 | before you dump your Lisp image, which includes the above.) |
---|
632 | |
---|
633 | Finally note that before ASDF 2, |
---|
634 | other ASDF add-ons offered the same functionality, |
---|
635 | each in subtly different and incompatible ways: |
---|
636 | ASDF-Binary-Locations, cl-launch, common-lisp-controller. |
---|
637 | ASDF-Binary-Locations is now not needed anymore and should not be used. |
---|
638 | cl-launch 3.000 and common-lisp-controller 7.2 have been updated |
---|
639 | to just delegate this functionality to ASDF. |
---|
640 | |
---|
641 | @node Using ASDF, Defining systems with defsystem, Configuring ASDF, Top |
---|
642 | @comment node-name, next, previous, up |
---|
643 | |
---|
644 | |
---|
645 | @section Resetting Configuration |
---|
646 | |
---|
647 | When you dump and restore an image, or when you tweak your configuration, |
---|
648 | you may want to reset the ASDF configuration. |
---|
649 | For that you may use the following function: |
---|
650 | |
---|
651 | @defun clear-configuration |
---|
652 | undoes any ASDF configuration, |
---|
653 | regarding source-registry or output-translations. |
---|
654 | @end defun |
---|
655 | |
---|
656 | If you use SBCL, CMUCL or SCL, you may use this snippet |
---|
657 | so that the ASDF configuration be cleared automatically as you dump an image: |
---|
658 | |
---|
659 | @example |
---|
660 | #+(or cmu sbcl scl) |
---|
661 | (pushnew 'clear-configuration |
---|
662 | #+(or cmu scl) ext:*before-save-initializations* |
---|
663 | #+sbcl sb-ext:*save-hooks*) |
---|
664 | @end example |
---|
665 | |
---|
666 | For compatibility with all Lisp implementations, however, |
---|
667 | you might want instead your build script to explicitly call |
---|
668 | @code{(asdf:clear-configuration)} at an appropriate moment before dumping. |
---|
669 | |
---|
670 | |
---|
671 | @chapter Using ASDF |
---|
672 | |
---|
673 | @section Loading a system |
---|
674 | |
---|
675 | The system @var{foo} is loaded (and compiled, if necessary) |
---|
676 | by evaluating the following Lisp form: |
---|
677 | |
---|
678 | @example |
---|
679 | (asdf:load-system :@var{foo}) |
---|
680 | @end example |
---|
681 | |
---|
682 | On some implementations (namely recent versions of |
---|
683 | ABCL, Allegro CL, Clozure CL, CMUCL, ECL, GNU CLISP, |
---|
684 | LispWorks, MKCL, SBCL and XCL), |
---|
685 | ASDF hooks into the @code{CL:REQUIRE} facility |
---|
686 | and you can just use: |
---|
687 | |
---|
688 | @example |
---|
689 | (require :@var{foo}) |
---|
690 | @end example |
---|
691 | |
---|
692 | In older versions of ASDF, you needed to use |
---|
693 | @code{(asdf:oos 'asdf:load-op :@var{foo})}. |
---|
694 | If your ASDF is too old to provide @code{asdf:load-system} though |
---|
695 | we recommend that you upgrade to ASDF 3. |
---|
696 | @xref{Loading ASDF,,Loading an otherwise installed ASDF}. |
---|
697 | |
---|
698 | Note the name of a system is specified as a string or a symbol, |
---|
699 | typically a keyword. |
---|
700 | If a symbol (including a keyword), its name is taken and lowercased. |
---|
701 | The name must be a suitable value for the @code{:name} initarg |
---|
702 | to @code{make-pathname} in whatever filesystem the system is to be found. |
---|
703 | The lower-casing-symbols behaviour is unconventional, |
---|
704 | but was selected after some consideration. |
---|
705 | Observations suggest that the type of systems we want to support |
---|
706 | either have lowercase as customary case (unix, mac, windows) |
---|
707 | or silently convert lowercase to uppercase (lpns), |
---|
708 | so this makes more sense than attempting to use @code{:case :common}, |
---|
709 | which is reported not to work on some implementations |
---|
710 | |
---|
711 | |
---|
712 | @section Other Operations |
---|
713 | |
---|
714 | ASDF provides three commands for the most common system operations: |
---|
715 | @code{load-system}, @code{compile-system} or @code{test-system}. |
---|
716 | It also provides @code{require-system}, a version of @code{load-system} |
---|
717 | that skips trying to update systems that are already loaded. |
---|
718 | |
---|
719 | Because ASDF is an extensible system |
---|
720 | for defining @emph{operations} on @emph{components}, |
---|
721 | it also provides a generic function @code{operate} |
---|
722 | (which is usually abbreviated by @code{oos}). |
---|
723 | You'll use @code{oos} whenever you want to do something beyond |
---|
724 | compiling, loading and testing. |
---|
725 | |
---|
726 | Output from ASDF and ASDF extensions are supposed to be sent |
---|
727 | to the CL stream @code{*standard-output*}, |
---|
728 | and so rebinding that stream around calls to @code{asdf:operate} |
---|
729 | should redirect all output from ASDF operations. |
---|
730 | |
---|
731 | Reminder: before ASDF can operate on a system, however, |
---|
732 | it must be able to find and load that system's definition. |
---|
733 | @xref{Configuring ASDF,,Configuring ASDF to find your systems}. |
---|
734 | |
---|
735 | @findex already-loaded-systems |
---|
736 | |
---|
737 | For the advanced users, note that |
---|
738 | @code{require-system} calls @code{load-system} |
---|
739 | with keyword arguments @code{:force-not (already-loaded-systems)}. |
---|
740 | @code{already-loaded-systems} returns a list of the names of loaded systems. |
---|
741 | @code{load-system} applies @code{operate} with the operation from |
---|
742 | @code{*load-system-operation*}, which by default is @code{load-op}, |
---|
743 | the system, and any provided keyword arguments. |
---|
744 | |
---|
745 | @section Summary |
---|
746 | |
---|
747 | To use ASDF: |
---|
748 | |
---|
749 | @itemize |
---|
750 | @item |
---|
751 | Load ASDF itself into your Lisp image, either through |
---|
752 | @code{(require "asdf")} or else through |
---|
753 | @code{(load "/path/to/asdf.lisp")}. |
---|
754 | |
---|
755 | @item |
---|
756 | Make sure ASDF can find system definitions |
---|
757 | thanks to proper source-registry configuration. |
---|
758 | |
---|
759 | @item |
---|
760 | Load a system with @code{(asdf:load-system :my-system)} |
---|
761 | or use some other operation on some system of your choice. |
---|
762 | |
---|
763 | @end itemize |
---|
764 | |
---|
765 | @section Moving on |
---|
766 | |
---|
767 | That's all you need to know to use ASDF to load systems written by others. |
---|
768 | The rest of this manual deals with writing system definitions |
---|
769 | for Common Lisp software you write yourself, |
---|
770 | including how to extend ASDF to define new operation and component types. |
---|
771 | |
---|
772 | |
---|
773 | @node Defining systems with defsystem, The object model of ASDF, Using ASDF, Top |
---|
774 | @comment node-name, next, previous, up |
---|
775 | @chapter Defining systems with defsystem |
---|
776 | |
---|
777 | This chapter describes how to use asdf to define systems and develop |
---|
778 | software. |
---|
779 | |
---|
780 | |
---|
781 | @menu |
---|
782 | * The defsystem form:: |
---|
783 | * A more involved example:: |
---|
784 | * The defsystem grammar:: |
---|
785 | * Other code in .asd files:: |
---|
786 | * The package-system extension:: |
---|
787 | @end menu |
---|
788 | |
---|
789 | @node The defsystem form, A more involved example, Defining systems with defsystem, Defining systems with defsystem |
---|
790 | @comment node-name, next, previous, up |
---|
791 | @section The defsystem form |
---|
792 | |
---|
793 | Systems can be constructed programmatically |
---|
794 | by instantiating components using @code{make-instance}. |
---|
795 | Most of the time, however, it is much more practical to use |
---|
796 | a static @code{defsystem} form. |
---|
797 | This section begins with an example of a system definition, |
---|
798 | then gives the full grammar of @code{defsystem}. |
---|
799 | |
---|
800 | Let's look at a simple system. |
---|
801 | This is a complete file that would |
---|
802 | usually be saved as @file{hello-lisp.asd}: |
---|
803 | |
---|
804 | @lisp |
---|
805 | (in-package :asdf) |
---|
806 | |
---|
807 | (defsystem "hello-lisp" |
---|
808 | :description "hello-lisp: a sample Lisp system." |
---|
809 | :version "0.2.1" |
---|
810 | :author "Joe User <joe@@example.com>" |
---|
811 | :licence "Public Domain" |
---|
812 | :components ((:file "packages") |
---|
813 | (:file "macros" :depends-on ("packages")) |
---|
814 | (:file "hello" :depends-on ("macros")))) |
---|
815 | @end lisp |
---|
816 | |
---|
817 | Some notes about this example: |
---|
818 | |
---|
819 | @itemize |
---|
820 | |
---|
821 | @item |
---|
822 | The file starts with an @code{in-package} form |
---|
823 | to use package @code{asdf}. |
---|
824 | You could instead start your definition by using |
---|
825 | a qualified name @code{asdf:defsystem}. |
---|
826 | |
---|
827 | @item |
---|
828 | If in addition to simply using @code{defsystem}, |
---|
829 | you are going to define functions, |
---|
830 | create ASDF extension, globally bind symbols, etc., |
---|
831 | it is recommended that to avoid namespace pollution between systems, |
---|
832 | you should create your own package for that purpose, |
---|
833 | for instance replacing the above @code{(in-package :asdf)} with: |
---|
834 | |
---|
835 | @lisp |
---|
836 | (defpackage :foo-system |
---|
837 | (:use :cl :asdf)) |
---|
838 | |
---|
839 | (in-package :foo-system) |
---|
840 | @end lisp |
---|
841 | |
---|
842 | @item |
---|
843 | The @code{defsystem} form defines a system named @code{hello-lisp} |
---|
844 | that contains three source files: |
---|
845 | @file{packages}, @file{macros} and @file{hello}. |
---|
846 | |
---|
847 | @item |
---|
848 | The file @file{macros} depends on @file{packages} |
---|
849 | (presumably because the package it's in is defined in @file{packages}), |
---|
850 | and the file @file{hello} depends on @file{macros} |
---|
851 | (and hence, transitively on @file{packages}). |
---|
852 | This means that ASDF will compile and load @file{packages} and @file{macros} |
---|
853 | before starting the compilation of file @file{hello}. |
---|
854 | |
---|
855 | @item |
---|
856 | The files are located in the same directory |
---|
857 | as the file with the system definition. |
---|
858 | ASDF resolves symbolic links (or Windows shortcuts) |
---|
859 | before loading the system definition file and |
---|
860 | stores its location in the resulting system@footnote{ |
---|
861 | It is possible, though almost never necessary, to override this behaviour.}. |
---|
862 | This is a good thing because the user can move the system sources |
---|
863 | without having to edit the system definition. |
---|
864 | |
---|
865 | @c FIXME: Should have cross-reference to "Version specifiers" in the |
---|
866 | @c defsystem grammar, but the cross-referencing is so broken by |
---|
867 | @c insufficient node breakdown that I have not put one in. |
---|
868 | @item |
---|
869 | Make sure you know how the @code{:version} numbers will be parsed! |
---|
870 | They are parsed as period-separated lists of integers. |
---|
871 | I.e., in the example, @code{0.2.1} is to be interpreted, |
---|
872 | roughly speaking, as @code{(0 2 1)}. |
---|
873 | In particular, version @code{0.2.1} |
---|
874 | is interpreted the same as @code{0.0002.1} and |
---|
875 | is strictly version-less-than version @code{0.20.1}, |
---|
876 | even though the two are the same when interpreted as decimal fractions. |
---|
877 | Instead of a string representing the version, |
---|
878 | the @code{:version} argument can be an expression that is resolved to |
---|
879 | such a string using the following trivial domain-specific language: |
---|
880 | in addition to being a literal string, it can be an expression of the form |
---|
881 | @code{(:read-file-form <pathname-or-string> :at <access-at-specifier>)}, |
---|
882 | which will be resolved by reading a form in the specified pathname |
---|
883 | (read as a subpathname of the current system if relative or a unix-namestring). |
---|
884 | You may use a @code{uiop:access-at} specifier |
---|
885 | with the (optional) @code{:at} keyword, |
---|
886 | by default the specifier is @code{0}, meaning the first form is returned. |
---|
887 | |
---|
888 | @cindex :version |
---|
889 | |
---|
890 | @end itemize |
---|
891 | |
---|
892 | @node A more involved example, The defsystem grammar, The defsystem form, Defining systems with defsystem |
---|
893 | @comment node-name, next, previous, up |
---|
894 | @section A more involved example |
---|
895 | |
---|
896 | Let's illustrate some more involved uses of @code{defsystem} via a |
---|
897 | slightly convoluted example: |
---|
898 | |
---|
899 | @lisp |
---|
900 | (defsystem "foo" |
---|
901 | :version "1.0.0" |
---|
902 | :components ((:module "mod" |
---|
903 | :components ((:file "bar") |
---|
904 | (:file"baz") |
---|
905 | (:file "quux")) |
---|
906 | :perform (compile-op :after (op c) |
---|
907 | (do-something c)) |
---|
908 | :explain (compile-op :after (op c) |
---|
909 | (explain-something c))) |
---|
910 | (:file "blah"))) |
---|
911 | @end lisp |
---|
912 | |
---|
913 | The @code{:module} component named @code{"mod"} is a collection of three files, |
---|
914 | which will be located in a subdirectory of the main code directory named |
---|
915 | @file{mod} (this location can be overridden; see the discussion of the |
---|
916 | @code{:pathname} option in @ref{The defsystem grammar}). |
---|
917 | |
---|
918 | The method-form tokens provide a shorthand for defining methods on |
---|
919 | particular components. This part |
---|
920 | |
---|
921 | @lisp |
---|
922 | :perform (compile-op :after (op c) |
---|
923 | (do-something c)) |
---|
924 | :explain (compile-op :after (op c) |
---|
925 | (explain-something c)) |
---|
926 | @end lisp |
---|
927 | |
---|
928 | has the effect of |
---|
929 | |
---|
930 | @lisp |
---|
931 | (defmethod perform :after ((op compile-op) (c (eql ...))) |
---|
932 | (do-something c)) |
---|
933 | (defmethod explain :after ((op compile-op) (c (eql ...))) |
---|
934 | (explain-something c)) |
---|
935 | @end lisp |
---|
936 | |
---|
937 | where @code{...} is the component in question. |
---|
938 | In this case @code{...} would expand to something like |
---|
939 | |
---|
940 | @lisp |
---|
941 | (find-component "foo" "mod") |
---|
942 | @end lisp |
---|
943 | |
---|
944 | For more details on the syntax of such forms, see @ref{The defsystem |
---|
945 | grammar}. |
---|
946 | For more details on what these methods do, @pxref{Operations} in |
---|
947 | @ref{The object model of ASDF}. |
---|
948 | |
---|
949 | @c The following plunge into the weeds is not appropriate in this |
---|
950 | @c location. [2010/10/03:rpg] |
---|
951 | @c note that although this also supports @code{:before} methods, |
---|
952 | @c they may not do what you want them to --- |
---|
953 | @c a @code{:before} method on perform @code{((op compile-op) (c (eql ...)))} |
---|
954 | @c will run after all the dependencies and sub-components have been processed, |
---|
955 | @c but before the component in question has been compiled. |
---|
956 | |
---|
957 | @node The defsystem grammar, Other code in .asd files, A more involved example, Defining systems with defsystem |
---|
958 | @comment node-name, next, previous, up |
---|
959 | @section The defsystem grammar |
---|
960 | |
---|
961 | @c FIXME: @var typesetting not consistently used here. We should either expand |
---|
962 | @c its use to everywhere, or we should kill it everywhere. |
---|
963 | |
---|
964 | |
---|
965 | @example |
---|
966 | system-definition := ( defsystem system-designator @var{system-option}* ) |
---|
967 | |
---|
968 | system-option := :defsystem-depends-on system-list |
---|
969 | | :weakly-depends-on @var{system-list} |
---|
970 | | :class class-name (see discussion below) |
---|
971 | | module-option |
---|
972 | | option |
---|
973 | |
---|
974 | module-option := :components component-list |
---|
975 | | :serial [ t | nil ] |
---|
976 | |
---|
977 | option := |
---|
978 | | :pathname pathname-specifier |
---|
979 | | :default-component-class class-name |
---|
980 | | :perform method-form |
---|
981 | | :explain method-form |
---|
982 | | :output-files method-form |
---|
983 | | :operation-done-p method-form |
---|
984 | | :if-feature feature-expression |
---|
985 | | :depends-on ( @var{dependency-def}* ) |
---|
986 | | :in-order-to ( @var{dependency}+ ) |
---|
987 | |
---|
988 | |
---|
989 | system-list := ( @var{simple-component-name}* ) |
---|
990 | |
---|
991 | component-list := ( @var{component-def}* ) |
---|
992 | |
---|
993 | component-def := ( component-type simple-component-name @var{option}* ) |
---|
994 | |
---|
995 | component-type := :module | :file | :static-file | other-component-type |
---|
996 | |
---|
997 | other-component-type := symbol-by-name (@pxref{The defsystem grammar,,Component types}) |
---|
998 | |
---|
999 | # This is used in :depends-on, as opposed to ``dependency,'' |
---|
1000 | # which is used in :in-order-to |
---|
1001 | dependency-def := simple-component-name |
---|
1002 | | (feature @var{feature-name}) |
---|
1003 | | ( :version simple-component-name version-specifier) |
---|
1004 | |
---|
1005 | # ``dependency'' is used in :in-order-to, as opposed to |
---|
1006 | # ``dependency-def'' |
---|
1007 | dependency := (dependent-op @var{requirement}+) |
---|
1008 | requirement := (required-op @var{required-component}+) |
---|
1009 | | (:feature @var{feature-name}) |
---|
1010 | dependent-op := operation-name |
---|
1011 | required-op := operation-name |
---|
1012 | |
---|
1013 | simple-component-name := string |
---|
1014 | | symbol |
---|
1015 | |
---|
1016 | pathname-specifier := pathname | string | symbol |
---|
1017 | |
---|
1018 | method-form := (operation-name qual lambda-list @Arest body) |
---|
1019 | qual := method qualifier |
---|
1020 | |
---|
1021 | component-dep-fail-option := :fail | :try-next | :ignore |
---|
1022 | |
---|
1023 | feature-expression := keyword | (:and @var{feature-expression}*) |
---|
1024 | | (:or @var{feature-expression}*) | (:not @var{feature-expression}) |
---|
1025 | @end example |
---|
1026 | |
---|
1027 | |
---|
1028 | @subsection Component names |
---|
1029 | |
---|
1030 | Component names (@code{simple-component-name}) |
---|
1031 | may be either strings or symbols. |
---|
1032 | |
---|
1033 | @subsection Component types |
---|
1034 | |
---|
1035 | Component type names, even if expressed as keywords, will be looked up |
---|
1036 | by name in the current package and in the asdf package, if not found in |
---|
1037 | the current package. So a component type @code{my-component-type}, in |
---|
1038 | the current package @code{my-system-asd} can be specified as |
---|
1039 | @code{:my-component-type}, or @code{my-component-type}. |
---|
1040 | |
---|
1041 | @code{system} and its subclasses are @emph{not} |
---|
1042 | allowed as component types for such children components. |
---|
1043 | |
---|
1044 | @subsection System class names |
---|
1045 | |
---|
1046 | A system class name will be looked up |
---|
1047 | in the same way as a Component type (see above), |
---|
1048 | except that only @code{system} and its subclasses are allowed. |
---|
1049 | Typically, one will not need to specify a system |
---|
1050 | class name, unless using a non-standard system class defined in some |
---|
1051 | ASDF extension, typically loaded through @code{DEFSYSTEM-DEPENDS-ON}, |
---|
1052 | see below. For such class names in the ASDF package, we recommend that |
---|
1053 | the @code{:class} option be specified using a keyword symbol, such as |
---|
1054 | |
---|
1055 | @example |
---|
1056 | :class :MY-NEW-SYSTEM-SUBCLASS |
---|
1057 | @end example |
---|
1058 | |
---|
1059 | This practice will ensure that package name conflicts are avoided. |
---|
1060 | Otherwise, the symbol @code{MY-NEW-SYSTEM-SUBCLASS} will be read into |
---|
1061 | the current package @emph{before} it has been exported from the ASDF |
---|
1062 | extension loaded by @code{:defsystem-depends-on}, causing a name |
---|
1063 | conflict in the current package. |
---|
1064 | |
---|
1065 | @subsection Defsystem depends on |
---|
1066 | @cindex :defsystem-depends-on |
---|
1067 | |
---|
1068 | The @code{:defsystem-depends-on} option to @code{defsystem} allows the |
---|
1069 | programmer to specify another ASDF-defined system or set of systems that |
---|
1070 | must be loaded @emph{before} the system definition is processed. |
---|
1071 | Typically this is used to load an ASDF extension that is used in the |
---|
1072 | system definition. |
---|
1073 | |
---|
1074 | @subsection Weakly depends on |
---|
1075 | @cindex :weakly-depends-on |
---|
1076 | |
---|
1077 | We do @emph{NOT} recommend you use this feature. |
---|
1078 | If you are tempted to write a system @var{foo} |
---|
1079 | that weakly-depends-on a system @var{bar}, |
---|
1080 | we recommend that you should instead |
---|
1081 | write system @var{foo} in a parametric way, |
---|
1082 | and offer some special variable and/or some hook to specialize its behavior; |
---|
1083 | then you should write a system @var{foo+bar} |
---|
1084 | that does the hooking of things together. |
---|
1085 | |
---|
1086 | The (deprecated) @code{:weakly-depends-on} option to @code{defsystem} |
---|
1087 | allows the programmer to specify another ASDF-defined system or set of systems |
---|
1088 | that ASDF should @emph{try} to load, |
---|
1089 | but need not load in order to be successful. |
---|
1090 | Typically this is used if there are a number of systems |
---|
1091 | that, if present, could provide additional functionality, |
---|
1092 | but which are not necessary for basic function. |
---|
1093 | |
---|
1094 | Currently, although it is specified to be an option only to @code{defsystem}, |
---|
1095 | this option is accepted at any component, but it probably |
---|
1096 | only makes sense at the @code{defsystem} level. |
---|
1097 | Programmers are cautioned not |
---|
1098 | to use this component option except at the @code{defsystem} level, as |
---|
1099 | this anomalous behavior may be removed without warning. |
---|
1100 | |
---|
1101 | Finally, you might look into the @code{asdf-system-connections} extension, |
---|
1102 | that will let you define additional code to be loaded |
---|
1103 | when two systems are simultaneously loaded. |
---|
1104 | It may or may not be considered good style, but at least it can be used |
---|
1105 | in a way that has deterministic behavior independent of load order, |
---|
1106 | unlike @code{weakly-depends-on}. |
---|
1107 | |
---|
1108 | |
---|
1109 | @subsection Pathname specifiers |
---|
1110 | @cindex pathname specifiers |
---|
1111 | |
---|
1112 | A pathname specifier (@code{pathname-specifier}) |
---|
1113 | may be a pathname, a string or a symbol. |
---|
1114 | When no pathname specifier is given for a component, |
---|
1115 | which is the usual case, the component name itself is used. |
---|
1116 | |
---|
1117 | If a string is given, which is the usual case, |
---|
1118 | the string will be interpreted as a Unix-style pathname |
---|
1119 | where @code{/} characters will be interpreted as directory separators. |
---|
1120 | Usually, Unix-style relative pathnames are used |
---|
1121 | (i.e. not starting with @code{/}, as opposed to absolute pathnames); |
---|
1122 | they are relative to the path of the parent component. |
---|
1123 | Finally, depending on the @code{component-type}, |
---|
1124 | the pathname may be interpreted as either a file or a directory, |
---|
1125 | and if it's a file, |
---|
1126 | a file type may be added corresponding to the @code{component-type}, |
---|
1127 | or else it will be extracted from the string itself (if applicable). |
---|
1128 | |
---|
1129 | For instance, the @code{component-type} @code{:module} |
---|
1130 | wants a directory pathname, and so a string @code{"foo/bar"} |
---|
1131 | will be interpreted as the pathname @file{#p"foo/bar/"}. |
---|
1132 | On the other hand, the @code{component-type} @code{:file} |
---|
1133 | wants a file of type @code{lisp}, and so a string @code{"foo/bar"} |
---|
1134 | will be interpreted as the pathname @file{#p"foo/bar.lisp"}, |
---|
1135 | and a string @code{"foo/bar.quux"} |
---|
1136 | will be interpreted as the pathname @file{#p"foo/bar.quux.lisp"}. |
---|
1137 | Finally, the @code{component-type} @code{:static-file} |
---|
1138 | wants a file without specifying a type, and so a string @code{"foo/bar"} |
---|
1139 | will be interpreted as the pathname @file{#p"foo/bar"}, |
---|
1140 | and a string @code{"foo/bar.quux"} |
---|
1141 | will be interpreted as the pathname @file{#p"foo/bar.quux"}. |
---|
1142 | |
---|
1143 | ASDF does not interpret the string @code{".."} to designate the parent |
---|
1144 | directory. This string will be passed through to the underlying |
---|
1145 | operating system for interpretation. We @emph{believe} that this will |
---|
1146 | work on all platforms where ASDF is deployed, but do not guarantee this |
---|
1147 | behavior. A pathname object with a relative directory component of |
---|
1148 | @code{:up} or @code{:back} is the only guaranteed way to specify a |
---|
1149 | parent directory. |
---|
1150 | |
---|
1151 | If a symbol is given, it will be translated into a string, |
---|
1152 | and downcased in the process. |
---|
1153 | The downcasing of symbols is unconventional, |
---|
1154 | but was selected after some consideration. |
---|
1155 | Observations suggest that the type of systems we want to support |
---|
1156 | either have lowercase as customary case (Unix, Mac, windows) |
---|
1157 | or silently convert lowercase to uppercase (lpns), |
---|
1158 | so this makes more sense than attempting to use @code{:case :common} |
---|
1159 | as argument to @code{make-pathname}, |
---|
1160 | which is reported not to work on some implementations. |
---|
1161 | |
---|
1162 | Pathname objects may be given to override the path for a component. |
---|
1163 | Such objects are typically specified using reader macros such as @code{#p} |
---|
1164 | or @code{#.(make-pathname ...)}. |
---|
1165 | Note however, that @code{#p...} is |
---|
1166 | a shorthand for @code{#.(parse-namestring ...)} |
---|
1167 | and that the behavior of @code{parse-namestring} is completely non-portable, |
---|
1168 | unless you are using Common Lisp @code{logical-pathname}s, |
---|
1169 | which themselves involve other non-portable behavior |
---|
1170 | (@pxref{The defsystem grammar,,Using logical pathnames}, below). |
---|
1171 | Pathnames made with @code{#.(make-pathname ...)} |
---|
1172 | can usually be done more easily with the string syntax above. |
---|
1173 | The only case that you really need a pathname object is to override |
---|
1174 | the component-type default file type for a given component. |
---|
1175 | Therefore, pathname objects should only rarely be used. |
---|
1176 | Unhappily, ASDF 1 didn't properly support |
---|
1177 | parsing component names as strings specifying paths with directories, |
---|
1178 | and the cumbersome @code{#.(make-pathname ...)} syntax had to be used. |
---|
1179 | An alternative to @code{#.} read-time evaluation is to use |
---|
1180 | @code{(eval `(defsystem ... ,pathname ...))}. |
---|
1181 | |
---|
1182 | Note that when specifying pathname objects, |
---|
1183 | ASDF does not do any special interpretation of the pathname |
---|
1184 | influenced by the component type, unlike the procedure for |
---|
1185 | pathname-specifying strings. |
---|
1186 | On the one hand, you have to be careful to provide a pathname that correctly |
---|
1187 | fulfills whatever constraints are required from that component type |
---|
1188 | (e.g. naming a directory or a file with appropriate type); |
---|
1189 | on the other hand, you can circumvent the file type that would otherwise |
---|
1190 | be forced upon you if you were specifying a string. |
---|
1191 | |
---|
1192 | @subsection Version specifiers |
---|
1193 | @cindex version specifiers |
---|
1194 | @cindex :version |
---|
1195 | |
---|
1196 | Version specifiers are strings to be parsed as period-separated lists of integers. |
---|
1197 | I.e., in the example, @code{"0.2.1"} is to be interpreted, |
---|
1198 | roughly speaking, as @code{(0 2 1)}. |
---|
1199 | In particular, version @code{"0.2.1"} is interpreted the same as @code{"0.0002.1"}, |
---|
1200 | though the latter is not canonical and may lead to a warning being issued. |
---|
1201 | Also, @code{"1.3"} and @code{"1.4"} are both strictly @code{uiop:version<} to @code{"1.30"}, |
---|
1202 | quite unlike what would have happened |
---|
1203 | had the version strings been interpreted as decimal fractions. |
---|
1204 | |
---|
1205 | System definers are encouraged to use version identifiers of the form |
---|
1206 | @var{x}.@var{y}.@var{z} for |
---|
1207 | major version, minor version and patch level, |
---|
1208 | where significant API incompatibilities are signaled by an increased major number. |
---|
1209 | |
---|
1210 | @xref{Common attributes of components}. |
---|
1211 | |
---|
1212 | |
---|
1213 | @subsection Using logical pathnames |
---|
1214 | @cindex logical pathnames |
---|
1215 | |
---|
1216 | We do not generally recommend the use of logical pathnames, |
---|
1217 | especially not so to newcomers to Common Lisp. |
---|
1218 | However, we do support the use of logical pathnames by old timers, |
---|
1219 | when such is their preference. |
---|
1220 | |
---|
1221 | To use logical pathnames, |
---|
1222 | you will have to provide a pathname object as a @code{:pathname} specifier |
---|
1223 | to components that use it, using such syntax as |
---|
1224 | @code{#p"LOGICAL-HOST:absolute;path;to;component.lisp"}. |
---|
1225 | |
---|
1226 | You only have to specify such logical pathname |
---|
1227 | for your system or some top-level component. |
---|
1228 | Sub-components' relative pathnames, |
---|
1229 | specified using the string syntax for names, |
---|
1230 | will be properly merged with the pathnames of their parents. |
---|
1231 | The specification of a logical pathname host however is @emph{not} |
---|
1232 | otherwise directly supported in the ASDF syntax |
---|
1233 | for pathname specifiers as strings. |
---|
1234 | |
---|
1235 | The @code{asdf-output-translation} layer will |
---|
1236 | avoid trying to resolve and translate logical pathnames. |
---|
1237 | The advantage of this is that |
---|
1238 | you can define yourself what translations you want to use |
---|
1239 | with the logical pathname facility. |
---|
1240 | The disadvantage is that if you do not define such translations, |
---|
1241 | any system that uses logical pathnames will behave differently under |
---|
1242 | asdf-output-translations than other systems you use. |
---|
1243 | |
---|
1244 | If you wish to use logical pathnames you will have to configure the |
---|
1245 | translations yourself before they may be used. |
---|
1246 | ASDF currently provides no specific support |
---|
1247 | for defining logical pathname translations. |
---|
1248 | |
---|
1249 | Note that the reasons we do not recommend logical pathnames are that |
---|
1250 | (1) there is no portable way to set up logical pathnames before they are used, |
---|
1251 | (2) logical pathnames are limited to only portably use |
---|
1252 | a single character case, digits and hyphens. |
---|
1253 | While you can solve the first issue on your own, |
---|
1254 | describing how to do it on each of fifteen implementations supported by ASDF |
---|
1255 | is more than we can document. |
---|
1256 | As for the second issue, mind that the limitation is notably enforced on SBCL, |
---|
1257 | and that you therefore can't portably violate the limitations |
---|
1258 | but must instead define some encoding of your own and add individual mappings |
---|
1259 | to name physical pathnames that do not fit the restrictions. |
---|
1260 | This can notably be a problem when your Lisp files are part of a larger project |
---|
1261 | in which it is common to name files or directories in a way that |
---|
1262 | includes the version numbers of supported protocols, |
---|
1263 | or in which files are shared with software written |
---|
1264 | in different programming languages where conventions include the use of |
---|
1265 | underscores, dots or CamelCase in pathnames. |
---|
1266 | |
---|
1267 | |
---|
1268 | @subsection Serial dependencies |
---|
1269 | @cindex serial dependencies |
---|
1270 | |
---|
1271 | If the @code{:serial t} option is specified for a module, |
---|
1272 | ASDF will add dependencies for each child component, |
---|
1273 | on all the children textually preceding it. |
---|
1274 | This is done as if by @code{:depends-on}. |
---|
1275 | |
---|
1276 | @lisp |
---|
1277 | :serial t |
---|
1278 | :components ((:file "a") (:file "b") (:file "c")) |
---|
1279 | @end lisp |
---|
1280 | |
---|
1281 | is equivalent to |
---|
1282 | |
---|
1283 | @lisp |
---|
1284 | :components ((:file "a") |
---|
1285 | (:file "b" :depends-on ("a")) |
---|
1286 | (:file "c" :depends-on ("a" "b"))) |
---|
1287 | @end lisp |
---|
1288 | |
---|
1289 | |
---|
1290 | @subsection Source location |
---|
1291 | |
---|
1292 | The @code{:pathname} option is optional in all cases for systems |
---|
1293 | defined via @code{defsystem}, |
---|
1294 | and in the usual case the user is recommended not to supply it. |
---|
1295 | |
---|
1296 | Instead, ASDF follows a hairy set of rules that are designed so that |
---|
1297 | @enumerate |
---|
1298 | @item |
---|
1299 | @code{find-system} |
---|
1300 | will load a system from disk |
---|
1301 | and have its pathname default to the right place. |
---|
1302 | |
---|
1303 | @item |
---|
1304 | This pathname information will not be overwritten with |
---|
1305 | @code{*default-pathname-defaults*} |
---|
1306 | (which could be somewhere else altogether) |
---|
1307 | if the user loads up the @file{.asd} file into his editor |
---|
1308 | and interactively re-evaluates that form. |
---|
1309 | @end enumerate |
---|
1310 | |
---|
1311 | If a system is being loaded for the first time, |
---|
1312 | its top-level pathname will be set to: |
---|
1313 | |
---|
1314 | @itemize |
---|
1315 | @item |
---|
1316 | The host/device/directory parts of @code{*load-truename*}, |
---|
1317 | if it is bound. |
---|
1318 | @item |
---|
1319 | @code{*default-pathname-defaults*}, otherwise. |
---|
1320 | @end itemize |
---|
1321 | |
---|
1322 | If a system is being redefined, the top-level pathname will be |
---|
1323 | |
---|
1324 | @itemize |
---|
1325 | @item |
---|
1326 | changed, if explicitly supplied or obtained from @code{*load-truename*} |
---|
1327 | (so that an updated source location is reflected in the system definition) |
---|
1328 | |
---|
1329 | @item |
---|
1330 | changed if it had previously been set from @code{*default-pathname-defaults*} |
---|
1331 | |
---|
1332 | @item |
---|
1333 | left as before, if it had previously been set from @code{*load-truename*} |
---|
1334 | and @code{*load-truename*} is currently unbound |
---|
1335 | (so that a developer can evaluate a @code{defsystem} form |
---|
1336 | from within an editor without clobbering its source location) |
---|
1337 | @end itemize |
---|
1338 | |
---|
1339 | @subsection if-feature option |
---|
1340 | This option allows you to specify a feature expression to be evaluated |
---|
1341 | as if by @code{#+} to conditionally include a component in your build. |
---|
1342 | If the expression is false, the component is dropped |
---|
1343 | as well as any dependency pointing to it. |
---|
1344 | As compared to using @code{#+} which is expanded at read-time, |
---|
1345 | this allows you to have an object in your component hierarchy |
---|
1346 | that can be used for manipulations beside building your project. |
---|
1347 | This option was added in ASDF 3. |
---|
1348 | |
---|
1349 | @subsection if-component-dep-fails option |
---|
1350 | This option was removed in ASDF 3. |
---|
1351 | Its semantics was limited in purpose and dubious to explain, |
---|
1352 | and its implementation was breaking a hole into the ASDF object model. |
---|
1353 | Please use the @code{if-feature} option instead. |
---|
1354 | |
---|
1355 | @node Other code in .asd files, The package-system extension, The defsystem grammar, Defining systems with defsystem |
---|
1356 | @section Other code in .asd files |
---|
1357 | |
---|
1358 | Files containing @code{defsystem} forms |
---|
1359 | are regular Lisp files that are executed by @code{load}. |
---|
1360 | Consequently, you can put whatever Lisp code you like into these files. |
---|
1361 | However, it is recommended to keep such forms to a minimal, |
---|
1362 | and to instead define @code{defsystem} extensions |
---|
1363 | that you use with @code{:defsystem-depends-on}. |
---|
1364 | |
---|
1365 | If however, you might insist on including code in the @code{.asd} file itself, |
---|
1366 | e.g., to examine and adjust the compile-time environment, |
---|
1367 | possibly adding appropriate features to @code{*features*}. |
---|
1368 | If so, here are some conventions we recommend you follow, |
---|
1369 | so that users can control certain details of execution |
---|
1370 | of the Lisp in @file{.asd} files: |
---|
1371 | |
---|
1372 | @itemize |
---|
1373 | @item |
---|
1374 | Any informative output |
---|
1375 | (other than warnings and errors, |
---|
1376 | which are the condition system's to dispose of) |
---|
1377 | should be sent to the standard CL stream @code{*standard-output*}, |
---|
1378 | so that users can easily control the disposition |
---|
1379 | of output from ASDF operations. |
---|
1380 | @end itemize |
---|
1381 | |
---|
1382 | |
---|
1383 | @node The package-system extension, , Other code in .asd files, Defining systems with defsystem |
---|
1384 | @section The package-system extension |
---|
1385 | |
---|
1386 | Starting with ASDF 3.0.3, |
---|
1387 | ASDF supports a one-package-per-file style of programming, |
---|
1388 | whereby each file is its own system, |
---|
1389 | and dependencies are deduced from the @code{defpackage} form. |
---|
1390 | |
---|
1391 | In this style, packages referring to a same-named system (downcased); |
---|
1392 | and if a system is defined with @code{:class package-system}, |
---|
1393 | then system names that start with that name |
---|
1394 | (using the slash @code{/} separator) |
---|
1395 | refer to files under the filesystem hierarchy where the system is defined. |
---|
1396 | For instance, if system @code{my-lib} is defined in |
---|
1397 | @file{/foo/bar/my-lib/my-lib.asd}, then system @code{my-lib/src/utility} |
---|
1398 | will be found in file @file{/foo/bar/my-lib/src/utility.lisp}. |
---|
1399 | |
---|
1400 | This style was made popular by @code{faslpath} and @code{quick-build} before, |
---|
1401 | and at the cost of a stricter package discipline, |
---|
1402 | seems to make for more maintainable code. |
---|
1403 | It is used by ASDF itself (starting with ASDF 3) and by @code{lisp-interface-library}. |
---|
1404 | |
---|
1405 | To use this style, choose a toplevel system name, e.g. @code{my-lib}, |
---|
1406 | and create a file @file{my-lib.asd} |
---|
1407 | with the @code{:class :package-system} option in its @code{defsystem}. |
---|
1408 | For instance: |
---|
1409 | @example |
---|
1410 | #-asdf (error "my-lib requires ASDF 3") |
---|
1411 | (defsystem my-lib |
---|
1412 | :class :package-system |
---|
1413 | :defsystem-depends-on (:asdf-package-system) |
---|
1414 | :depends-on (:my-lib/src/all) |
---|
1415 | :in-order-to ((test-op (load-op :my-lib/test/all))) |
---|
1416 | :perform (test-op (o c) (symbol-call :my-lib/test/all :test-suite))) |
---|
1417 | (register-system-packages :closer-mop |
---|
1418 | '(:c2mop :closer-common-lisp :c2cl :closer-common-lisp-user :c2cl-user)) |
---|
1419 | @end example |
---|
1420 | |
---|
1421 | In the code above, the |
---|
1422 | @code{:defsystem-depends-on (:asdf-package-system)} is |
---|
1423 | for compatibility with older versions of ASDF 3 (ASDF 2 not supported), |
---|
1424 | and requires the @code{asdf-package-system} library to be present |
---|
1425 | (it is implicitly provided by ASDF starting with ASDF 3.0.3). |
---|
1426 | |
---|
1427 | The function @code{register-system-packages} has to be called to register |
---|
1428 | packages used or provided by your system and its components |
---|
1429 | where the name of the system that provides the package |
---|
1430 | is not the downcase of the package name. |
---|
1431 | |
---|
1432 | File @file{my-lib/src/utility.lisp} might start with: |
---|
1433 | |
---|
1434 | @example |
---|
1435 | (defpackage :my-lib/src/utility |
---|
1436 | (:use :closer-common-lisp :my-lib/src/macros :my-lib/src/variables) |
---|
1437 | (:import-from :cl-ppcre #:register-groups-bind) |
---|
1438 | (:export #:foo #:bar)) |
---|
1439 | @end example |
---|
1440 | |
---|
1441 | And from the @code{:use} and @code{:import-from} clauses, |
---|
1442 | ASDF could tell that you depend on systems @code{closer-mop} (registered above), |
---|
1443 | @code{cl-ppcre} (package and system names match), and |
---|
1444 | @code{my-lib/src/macros} and @code{my-lib/src/variables} |
---|
1445 | (package and system names match, and they will be looked up hierarchically). |
---|
1446 | |
---|
1447 | The form @code{uiop:define-package} is supported as well as @code{defpackage}, |
---|
1448 | and has many options that prove useful in this context, |
---|
1449 | such as @code{:use-reexport} and @code{:mix-reexport} |
---|
1450 | that allow for ``inheritance'' of symbols being exported. |
---|
1451 | |
---|
1452 | @node The object model of ASDF, Controlling where ASDF searches for systems, Defining systems with defsystem, Top |
---|
1453 | @comment node-name, next, previous, up |
---|
1454 | @chapter The object model of ASDF |
---|
1455 | |
---|
1456 | ASDF is designed in an object-oriented way from the ground up. |
---|
1457 | Both a system's structure and the operations that can be performed on systems |
---|
1458 | follow a extensible protocol. |
---|
1459 | |
---|
1460 | This allows the addition of behaviours: |
---|
1461 | for example, @code{cffi} adds support of special FFI description files |
---|
1462 | to interface with C libraries and of wrapper files to embed C code in Lisp; |
---|
1463 | @code{abcl-jar} supports creating Java JAR archives in ABCL; |
---|
1464 | and @code{poiu} supports for compiling code in parallel using background processes. |
---|
1465 | |
---|
1466 | This chapter deals with @code{component}s and @code{operation}s. |
---|
1467 | |
---|
1468 | A @code{component} represents an individual source file or a group of source files, |
---|
1469 | and the things that get transformed into. |
---|
1470 | A @code{system} is a component at the top level of the component hierarchy. |
---|
1471 | A @code{source-file} is a component representing a single source-file |
---|
1472 | and the successive output files into which it is transformed. |
---|
1473 | A @code{module} is an intermediate component itself grouping several other components, |
---|
1474 | themselves source-files or further modules. |
---|
1475 | |
---|
1476 | An @code{Operation} represents a transformation that can be performed on a component, |
---|
1477 | turning them from source files to intermediate results to final outputs. |
---|
1478 | |
---|
1479 | A pair of an @code{operation} and a @code{component} is called an @code{action}. |
---|
1480 | An @code{action} represents a particular build step to be @code{perform}ed, |
---|
1481 | after all its dependencies have been fulfilled. |
---|
1482 | In the ASDF model, actions depend on other actions. |
---|
1483 | The term @emph{action} itself was used by Kent Pitman in his old article, |
---|
1484 | but was only used by ASDF hackers starting with the ASDF 2; |
---|
1485 | but the concept is ubiquitous since the very beginning of ASDF 1, |
---|
1486 | though previously implicit. |
---|
1487 | |
---|
1488 | Then, there are many @emph{functions} available |
---|
1489 | to users, extenders and implementers of ASDF |
---|
1490 | to use, define or implement the activities |
---|
1491 | that are part of building your software. |
---|
1492 | Though they manipulate @code{action}s, |
---|
1493 | most of these functions do not take as an argument |
---|
1494 | a reified pair (a @code{cons} cell) of an operation and a component; |
---|
1495 | instead, they usually take two separate arguments, |
---|
1496 | which allows to take advantage of the power CLOS-style multiple dispatch |
---|
1497 | for fun and profit. |
---|
1498 | |
---|
1499 | There are many @emph{hooks} in which to add functionality, |
---|
1500 | by customizing the behavior of existing @emph{functions}. |
---|
1501 | |
---|
1502 | Last but not least is the notion of @emph{dependency} between two actions. |
---|
1503 | The structure of dependencies between actions is |
---|
1504 | a directed @emph{dependency graph}. |
---|
1505 | ASDF is invoked by being told to @emph{operate} |
---|
1506 | with some @emph{operation} on some toplevel @emph{system}; |
---|
1507 | it will then @emph{traverse} the graph and build a @emph{plan} |
---|
1508 | that follows its structure. |
---|
1509 | To be successfully buildable, this graph of actions but be acyclic. |
---|
1510 | If, as a user, extender or implementer of ASDF, you fail |
---|
1511 | to keep the dependency graph without cycles, |
---|
1512 | ASDF will fail loudly as it eventually finds one. |
---|
1513 | To clearly distinguish the direction of dependencies, |
---|
1514 | ASDF 3 uses the words @emph{requiring} and @emph{required} |
---|
1515 | as applied to an action depending on the other: |
---|
1516 | the requiring action @code{depends-on} the completion of all required actions |
---|
1517 | before it may itself be @code{perform}ed. |
---|
1518 | |
---|
1519 | Using the @code{defsystem} syntax, users may easily express |
---|
1520 | direct dependencies along the graph of the object hierarchy: |
---|
1521 | between a component and its parent, its children, and its siblings. |
---|
1522 | By defining custom CLOS methods, you can express more elaborate dependencies as you wish. |
---|
1523 | Most common operations, such as @code{load-op}, @code{compile-op} or @code{load-source-op} |
---|
1524 | are automatically propagate ``downward'' the component hierarchy and are ``covariant'' with it: |
---|
1525 | to act the operation on the parent module, you must first act it on all the children components, |
---|
1526 | with the action on the parent being parent of the action on each child. |
---|
1527 | Other operations, such as @code{prepare-op} and @code{prepare-source-op} |
---|
1528 | (introduced in ASDF 3) are automatically propagated ``upward'' the component hierarchy |
---|
1529 | and are ``contravariant'' with it: |
---|
1530 | to perform the operation of preparing for compilation of a child component, |
---|
1531 | you must perform the operation of preparing for compilation of its parent component, and so on, |
---|
1532 | ensuring that all the parent's dependencies are (compiled and) loaded |
---|
1533 | before the child component may be compiled and loaded. |
---|
1534 | Yet other operations, such as @code{test-op} or @code{load-fasl-op} |
---|
1535 | remain at the system level, and are not propagated along the hierarchy, |
---|
1536 | but instead do something global on the system. |
---|
1537 | |
---|
1538 | @menu |
---|
1539 | * Operations:: |
---|
1540 | * Components:: |
---|
1541 | * Functions:: |
---|
1542 | @end menu |
---|
1543 | |
---|
1544 | @node Operations, Components, The object model of ASDF, The object model of ASDF |
---|
1545 | @comment node-name, next, previous, up |
---|
1546 | @section Operations |
---|
1547 | @cindex operation |
---|
1548 | |
---|
1549 | An @dfn{operation} object of the appropriate type is instantiated |
---|
1550 | whenever the user wants to do something with a system like |
---|
1551 | |
---|
1552 | @itemize |
---|
1553 | @item compile all its files |
---|
1554 | @item load the files into a running lisp environment |
---|
1555 | @item copy its source files somewhere else |
---|
1556 | @end itemize |
---|
1557 | |
---|
1558 | Operations can be invoked directly, or examined |
---|
1559 | to see what their effects would be without performing them. |
---|
1560 | There are a bunch of methods specialised on operation and component type |
---|
1561 | that actually do the grunt work. |
---|
1562 | |
---|
1563 | The operation object contains whatever state is relevant for this purpose |
---|
1564 | (perhaps a list of visited nodes, for example) |
---|
1565 | but primarily is a nice thing to specialise operation methods on |
---|
1566 | and easier than having them all be @code{EQL} methods. |
---|
1567 | |
---|
1568 | Operations are invoked on systems via @code{operate}. |
---|
1569 | @anchor{operate} |
---|
1570 | @deffn {Generic function} @code{operate} @var{operation} @var{system} @Arest @var{initargs} @Akey @code{force} @code{force-not} @code{verbose} @AallowOtherKeys |
---|
1571 | @deffnx {Generic function} @code{oos} @var{operation} @var{system} @Arest @var{initargs} @Akey @AallowOtherKeys |
---|
1572 | @code{operate} invokes @var{operation} on @var{system}. |
---|
1573 | @code{oos} is a synonym for @code{operate}. |
---|
1574 | |
---|
1575 | @var{operation} is a symbol that is passed, along with the supplied |
---|
1576 | @var{initargs}, to @code{make-instance} to create the operation object. |
---|
1577 | @var{system} is a system designator. |
---|
1578 | |
---|
1579 | The @var{initargs} are passed to the @code{make-instance} call |
---|
1580 | when creating the operation object. |
---|
1581 | Note that dependencies may cause the operation |
---|
1582 | to invoke other operations on the system or its components: |
---|
1583 | the new operations will be created |
---|
1584 | with the same @var{initargs} as the original one. |
---|
1585 | |
---|
1586 | If @var{force} is @code{:all}, then all systems |
---|
1587 | are forced to be recompiled even if not modified since last compilation. |
---|
1588 | If @var{force} is @code{t}, then only the system being loaded |
---|
1589 | is forced to be recompiled even if not modified since last compilation, |
---|
1590 | but other systems are not affected. |
---|
1591 | If @var{force} is a list, then it specifies a list of systems that |
---|
1592 | are forced to be recompiled even if not modified since last compilation. |
---|
1593 | If @var{force-not} is @code{:all}, then all systems |
---|
1594 | are forced not to be recompiled even if modified since last compilation. |
---|
1595 | If @var{force-not} is @code{t}, then only the system being loaded |
---|
1596 | is forced not to be recompiled even if modified since last compilation, |
---|
1597 | but other systems are not affected. |
---|
1598 | If @var{force-not} is a list, then it specifies a list of systems that |
---|
1599 | are forced not to be recompiled even if modified since last compilation. |
---|
1600 | @var{force} takes precedences over @var{force-not}; |
---|
1601 | both of them apply to systems that are dependencies and were already compiled. |
---|
1602 | |
---|
1603 | To see what @code{operate} would do, you can use: |
---|
1604 | @example |
---|
1605 | (asdf:traverse operation-class system-name) |
---|
1606 | @end example |
---|
1607 | |
---|
1608 | @end deffn |
---|
1609 | |
---|
1610 | @menu |
---|
1611 | * Predefined operations of ASDF:: |
---|
1612 | * Creating new operations:: |
---|
1613 | @end menu |
---|
1614 | |
---|
1615 | @node Predefined operations of ASDF, Creating new operations, Operations, Operations |
---|
1616 | @comment node-name, next, previous, up |
---|
1617 | @subsection Predefined operations of ASDF |
---|
1618 | |
---|
1619 | All the operations described in this section are in the @code{asdf} package. |
---|
1620 | They are invoked via the @code{operate} generic function. |
---|
1621 | |
---|
1622 | @lisp |
---|
1623 | (asdf:operate 'asdf:@var{operation-name} :@var{system-name} @{@var{operation-options ...}@}) |
---|
1624 | @end lisp |
---|
1625 | |
---|
1626 | @deffn Operation @code{compile-op} |
---|
1627 | |
---|
1628 | This operation compiles the specified component. |
---|
1629 | A @code{cl-source-file} will be @code{compile-file}'d. |
---|
1630 | All the children and dependencies of a system or module |
---|
1631 | will be recursively compiled by @code{compile-op}. |
---|
1632 | |
---|
1633 | @code{compile-op} depends on @code{prepare-op} which |
---|
1634 | itself depends on a @code{load-op} of all of a component's dependencies, |
---|
1635 | as well as of its parent's dependencies. |
---|
1636 | When @code{operate} is called on @code{compile-op}, |
---|
1637 | all these dependencies will be loaded as well as compiled; |
---|
1638 | yet, some parts of the system main remain unloaded, |
---|
1639 | because nothing depends on them. |
---|
1640 | Use @code{load-op} to load a system. |
---|
1641 | @end deffn |
---|
1642 | |
---|
1643 | @deffn Operation @code{load-op} |
---|
1644 | |
---|
1645 | This operation loads the compiled code for a specified component. |
---|
1646 | A @code{cl-source-file} will have its compiled fasl @code{load}ed, |
---|
1647 | which fasl is the output of @code{compile-op} that @code{load-op} depends on. |
---|
1648 | All the children and dependencies of a system or module |
---|
1649 | will be recursively loaded by @code{load-op}. |
---|
1650 | |
---|
1651 | @code{load-op} depends on @code{prepare-op} which |
---|
1652 | itself depends on a @code{load-op} of all of a component's dependencies, |
---|
1653 | as well as of its parent's dependencies. |
---|
1654 | @end deffn |
---|
1655 | |
---|
1656 | @deffn Operation @code{prepare-op} |
---|
1657 | |
---|
1658 | This operation ensures that the dependencies of a component |
---|
1659 | and its recursive parents are loaded (as per @code{load-op}), |
---|
1660 | as a prerequisite before @code{compile-op} and @code{load-op} operations |
---|
1661 | may be performed on a given component. |
---|
1662 | @end deffn |
---|
1663 | |
---|
1664 | @deffn Operation @code{load-source-op}, @code{prepare-source-op} |
---|
1665 | |
---|
1666 | @code{load-source-op} will load the source for the files in a module |
---|
1667 | rather than they compiled fasl output. |
---|
1668 | It has a @code{prepare-source-op} analog to @code{prepare-op}, |
---|
1669 | that ensures the dependencies are themselves loaded via @code{load-source-op}. |
---|
1670 | |
---|
1671 | There is no provision in ASDF for ensuring that |
---|
1672 | some components are always loaded as source, while others are always compiled. |
---|
1673 | While this idea often comes up in discussions, |
---|
1674 | it actually doesn't play well with either the linking model of ECL |
---|
1675 | or with various bundle operations (see below), and is eventually not workable; |
---|
1676 | also the dependency model of ASDF would have to be modified incompatibly |
---|
1677 | to allow for such trick. |
---|
1678 | If your code doesn't compile cleanly, fix it. |
---|
1679 | If compilation makes it slow, use @code{declaim} or @code{eval-when} |
---|
1680 | to adjust your compiler settings, |
---|
1681 | or eschew compilation by @code{eval}uating a quoted source form at load-time. |
---|
1682 | @end deffn |
---|
1683 | |
---|
1684 | @anchor{test-op} |
---|
1685 | @deffn Operation @code{test-op} |
---|
1686 | |
---|
1687 | This operation will perform some tests on the module. |
---|
1688 | The default method will do nothing. |
---|
1689 | The default dependency is to require |
---|
1690 | @code{load-op} to be performed on the module first. |
---|
1691 | The default @code{operation-done-p} is that the operation is @emph{never} done |
---|
1692 | --- |
---|
1693 | we assume that if you invoke the @code{test-op}, |
---|
1694 | you want to test the system, even if you have already done so. |
---|
1695 | |
---|
1696 | The results of this operation are not defined by ASDF. |
---|
1697 | It has proven difficult to define how the test operation |
---|
1698 | should signal its results to the user |
---|
1699 | in a way that is compatible with all of the various test libraries |
---|
1700 | and test techniques in use in the community. |
---|
1701 | |
---|
1702 | People typically define @code{test-op} methods like thus: |
---|
1703 | @example |
---|
1704 | (defmethod perform ((o asdf:test-op) |
---|
1705 | (s (eql (asdf:find-system @var{:my-system})))) |
---|
1706 | (asdf:load-system @var{:my-system-test}) |
---|
1707 | (funcall (read-from-string "my-system-test:test-suite"))) |
---|
1708 | @end example |
---|
1709 | |
---|
1710 | Using @code{load-system} in the perform method |
---|
1711 | rather than an @code{:in-order-to} dependency, |
---|
1712 | is sometimes necessary for backward compatibility with ASDF 2 and older, |
---|
1713 | to avoid circular dependencies that could arise |
---|
1714 | because of the way these old versions propagate dependencies. |
---|
1715 | |
---|
1716 | If you don't care for compatibility with ASDF 2, |
---|
1717 | you could use the following options in your @code{defsystem} form: |
---|
1718 | @example |
---|
1719 | :in-order-to ((test-op (load-op :my-system-test))) |
---|
1720 | :perform (test-op (o c) (symbol-call :my-system-test :test-suite)) |
---|
1721 | @end example |
---|
1722 | @end deffn |
---|
1723 | |
---|
1724 | @deffn Operation @code{fasl-op}, @code{monolithic-fasl-op}, @code{load-fasl-op}, @code{binary-op}, @code{monolithic-binary-op}, @code{lib-op}, @code{monolithic-lib-op}, @code{dll-op}, @code{monolithic-dll-op}, @code{program-op} |
---|
1725 | |
---|
1726 | These are ``bundle'' operations, that can create a single-file ``bundle'' |
---|
1727 | for all the contents of each system in an application, |
---|
1728 | or for the entire application. |
---|
1729 | |
---|
1730 | @code{fasl-op} will create a single fasl file for each of the systems needed, |
---|
1731 | grouping all its many fasls in one, |
---|
1732 | so you can deliver each system as a single fasl. |
---|
1733 | @code{monolithic-fasl-op} will create a single fasl file for target system |
---|
1734 | and all its dependencies, |
---|
1735 | so you can deliver your entire application as a single fasl. |
---|
1736 | @code{load-fasl-op} will load the output of @code{fasl-op} |
---|
1737 | (though if it the output is not up-to-date, |
---|
1738 | it will load the intermediate fasls indeed as part of building it); |
---|
1739 | this matters a lot on ECL, where the dynamic linking involved in loading |
---|
1740 | tens of individual fasls can be noticeably more expensive |
---|
1741 | than loading a single one. |
---|
1742 | |
---|
1743 | Once you have created a fasl with @code{fasl-op}, |
---|
1744 | you can use @code{precompiled-system} to deliver it in a way |
---|
1745 | that is compatible with clients having dependencies on your system, |
---|
1746 | whether it is distributed as source or as a single binary; |
---|
1747 | the @file{.asd} file to be delivered with the fasl will look like this: |
---|
1748 | @example |
---|
1749 | (defsystem :mysystem :class :precompiled-system |
---|
1750 | :fasl (some expression that will evaluate to a pathname)) |
---|
1751 | @end example |
---|
1752 | Or you can use @code{binary-op} to let ASDF create such a system for you |
---|
1753 | as well as the @code{fasl-op} output, or @code{monolithic-binary-op}. |
---|
1754 | This allows you to deliver code for your systems or applications |
---|
1755 | as a single file. |
---|
1756 | Of course, if you want to test the result in the current image, |
---|
1757 | @emph{before} you try to use any newly created @file{.asd} files, |
---|
1758 | you should not forget to @code{(asdf:clear-configuration)} |
---|
1759 | or at least @code{(asdf:clear-source-registry)}, |
---|
1760 | so it re-populates the source-registry from the filesystem. |
---|
1761 | |
---|
1762 | The @code{program-op} operation will create an executable program |
---|
1763 | from the specified system and its dependencies. |
---|
1764 | You can use UIOP for its pre-image-dump hooks, its post-image-restore hooks, |
---|
1765 | and its access to command-line arguments. |
---|
1766 | And you can specify an entry point @code{my-app:main} |
---|
1767 | by specifying in your @code{defsystem} |
---|
1768 | the option @code{:entry-point "my-app:main"}. |
---|
1769 | Depending on your implementation, |
---|
1770 | running @code{(asdf:operate 'asdf:program-op :my-app)} |
---|
1771 | may quit the current Lisp image upon completion. |
---|
1772 | See the example in |
---|
1773 | @file{test/hello-world-example.asd} and @file{test/hello.lisp}, |
---|
1774 | as built and tested by |
---|
1775 | @file{test/test-program.script} and @file{test/make-hello-world.lisp}. |
---|
1776 | |
---|
1777 | There is also @code{lib-op} |
---|
1778 | for building a linkable @file{.a} file (Windows: @file{.lib}) |
---|
1779 | from all linkable object dependencies (FFI files, and on ECL, Lisp files too), |
---|
1780 | and its monolithic equivalent @code{monolithic-lib-op}. |
---|
1781 | And there is also @code{dll-op} |
---|
1782 | (respectively its monolithic equivalent @code{monolithic-lib-op}) |
---|
1783 | for building a linkable @file{.so} file |
---|
1784 | (Windows: @file{.dll}, MacOS X: @file{.dynlib}) |
---|
1785 | to create a single dynamic library |
---|
1786 | for all the extra FFI code to be linked into each of your systems |
---|
1787 | (respectively your entire application). |
---|
1788 | |
---|
1789 | All these ``bundle'' operations are available since ASDF 3 |
---|
1790 | on all actively supported Lisp implementations, |
---|
1791 | but may be unavailable on unmaintained legacy implementations. |
---|
1792 | This functionality was previously available for select implementations, |
---|
1793 | as part of a separate system @code{asdf-bundle}, |
---|
1794 | itself descended from the ECL-only @code{asdf-ecl}. |
---|
1795 | |
---|
1796 | The pathname of the output of bundle operations |
---|
1797 | is subject to output-translation as usual, |
---|
1798 | unless the operation is equal to |
---|
1799 | the @code{:build-operation} argument to @code{defsystem}. |
---|
1800 | This behavior is not very satisfactory and may change in the future. |
---|
1801 | Maybe you have suggestions on how to better configure it? |
---|
1802 | @end deffn |
---|
1803 | |
---|
1804 | @deffn Operation @code{concatenate-source-op}, @code{monolithic-concatenate-source-op}, @code{load-concatenated-source-op}, @code{compile-concatenated-source-op}, @code{load-compiled-concatenated-source-op}, @code{monolithic-load-concatenated-source-op}, @code{monolithic-compile-concatenated-source-op}, @code{monolithic-load-compiled-concatenated-source-op} |
---|
1805 | |
---|
1806 | These operation, as their respective names indicate, |
---|
1807 | consist in concatenating all @code{cl-source-file} source files in a system |
---|
1808 | (or in a system and all its dependencies, if monolithic), |
---|
1809 | in the order defined by dependencies, |
---|
1810 | then loading the result, or compiling then loading the result. |
---|
1811 | |
---|
1812 | These operations are useful to deliver a system or application |
---|
1813 | as a single source file, |
---|
1814 | and for testing that said file loads properly, or compiles then loads properly. |
---|
1815 | |
---|
1816 | ASDF itself is notably delivered as a single source file this way |
---|
1817 | using @code{monolithic-concatenate-source-op}, |
---|
1818 | transcluding a prelude and the @code{uiop} library |
---|
1819 | before the @code{asdf/defsystem} system itself. |
---|
1820 | @end deffn |
---|
1821 | |
---|
1822 | |
---|
1823 | @node Creating new operations, , Predefined operations of ASDF, Operations |
---|
1824 | @comment node-name, next, previous, up |
---|
1825 | @subsection Creating new operations |
---|
1826 | |
---|
1827 | ASDF was designed to be extensible in an object-oriented fashion. |
---|
1828 | To teach ASDF new tricks, a programmer can implement the behaviour he wants |
---|
1829 | by creating a subclass of @code{operation}. |
---|
1830 | |
---|
1831 | ASDF's pre-defined operations are in no way ``privileged'', |
---|
1832 | but it is requested that developers never use the @code{asdf} package |
---|
1833 | for operations they develop themselves. |
---|
1834 | The rationale for this rule is that we don't want to establish a |
---|
1835 | ``global asdf operation name registry'', |
---|
1836 | but also want to avoid name clashes. |
---|
1837 | |
---|
1838 | Your operation @emph{must} usually provide methods |
---|
1839 | for one or more of the following generic functions: |
---|
1840 | |
---|
1841 | @itemize |
---|
1842 | |
---|
1843 | @item @code{perform} |
---|
1844 | Unless your operation, like @code{prepare-op}, |
---|
1845 | is for dependency propagation only, |
---|
1846 | the most important function for which to define a method |
---|
1847 | is usually @code{perform}, |
---|
1848 | which will be called to perform the operation on a specified component, |
---|
1849 | after all dependencies have been performed. |
---|
1850 | |
---|
1851 | The @code{perform} method must call @code{output-files} (see below) |
---|
1852 | to find out where to put its files, |
---|
1853 | because the user is allowed to override the method |
---|
1854 | or tweak the output-translation mechanism. |
---|
1855 | Perform should only use the primary value returned by @code{output-files}. |
---|
1856 | If one and only one output file is expected, |
---|
1857 | it can call @code{output-file} that checks that this is the case |
---|
1858 | and returns the first and only list element. |
---|
1859 | |
---|
1860 | @item @code{output-files} |
---|
1861 | If your perform method has any output, |
---|
1862 | you must define a method for this function. |
---|
1863 | for ASDF to determine where the outputs of performing operation lie. |
---|
1864 | |
---|
1865 | Your method may return two values, a list of pathnames, and a boolean. |
---|
1866 | If the boolean is @code{nil} (or you fail to return multiple values), |
---|
1867 | then enclosing @code{:around} methods may translate these pathnames, |
---|
1868 | e.g. to ensure object files are somehow stored |
---|
1869 | in some implementation-dependent cache. |
---|
1870 | If the boolean is @code{t} then the pathnames are marked |
---|
1871 | not be translated by the enclosing @code{:around} method. |
---|
1872 | |
---|
1873 | @item @code{component-depends-on} |
---|
1874 | If the action of performing the operation on a component has dependencies, |
---|
1875 | you must define a method on @code{component-depends-on}. |
---|
1876 | |
---|
1877 | Your method will take as specialized arguments |
---|
1878 | an operation and a component which together identify an action, |
---|
1879 | and return a list of entries describing actions that this action depends on. |
---|
1880 | The format of entries is described below. |
---|
1881 | |
---|
1882 | It is @emph{strongly} advised that |
---|
1883 | you should always append the results of @code{(call-next-method)} |
---|
1884 | to the results of your method, |
---|
1885 | or ``interesting'' failures will likely occur, |
---|
1886 | unless you're a true specialist of ASDF internals. |
---|
1887 | It is unhappily too late to compatibly use the @code{append} method combination, |
---|
1888 | but conceptually that's the protocol that is being manually implemented. |
---|
1889 | |
---|
1890 | Each entry returned by @code{component-depends-on} is itself a list. |
---|
1891 | |
---|
1892 | The first element of an entry is an operation designator: |
---|
1893 | either an operation object designating itself, or |
---|
1894 | a symbol that names an operation class |
---|
1895 | (that ASDF will instantiate using @code{make-operation}). |
---|
1896 | For instance, @code{load-op}, @code{compile-op} and @code{prepare-op} |
---|
1897 | are common such names, denoting the respective operations. |
---|
1898 | |
---|
1899 | The rest of each entry is a list of component designators: |
---|
1900 | either a component object designating itself, |
---|
1901 | or an identifier to be used with @code{find-component}. |
---|
1902 | @code{find-component} will be called with the current component's parent as parent, |
---|
1903 | and the identifier as second argument. |
---|
1904 | The identifier is typically a string, |
---|
1905 | a symbol (to be downcased as per @code{coerce-name}), |
---|
1906 | or a list of strings or symbols. |
---|
1907 | In particular, the empty list @code{nil} denotes the parent itself. |
---|
1908 | |
---|
1909 | @end itemize |
---|
1910 | |
---|
1911 | An operation @emph{may} provide methods for the following generic functions: |
---|
1912 | |
---|
1913 | @itemize |
---|
1914 | |
---|
1915 | @item @code{input-files} |
---|
1916 | A method for this function is often not needed, |
---|
1917 | since ASDF has a pretty clever default @code{input-files} mechanism. |
---|
1918 | You only need create a method if there are multiple ultimate input files, |
---|
1919 | and/or the bottom one doesn't depend |
---|
1920 | on the @code{component-pathname} of the component. |
---|
1921 | |
---|
1922 | @item @code{operation-done-p} |
---|
1923 | You only need to define a method on that function |
---|
1924 | if you can detect conditions that invalidate previous runs of the operation, |
---|
1925 | even though no filesystem timestamp has changed, |
---|
1926 | in which case you return @code{nil} (the default is @code{t}). |
---|
1927 | |
---|
1928 | For instance, the method for @code{test-op} always returns @code{nil}, |
---|
1929 | so that tests are always run afresh. |
---|
1930 | Of course, the @code{test-op} for your system could depend |
---|
1931 | on a deterministically repeatable @code{test-report-op}, |
---|
1932 | and just read the results from the report files, |
---|
1933 | in which case you could have this method return @code{t}. |
---|
1934 | |
---|
1935 | @end itemize |
---|
1936 | |
---|
1937 | Operations that print output should send that output to the standard |
---|
1938 | CL stream @code{*standard-output*}, as the Lisp compiler and loader do. |
---|
1939 | |
---|
1940 | @node Components, Functions, Operations, The object model of ASDF |
---|
1941 | @comment node-name, next, previous, up |
---|
1942 | @section Components |
---|
1943 | @cindex component |
---|
1944 | @cindex system |
---|
1945 | @cindex system designator |
---|
1946 | @cindex component designator |
---|
1947 | @vindex *system-definition-search-functions* |
---|
1948 | |
---|
1949 | A @dfn{component} represents a source file or |
---|
1950 | (recursively) a collection of components. |
---|
1951 | A @dfn{system} is (roughly speaking) a top-level component |
---|
1952 | that can be found via @code{find-system}. |
---|
1953 | |
---|
1954 | A @dfn{system designator} is a system itself, |
---|
1955 | or a string or symbol that behaves just like any other component name |
---|
1956 | (including with regard to the case conversion rules for component names). |
---|
1957 | |
---|
1958 | A @dfn{component designator}, relative to a base component, |
---|
1959 | is either a component itself, |
---|
1960 | or a string or symbol, |
---|
1961 | or a list of designators. |
---|
1962 | |
---|
1963 | @defun find-system system-designator @Aoptional (error-p t) |
---|
1964 | |
---|
1965 | Given a system designator, @code{find-system} finds and returns a system. |
---|
1966 | If no system is found, an error of type |
---|
1967 | @code{missing-component} is thrown, |
---|
1968 | or @code{nil} is returned if @code{error-p} is false. |
---|
1969 | |
---|
1970 | To find and update systems, @code{find-system} funcalls each element |
---|
1971 | in the @code{*system-definition-search-functions*} list, |
---|
1972 | expecting a pathname to be returned, or a system object, |
---|
1973 | from which a pathname may be extracted, and that will be registered. |
---|
1974 | The resulting pathname (if any) is loaded |
---|
1975 | if one of the following conditions is true: |
---|
1976 | |
---|
1977 | @itemize |
---|
1978 | @item |
---|
1979 | there is no system of that name in memory |
---|
1980 | @item |
---|
1981 | the pathname is different from that which was previously loaded |
---|
1982 | @item |
---|
1983 | the file's @code{last-modified} time exceeds the @code{last-modified} time |
---|
1984 | of the system in memory |
---|
1985 | @end itemize |
---|
1986 | |
---|
1987 | When system definitions are loaded from @file{.asd} files, |
---|
1988 | a new scratch package is created for them to load into, |
---|
1989 | so that different systems do not overwrite each others operations. |
---|
1990 | The user may also wish to (and is recommended to) |
---|
1991 | include @code{defpackage} and @code{in-package} forms |
---|
1992 | in his system definition files, however, |
---|
1993 | so that they can be loaded manually if need be. |
---|
1994 | |
---|
1995 | The default value of @code{*system-definition-search-functions*} |
---|
1996 | is a list of two functions. |
---|
1997 | The first function looks in each of the directories given |
---|
1998 | by evaluating members of @code{*central-registry*} |
---|
1999 | for a file whose name is the name of the system and whose type is @file{asd}. |
---|
2000 | The first such file is returned, |
---|
2001 | whether or not it turns out to actually define the appropriate system. |
---|
2002 | The second function does something similar, |
---|
2003 | for the directories specified in the @code{source-registry}. |
---|
2004 | Hence, it is strongly advised to define a system |
---|
2005 | @var{foo} in the corresponding file @var{foo.asd}. |
---|
2006 | @end defun |
---|
2007 | |
---|
2008 | @defun find-component base path |
---|
2009 | |
---|
2010 | Given a @var{base} component (or designator for such), |
---|
2011 | and a @var{path}, find the component designated by the @var{path} |
---|
2012 | starting from the @var{base}. |
---|
2013 | |
---|
2014 | If @var{path} is a component object, it designates itself, |
---|
2015 | independently from the base. |
---|
2016 | |
---|
2017 | If @var{path} is a string, or symbol denoting a string via @code{coerce-name}, |
---|
2018 | then @var{base} is resolved to a component object, |
---|
2019 | which must be a system or module, |
---|
2020 | and the designated component is the child named by the @var{path}. |
---|
2021 | |
---|
2022 | If @var{path} is a @code{cons} cell, |
---|
2023 | @code{find-component} with the base and the @code{car} of the @var{path}, |
---|
2024 | and the resulting object is used as the base for a tail call |
---|
2025 | to @code{find-component} with the @code{car} of the @var{path}. |
---|
2026 | |
---|
2027 | If @var{base} is a component object, it designates itself. |
---|
2028 | |
---|
2029 | If @var{base} is null, then @var{path} is used as the base, with @code{nil} as the path. |
---|
2030 | |
---|
2031 | If @var{base} is a string, or symbol denoting a string via @code{coerce-name}, |
---|
2032 | it designates a system as per @code{find-system}. |
---|
2033 | |
---|
2034 | If @var{base} is a @code{cons} cell, it designates the component found by |
---|
2035 | @code{find-component} with its @code{car} as base and @code{cdr} as path. |
---|
2036 | @end defun |
---|
2037 | |
---|
2038 | |
---|
2039 | @menu |
---|
2040 | * Common attributes of components:: |
---|
2041 | * Pre-defined subclasses of component:: |
---|
2042 | * Creating new component types:: |
---|
2043 | @end menu |
---|
2044 | |
---|
2045 | @node Common attributes of components, Pre-defined subclasses of component, Components, Components |
---|
2046 | @comment node-name, next, previous, up |
---|
2047 | @subsection Common attributes of components |
---|
2048 | |
---|
2049 | All components, regardless of type, have the following attributes. |
---|
2050 | All attributes except @code{name} are optional. |
---|
2051 | |
---|
2052 | @subsubsection Name |
---|
2053 | |
---|
2054 | A component name is a string or a symbol. |
---|
2055 | If a symbol, its name is taken and lowercased. |
---|
2056 | |
---|
2057 | Unless overridden by a @code{:pathname} attribute, |
---|
2058 | the name will be interpreted as a pathname specifier according |
---|
2059 | to a Unix-style syntax. |
---|
2060 | @xref{The defsystem grammar,,Pathname specifiers}. |
---|
2061 | |
---|
2062 | @subsubsection Version identifier |
---|
2063 | @findex version-satisfies |
---|
2064 | @cindex :version |
---|
2065 | |
---|
2066 | This optional attribute specifies a version for the current component. |
---|
2067 | The version should typically be a string of integers separated by dots, |
---|
2068 | for example @samp{1.0.11}. |
---|
2069 | For more information on version specifiers, see @ref{The defsystem grammar}. |
---|
2070 | |
---|
2071 | A version may then be queried by the generic function @code{version-satisfies}, |
---|
2072 | to see if @code{:version} dependencies are satisfied, |
---|
2073 | and when specifying dependencies, a constraint of minimal version to satisfy |
---|
2074 | can be specified using e.g. @code{(:version "mydepname" "1.0.11")}. |
---|
2075 | |
---|
2076 | Note that in the wild, we typically see version numbering |
---|
2077 | only on components of type @code{system}. |
---|
2078 | Presumably it is much less useful within a given system, |
---|
2079 | wherein the library author is responsible to keep the various files in synch. |
---|
2080 | |
---|
2081 | @subsubsection Required features |
---|
2082 | |
---|
2083 | Traditionally defsystem users have used @code{#+} reader conditionals |
---|
2084 | to include or exclude specific per-implementation files. |
---|
2085 | This means that any single implementation cannot read the entire system, |
---|
2086 | which becomes a problem if it doesn't wish to compile it, |
---|
2087 | but instead for example to create an archive file containing all the sources, |
---|
2088 | as it will omit to process the system-dependent sources for other systems. |
---|
2089 | |
---|
2090 | Each component in an asdf system may therefore specify using @code{:if-feature} |
---|
2091 | a feature expression using the same syntax as @code{#+} does, |
---|
2092 | such that any reference to the component will be ignored |
---|
2093 | during compilation, loading and/or linking if the expression evaluates to false. |
---|
2094 | Since the expression is read by the normal reader, |
---|
2095 | you must explicitly prefix your symbols with @code{:} so they be read as keywords; |
---|
2096 | this is as contrasted with the @code{#+} syntax |
---|
2097 | that implicitly reads symbols in the keyword package by default. |
---|
2098 | |
---|
2099 | For instance, @code{:if-feature (:and :x86 (:or :sbcl :cmu :scl))} specifies that |
---|
2100 | the given component is only to be compiled and loaded |
---|
2101 | when the implementation is SBCL, CMUCL or Scieneer CL on an x86 machine. |
---|
2102 | You can not write it as @code{:if-feature (and x86 (or sbcl cmu scl))} |
---|
2103 | since the symbols would presumably fail to be read as keywords. |
---|
2104 | |
---|
2105 | @subsubsection Dependencies |
---|
2106 | |
---|
2107 | This attribute specifies dependencies of the component on its siblings. |
---|
2108 | It is optional but often necessary. |
---|
2109 | |
---|
2110 | There is an excitingly complicated relationship between the initarg |
---|
2111 | and the method that you use to ask about dependencies |
---|
2112 | |
---|
2113 | Dependencies are between (operation component) pairs. |
---|
2114 | In your initargs for the component, you can say |
---|
2115 | |
---|
2116 | @lisp |
---|
2117 | :in-order-to ((compile-op (load-op "a" "b") (compile-op "c")) |
---|
2118 | (load-op (load-op "foo"))) |
---|
2119 | @end lisp |
---|
2120 | |
---|
2121 | This means the following things: |
---|
2122 | @itemize |
---|
2123 | @item |
---|
2124 | before performing compile-op on this component, we must perform |
---|
2125 | load-op on @var{a} and @var{b}, and compile-op on @var{c}, |
---|
2126 | @item |
---|
2127 | before performing @code{load-op}, we have to load @var{foo} |
---|
2128 | @end itemize |
---|
2129 | |
---|
2130 | The syntax is approximately |
---|
2131 | |
---|
2132 | @verbatim |
---|
2133 | (this-op @{(other-op required-components)@}+) |
---|
2134 | |
---|
2135 | simple-component-name := string |
---|
2136 | | symbol |
---|
2137 | |
---|
2138 | required-components := simple-component-name |
---|
2139 | | (required-components required-components) |
---|
2140 | |
---|
2141 | component-name := simple-component-name |
---|
2142 | | (:version simple-component-name minimum-version-object) |
---|
2143 | @end verbatim |
---|
2144 | |
---|
2145 | Side note: |
---|
2146 | |
---|
2147 | This is on a par with what ACL defsystem does. |
---|
2148 | mk-defsystem is less general: it has an implied dependency |
---|
2149 | |
---|
2150 | @verbatim |
---|
2151 | for all source file x, (load x) depends on (compile x) |
---|
2152 | @end verbatim |
---|
2153 | |
---|
2154 | and using a @code{:depends-on} argument to say that @var{b} depends on |
---|
2155 | @var{a} @emph{actually} means that |
---|
2156 | |
---|
2157 | @verbatim |
---|
2158 | (compile b) depends on (load a) |
---|
2159 | @end verbatim |
---|
2160 | |
---|
2161 | This is insufficient for e.g. the McCLIM system, which requires that |
---|
2162 | all the files are loaded before any of them can be compiled ] |
---|
2163 | |
---|
2164 | End side note |
---|
2165 | |
---|
2166 | In ASDF, the dependency information for a given component and operation |
---|
2167 | can be queried using @code{(component-depends-on operation component)}, |
---|
2168 | which returns a list |
---|
2169 | |
---|
2170 | @lisp |
---|
2171 | ((load-op "a") (load-op "b") (compile-op "c") ...) |
---|
2172 | @end lisp |
---|
2173 | |
---|
2174 | @code{component-depends-on} can be subclassed for more specific |
---|
2175 | component/operation types: these need to @code{(call-next-method)} |
---|
2176 | and append the answer to their dependency, unless |
---|
2177 | they have a good reason for completely overriding the default dependencies. |
---|
2178 | |
---|
2179 | If it weren't for CLISP, we'd be using @code{LIST} method |
---|
2180 | combination to do this transparently. |
---|
2181 | But, we need to support CLISP. |
---|
2182 | If you have the time for some CLISP hacking, |
---|
2183 | I'm sure they'd welcome your fixes. |
---|
2184 | @c Doesn't CLISP now support LIST method combination? |
---|
2185 | |
---|
2186 | A minimal version can be specified for a component you depend on |
---|
2187 | (typically another system), by specifying @code{(:version "other-system" "1.2.3")} |
---|
2188 | instead of simply @code{"other-system"} as the dependency. |
---|
2189 | See the discussion of the semantics of @code{:version} |
---|
2190 | in the defsystem grammar. |
---|
2191 | |
---|
2192 | @c FIXME: Should have cross-reference to "Version specifiers" in the |
---|
2193 | @c defsystem grammar, but the cross-referencing is so broken by |
---|
2194 | @c insufficient node breakdown that I have not put one in. |
---|
2195 | |
---|
2196 | |
---|
2197 | @subsubsection pathname |
---|
2198 | |
---|
2199 | This attribute is optional and if absent (which is the usual case), |
---|
2200 | the component name will be used. |
---|
2201 | |
---|
2202 | @xref{The defsystem grammar,,Pathname specifiers}, |
---|
2203 | for an explanation of how this attribute is interpreted. |
---|
2204 | |
---|
2205 | Note that the @code{defsystem} macro (used to create a ``top-level'' system) |
---|
2206 | does additional processing to set the filesystem location of |
---|
2207 | the top component in that system. |
---|
2208 | This is detailed elsewhere. @xref{Defining systems with defsystem}. |
---|
2209 | |
---|
2210 | |
---|
2211 | @subsubsection properties |
---|
2212 | |
---|
2213 | This attribute is optional. |
---|
2214 | |
---|
2215 | Packaging systems often require information about files or systems |
---|
2216 | in addition to that specified by ASDF's pre-defined component attributes. |
---|
2217 | Programs that create vendor packages out of ASDF systems therefore |
---|
2218 | have to create ``placeholder'' information to satisfy these systems. |
---|
2219 | Sometimes the creator of an ASDF system may know the additional |
---|
2220 | information and wish to provide it directly. |
---|
2221 | |
---|
2222 | @code{(component-property component property-name)} and |
---|
2223 | associated @code{setf} method will allow |
---|
2224 | the programmatic update of this information. |
---|
2225 | Property names are compared as if by @code{EQL}, |
---|
2226 | so use symbols or keywords or something. |
---|
2227 | |
---|
2228 | @menu |
---|
2229 | * Pre-defined subclasses of component:: |
---|
2230 | * Creating new component types:: |
---|
2231 | @end menu |
---|
2232 | |
---|
2233 | @node Pre-defined subclasses of component, Creating new component types, Common attributes of components, Components |
---|
2234 | @comment node-name, next, previous, up |
---|
2235 | @subsection Pre-defined subclasses of component |
---|
2236 | |
---|
2237 | @deffn Component source-file |
---|
2238 | |
---|
2239 | A source file is any file that the system does not know how to |
---|
2240 | generate from other components of the system. |
---|
2241 | |
---|
2242 | Note that this is not necessarily the same thing as |
---|
2243 | ``a file containing data that is typically fed to a compiler''. |
---|
2244 | If a file is generated by some pre-processor stage |
---|
2245 | (e.g. a @file{.h} file from @file{.h.in} by autoconf) |
---|
2246 | then it is not, by this definition, a source file. |
---|
2247 | Conversely, we might have a graphic file |
---|
2248 | that cannot be automatically regenerated, |
---|
2249 | or a proprietary shared library that we received as a binary: |
---|
2250 | these do count as source files for our purposes. |
---|
2251 | |
---|
2252 | Subclasses of source-file exist for various languages. |
---|
2253 | @emph{FIXME: describe these.} |
---|
2254 | @end deffn |
---|
2255 | |
---|
2256 | @deffn Component module |
---|
2257 | |
---|
2258 | A module is a collection of sub-components. |
---|
2259 | |
---|
2260 | A module component has the following extra initargs: |
---|
2261 | |
---|
2262 | @itemize |
---|
2263 | @item |
---|
2264 | @code{:components} the components contained in this module |
---|
2265 | |
---|
2266 | @item |
---|
2267 | @code{:default-component-class} |
---|
2268 | All children components which don't specify their class explicitly |
---|
2269 | are inferred to be of this type. |
---|
2270 | |
---|
2271 | @item |
---|
2272 | @code{:if-component-dep-fails} |
---|
2273 | This attribute was removed in ASDF 3. Do not use it. |
---|
2274 | Use @code{:if-feature} instead. |
---|
2275 | |
---|
2276 | @item |
---|
2277 | @code{:serial} When this attribute is set, |
---|
2278 | each subcomponent of this component is assumed to depend on all subcomponents |
---|
2279 | before it in the list given to @code{:components}, i.e. |
---|
2280 | all of them are loaded before a compile or load operation is performed on it. |
---|
2281 | |
---|
2282 | @end itemize |
---|
2283 | |
---|
2284 | The default operation knows how to traverse a module, so |
---|
2285 | most operations will not need to provide methods specialised on modules. |
---|
2286 | |
---|
2287 | @code{module} may be subclassed to represent components such as |
---|
2288 | foreign-language linked libraries or archive files. |
---|
2289 | @end deffn |
---|
2290 | |
---|
2291 | @deffn Component system |
---|
2292 | |
---|
2293 | @code{system} is a subclass of @code{module}. |
---|
2294 | |
---|
2295 | A system is a module with a few extra attributes for documentation |
---|
2296 | purposes; these are given elsewhere. |
---|
2297 | @xref{The defsystem grammar}. |
---|
2298 | |
---|
2299 | Users can create new classes for their systems: |
---|
2300 | the default @code{defsystem} macro takes a @code{:class} keyword argument. |
---|
2301 | @end deffn |
---|
2302 | |
---|
2303 | @node Creating new component types, , Pre-defined subclasses of component, Components |
---|
2304 | @comment node-name, next, previous, up |
---|
2305 | @subsection Creating new component types |
---|
2306 | |
---|
2307 | New component types are defined by subclassing one of the existing |
---|
2308 | component classes and specializing methods on the new component class. |
---|
2309 | |
---|
2310 | @emph{FIXME: this should perhaps be explained more throughly, |
---|
2311 | not only by example ...} |
---|
2312 | |
---|
2313 | As an example, suppose we have some implementation-dependent |
---|
2314 | functionality that we want to isolate |
---|
2315 | in one subdirectory per Lisp implementation our system supports. |
---|
2316 | We create a subclass of |
---|
2317 | @code{cl-source-file}: |
---|
2318 | |
---|
2319 | @lisp |
---|
2320 | (defclass unportable-cl-source-file (cl-source-file) |
---|
2321 | ()) |
---|
2322 | @end lisp |
---|
2323 | |
---|
2324 | Function @code{asdf:implementation-type} (exported since 2.014.14) |
---|
2325 | gives us the name of the subdirectory. |
---|
2326 | All that's left is to define how to calculate the pathname |
---|
2327 | of an @code{unportable-cl-source-file}. |
---|
2328 | |
---|
2329 | @lisp |
---|
2330 | (defmethod component-pathname ((component unportable-cl-source-file)) |
---|
2331 | (merge-pathnames* |
---|
2332 | (parse-unix-namestring (format nil "~(~A~)/" (asdf:implementation-type))) |
---|
2333 | (call-next-method))) |
---|
2334 | @end lisp |
---|
2335 | |
---|
2336 | The new component type is used in a @code{defsystem} form in this way: |
---|
2337 | |
---|
2338 | @lisp |
---|
2339 | (defsystem :foo |
---|
2340 | :components |
---|
2341 | ((:file "packages") |
---|
2342 | ... |
---|
2343 | (:unportable-cl-source-file "threads" |
---|
2344 | :depends-on ("packages" ...)) |
---|
2345 | ... |
---|
2346 | ) |
---|
2347 | @end lisp |
---|
2348 | |
---|
2349 | @node Functions, , Components, The object model of ASDF |
---|
2350 | @comment node-name, next, previous, up |
---|
2351 | @section Functions |
---|
2352 | @findex version-satisfies |
---|
2353 | |
---|
2354 | @deffn version-satisfies @var{version} @var{version-spec} |
---|
2355 | Does @var{version} satisfy the @var{version-spec}. A generic function. |
---|
2356 | ASDF provides built-in methods for @var{version} being a @code{component} or @code{string}. |
---|
2357 | @var{version-spec} should be a string. |
---|
2358 | If it's a component, its version is extracted as a string before further processing. |
---|
2359 | |
---|
2360 | A version string satisfies the version-spec if after parsing, |
---|
2361 | the former is no older than the latter. |
---|
2362 | Therefore @code{"1.9.1"}, @code{"1.9.2"} and @code{"1.10"} all satisfy @code{"1.9.1"}, |
---|
2363 | but @code{"1.8.4"} or @code{"1.9"} do not. |
---|
2364 | For more information about how @code{version-satisfies} parses and interprets |
---|
2365 | version strings and specifications, |
---|
2366 | @pxref{The defsystem grammar} (version specifiers) and |
---|
2367 | @ref{Common attributes of components}. |
---|
2368 | |
---|
2369 | Note that in versions of ASDF prior to 3.0.1, |
---|
2370 | including the entire ASDF 1 and ASDF 2 series, |
---|
2371 | @code{version-satisfies} would also require that the version and the version-spec |
---|
2372 | have the same major version number (the first integer in the list); |
---|
2373 | if the major version differed, the version would be considered as not matching the spec. |
---|
2374 | But that feature was not documented, therefore presumably not relied upon, |
---|
2375 | whereas it was a nuisance to several users. |
---|
2376 | Starting with ASDF 3.0.1, |
---|
2377 | @code{version-satisfies} does not treat the major version number specially, |
---|
2378 | and returns T simply if the first argument designates a version that isn't older |
---|
2379 | than the one specified as a second argument. |
---|
2380 | If needs be, the @code{(:version ...)} syntax for specifying dependencies |
---|
2381 | could be in the future extended to specify an exclusive upper bound for compatible versions |
---|
2382 | as well as an inclusive lower bound. |
---|
2383 | @end deffn |
---|
2384 | |
---|
2385 | @node Controlling where ASDF searches for systems, Controlling where ASDF saves compiled files, The object model of ASDF, Top |
---|
2386 | @comment node-name, next, previous, up |
---|
2387 | @chapter Controlling where ASDF searches for systems |
---|
2388 | |
---|
2389 | @section Configurations |
---|
2390 | |
---|
2391 | Configurations specify paths where to find system files. |
---|
2392 | |
---|
2393 | @enumerate |
---|
2394 | |
---|
2395 | @item |
---|
2396 | The search registry may use some hardcoded wrapping registry specification. |
---|
2397 | This allows some implementations (notably SBCL) to specify where to find |
---|
2398 | some special implementation-provided systems that |
---|
2399 | need to precisely match the version of the implementation itself. |
---|
2400 | |
---|
2401 | @item |
---|
2402 | An application may explicitly initialize the source-registry configuration |
---|
2403 | using the configuration API |
---|
2404 | (@pxref{Controlling where ASDF searches for systems,Configuration API,Configuration API}, below) |
---|
2405 | in which case this takes precedence. |
---|
2406 | It may itself compute this configuration from the command-line, |
---|
2407 | from a script, from its own configuration file, etc. |
---|
2408 | |
---|
2409 | @item |
---|
2410 | The source registry will be configured from |
---|
2411 | the environment variable @code{CL_SOURCE_REGISTRY} if it exists. |
---|
2412 | |
---|
2413 | @item |
---|
2414 | The source registry will be configured from |
---|
2415 | user configuration file |
---|
2416 | @file{$XDG_CONFIG_DIRS/common-lisp/source-registry.conf} |
---|
2417 | (which defaults to |
---|
2418 | @file{~/.config/common-lisp/source-registry.conf}) |
---|
2419 | if it exists. |
---|
2420 | |
---|
2421 | @item |
---|
2422 | The source registry will be configured from |
---|
2423 | user configuration directory |
---|
2424 | @file{$XDG_CONFIG_DIRS/common-lisp/source-registry.conf.d/} |
---|
2425 | (which defaults to |
---|
2426 | @file{~/.config/common-lisp/source-registry.conf.d/}) |
---|
2427 | if it exists. |
---|
2428 | |
---|
2429 | @item |
---|
2430 | The source registry will be configured from |
---|
2431 | system configuration file |
---|
2432 | @file{/etc/common-lisp/source-registry.conf} |
---|
2433 | if it exists/ |
---|
2434 | |
---|
2435 | @item |
---|
2436 | The source registry will be configured from |
---|
2437 | system configuration directory |
---|
2438 | @file{/etc/common-lisp/source-registry.conf.d/} |
---|
2439 | if it exists. |
---|
2440 | |
---|
2441 | @item |
---|
2442 | The source registry will be configured from a default configuration. |
---|
2443 | This configuration may allow for implementation-specific systems |
---|
2444 | to be found, for systems to be found the current directory |
---|
2445 | (at the time that the configuration is initialized) as well as |
---|
2446 | @code{:directory} entries for @file{$XDG_DATA_DIRS/common-lisp/systems/} and |
---|
2447 | @code{:tree} entries for @file{$XDG_DATA_DIRS/common-lisp/source/}. |
---|
2448 | For instance, SBCL will include directories for its contribs |
---|
2449 | when it can find them; it will look for them where SBCL was installed, |
---|
2450 | or at the location specified by the @code{SBCL_HOME} environment variable. |
---|
2451 | |
---|
2452 | @end enumerate |
---|
2453 | |
---|
2454 | Each of these configurations is specified as an s-expression |
---|
2455 | in a trivial domain-specific language (defined below). |
---|
2456 | Additionally, a more shell-friendly syntax is available |
---|
2457 | for the environment variable (defined yet below). |
---|
2458 | |
---|
2459 | Each of these configurations is only used if the previous |
---|
2460 | configuration explicitly or implicitly specifies that it |
---|
2461 | includes its inherited configuration. |
---|
2462 | |
---|
2463 | Additionally, some implementation-specific directories |
---|
2464 | may be automatically prepended to whatever directories are specified |
---|
2465 | in configuration files, no matter if the last one inherits or not. |
---|
2466 | |
---|
2467 | |
---|
2468 | @section Truenames and other dangers |
---|
2469 | |
---|
2470 | One great innovation of the original ASDF was its ability to leverage |
---|
2471 | @code{CL:TRUENAME} to locate where your source code was and where to build it, |
---|
2472 | allowing for symlink farms as a simple but effective configuration mechanism |
---|
2473 | that is easy to control programmatically. |
---|
2474 | ASDF 3 still supports this configuration style, and it is enabled by default; |
---|
2475 | however we recommend you instead use |
---|
2476 | our source-registry configuration mechanism described below, |
---|
2477 | because it is easier to setup in a portable way across users and implementations. |
---|
2478 | |
---|
2479 | Addtionally, some people dislike truename, |
---|
2480 | either because it is very slow on their system, or |
---|
2481 | because they are using content-addressed storage where the truename of a file |
---|
2482 | is related to a digest of its individual contents, |
---|
2483 | and not to other files in the same intended project. |
---|
2484 | For these people, ASDF 3 allows to eschew the @code{TRUENAME} mechanism, |
---|
2485 | by setting the variable @var{asdf:*resolve-symlinks*} to @code{nil}. |
---|
2486 | |
---|
2487 | PS: Yes, if you haven't read Vernor Vinge's short but great classic |
---|
2488 | ``True Names... and Other Dangers'' then you're in for a treat. |
---|
2489 | |
---|
2490 | |
---|
2491 | @section XDG base directory |
---|
2492 | |
---|
2493 | Note that we purport to respect the XDG base directory specification |
---|
2494 | as to where configuration files are located, |
---|
2495 | where data files are located, |
---|
2496 | where output file caches are located. |
---|
2497 | Mentions of XDG variables refer to that document. |
---|
2498 | |
---|
2499 | @url{http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html} |
---|
2500 | |
---|
2501 | This specification allows the user to specify some environment variables |
---|
2502 | to customize how applications behave to his preferences. |
---|
2503 | |
---|
2504 | On Windows platforms, when not using Cygwin, |
---|
2505 | instead of the XDG base directory specification, |
---|
2506 | we try to use folder configuration from the registry regarding |
---|
2507 | @code{Common AppData} and similar directories. |
---|
2508 | Since support for querying the Windows registry |
---|
2509 | is not possible to do in reasonable amounts of portable Common Lisp code, |
---|
2510 | ASDF 3 relies on the environment variables that Windows usually exports. |
---|
2511 | |
---|
2512 | @section Backward Compatibility |
---|
2513 | |
---|
2514 | For backward compatibility as well as to provide a practical backdoor for hackers, |
---|
2515 | ASDF will first search for @code{.asd} files in the directories specified in |
---|
2516 | @code{asdf:*central-registry*} |
---|
2517 | before it searches in the source registry above. |
---|
2518 | |
---|
2519 | @xref{Configuring ASDF,,Configuring ASDF to find your systems --- old style}. |
---|
2520 | |
---|
2521 | By default, @code{asdf:*central-registry*} will be empty. |
---|
2522 | |
---|
2523 | This old mechanism will therefore not affect you if you don't use it, |
---|
2524 | but will take precedence over the new mechanism if you do use it. |
---|
2525 | |
---|
2526 | @section Configuration DSL |
---|
2527 | |
---|
2528 | Here is the grammar of the s-expression (SEXP) DSL for source-registry |
---|
2529 | configuration: |
---|
2530 | |
---|
2531 | @c FIXME: This is too wide for happy compilation into pdf. |
---|
2532 | |
---|
2533 | @example |
---|
2534 | ;; A configuration is a single SEXP starting with keyword :source-registry |
---|
2535 | ;; followed by a list of directives. |
---|
2536 | CONFIGURATION := (:source-registry DIRECTIVE ...) |
---|
2537 | |
---|
2538 | ;; A directive is one of the following: |
---|
2539 | DIRECTIVE := |
---|
2540 | ;; INHERITANCE DIRECTIVE: |
---|
2541 | ;; Your configuration expression MUST contain |
---|
2542 | ;; exactly one of either of these: |
---|
2543 | :inherit-configuration | ; splices inherited configuration (often specified last) |
---|
2544 | :ignore-inherited-configuration | ; drop inherited configuration (specified anywhere) |
---|
2545 | |
---|
2546 | ;; forward compatibility directive (since ASDF 2.011.4), useful when |
---|
2547 | ;; you want to use new configuration features but have to bootstrap a |
---|
2548 | ;; the newer required ASDF from an older release that doesn't sport said features: |
---|
2549 | :ignore-invalid-entries | ; drops subsequent invalid entries instead of erroring out |
---|
2550 | |
---|
2551 | ;; add a single directory to be scanned (no recursion) |
---|
2552 | (:directory DIRECTORY-PATHNAME-DESIGNATOR) | |
---|
2553 | |
---|
2554 | ;; add a directory hierarchy, recursing but excluding specified patterns |
---|
2555 | (:tree DIRECTORY-PATHNAME-DESIGNATOR) | |
---|
2556 | |
---|
2557 | ;; override the defaults for exclusion patterns |
---|
2558 | (:exclude EXCLUSION-PATTERN ...) | |
---|
2559 | ;; augment the defaults for exclusion patterns |
---|
2560 | (:also-exclude EXCLUSION-PATTERN ...) | |
---|
2561 | ;; Note that the scope of a an exclude pattern specification is |
---|
2562 | ;; the rest of the current configuration expression or file. |
---|
2563 | |
---|
2564 | ;; splice the parsed contents of another config file |
---|
2565 | (:include REGULAR-FILE-PATHNAME-DESIGNATOR) | |
---|
2566 | |
---|
2567 | ;; This directive specifies that some default must be spliced. |
---|
2568 | :default-registry |
---|
2569 | |
---|
2570 | REGULAR-FILE-PATHNAME-DESIGNATOR := PATHNAME-DESIGNATOR ;; interpreted as a file |
---|
2571 | DIRECTORY-PATHNAME-DESIGNATOR := PATHNAME-DESIGNATOR ;; interpreted as a directory name |
---|
2572 | |
---|
2573 | PATHNAME-DESIGNATOR := |
---|
2574 | NIL | ;; Special: skip this entry. |
---|
2575 | ABSOLUTE-COMPONENT-DESIGNATOR ;; see pathname DSL |
---|
2576 | |
---|
2577 | EXCLUSION-PATTERN := a string without wildcards, that will be matched exactly |
---|
2578 | against the name of a any subdirectory in the directory component |
---|
2579 | of a path. e.g. @code{"_darcs"} will match @file{#p"/foo/bar/_darcs/src/bar.asd"} |
---|
2580 | @end example |
---|
2581 | |
---|
2582 | Pathnames are designated using another DSL, |
---|
2583 | shared with the output-translations configuration DSL below. |
---|
2584 | The DSL is resolved by the function @code{asdf::resolve-location}, |
---|
2585 | to be documented and exported at some point in the future. |
---|
2586 | |
---|
2587 | @example |
---|
2588 | ABSOLUTE-COMPONENT-DESIGNATOR := |
---|
2589 | (ABSOLUTE-COMPONENT-DESIGNATOR RELATIVE-COMPONENT-DESIGNATOR ...) | |
---|
2590 | STRING | ;; namestring (better be absolute or bust, directory assumed where applicable). |
---|
2591 | ;; In output-translations, directory is assumed and **/*.*.* added if it's last. |
---|
2592 | ;; On MCL, a MacOSX-style POSIX namestring (for MacOS9 style, use #p"..."); |
---|
2593 | ;; Note that none of the above applies to strings used in *central-registry*, |
---|
2594 | ;; which doesn't use this DSL: they are processed as normal namestrings. |
---|
2595 | ;; however, you can compute what you put in the *central-registry* |
---|
2596 | ;; based on the results of say (asdf::resolve-location "/Users/fare/cl/cl-foo/") |
---|
2597 | PATHNAME | ;; pathname (better be an absolute path, or bust) |
---|
2598 | ;; In output-translations, unless followed by relative components, |
---|
2599 | ;; it better have appropriate wildcards, as in **/*.*.* |
---|
2600 | :HOME | ;; designates the user-homedir-pathname ~/ |
---|
2601 | :USER-CACHE | ;; designates the default location for the user cache |
---|
2602 | :HERE | ;; designates the location of the configuration file |
---|
2603 | ;; (or *default-pathname-defaults*, if invoked interactively) |
---|
2604 | :ROOT ;; magic, for output-translations source only: paths that are relative |
---|
2605 | ;; to the root of the source host and device |
---|
2606 | ;; Not valid anymore: :SYSTEM-CACHE (was a security hazard) |
---|
2607 | |
---|
2608 | RELATIVE-COMPONENT-DESIGNATOR := |
---|
2609 | (RELATIVE-COMPONENT-DESIGNATOR RELATIVE-COMPONENT-DESIGNATOR ...) | |
---|
2610 | STRING | ;; relative directory pathname as interpreted by parse-unix-namestring. |
---|
2611 | ;; In output translations, if last component, **/*.*.* is added |
---|
2612 | PATHNAME | ;; pathname; unless last component, directory is assumed. |
---|
2613 | :IMPLEMENTATION | ;; directory based on implementation, e.g. sbcl-1.0.45-linux-x64 |
---|
2614 | :IMPLEMENTATION-TYPE | ;; a directory based on lisp-implementation-type only, e.g. sbcl |
---|
2615 | :DEFAULT-DIRECTORY | ;; a relativized version of the default directory |
---|
2616 | :*/ | ;; any direct subdirectory (since ASDF 2.011.4) |
---|
2617 | :**/ | ;; any recursively inferior subdirectory (since ASDF 2.011.4) |
---|
2618 | :*.*.* | ;; any file (since ASDF 2.011.4) |
---|
2619 | ;; Not supported (anymore): :UID and :USERNAME |
---|
2620 | @end example |
---|
2621 | |
---|
2622 | For instance, as a simple case, my @file{~/.config/common-lisp/source-registry.conf}, |
---|
2623 | which is the default place ASDF looks for this configuration, once contained: |
---|
2624 | @example |
---|
2625 | (:source-registry |
---|
2626 | (:tree (:home "cl")) ;; will expand to e.g. "/home/joeluser/cl/" |
---|
2627 | :inherit-configuration) |
---|
2628 | @end example |
---|
2629 | |
---|
2630 | @section Configuration Directories |
---|
2631 | |
---|
2632 | Configuration directories consist in files each containing |
---|
2633 | a list of directives without any enclosing @code{(:source-registry ...)} form. |
---|
2634 | The files will be sorted by namestring as if by @code{string<} and |
---|
2635 | the lists of directives of these files with be concatenated in order. |
---|
2636 | An implicit @code{:inherit-configuration} will be included |
---|
2637 | at the @emph{end} of the list. |
---|
2638 | |
---|
2639 | This allows for packaging software that has file granularity |
---|
2640 | (e.g. Debian's @code{dpkg} or some future version of @code{clbuild}) |
---|
2641 | to easily include configuration information about distributed software. |
---|
2642 | |
---|
2643 | The convention is that, for sorting purposes, |
---|
2644 | the names of files in such a directory begin with two digits |
---|
2645 | that determine the order in which these entries will be read. |
---|
2646 | Also, the type of these files is conventionally @code{"conf"} |
---|
2647 | and as a limitation to some implementations (e.g. GNU clisp), |
---|
2648 | the type cannot be @code{nil}. |
---|
2649 | |
---|
2650 | Directories may be included by specifying a directory pathname |
---|
2651 | or namestring in an @code{:include} directive, e.g.: |
---|
2652 | |
---|
2653 | @example |
---|
2654 | (:include "/foo/bar/") |
---|
2655 | @end example |
---|
2656 | |
---|
2657 | Hence, to achieve the same effect as |
---|
2658 | my example @file{~/.config/common-lisp/source-registry.conf} above, |
---|
2659 | I could simply create a file |
---|
2660 | @file{~/.config/common-lisp/source-registry.conf.d/33-home-fare-cl.conf} |
---|
2661 | alone in its directory with the following contents: |
---|
2662 | @example |
---|
2663 | (:tree "/home/fare/cl/") |
---|
2664 | @end example |
---|
2665 | |
---|
2666 | @subsection The :here directive |
---|
2667 | |
---|
2668 | The @code{:here} directive is an absolute pathname designator that |
---|
2669 | refers to the directory containing the configuration file currently |
---|
2670 | being processed. |
---|
2671 | |
---|
2672 | The @code{:here} directive is intended to simplify the delivery of |
---|
2673 | complex CL systems, and for easy configuration of projects shared through |
---|
2674 | revision control systems, in accordance with our design principle that |
---|
2675 | each participant should be able to provide all and only the information |
---|
2676 | available to him or her. |
---|
2677 | |
---|
2678 | Consider a person X who has set up the source code repository for a |
---|
2679 | complex project with a master directory @file{dir/}. Ordinarily, one |
---|
2680 | might simply have the user add a directive that would look something |
---|
2681 | like this: |
---|
2682 | @example |
---|
2683 | (:tree "path/to/dir") |
---|
2684 | @end example |
---|
2685 | But what if X knows that there are very large subtrees |
---|
2686 | under dir that are filled with, e.g., Java source code, image files for |
---|
2687 | icons, etc.? All of the asdf system definitions are contained in the |
---|
2688 | subdirectories @file{dir/src/lisp/} and @file{dir/extlib/lisp/}, and |
---|
2689 | these are the only directories that should be searched. |
---|
2690 | |
---|
2691 | In this case, X can put into @file{dir/} a file @file{asdf.conf} that |
---|
2692 | contains the following: |
---|
2693 | @example |
---|
2694 | (:source-registry |
---|
2695 | (:tree (:here "src/lisp/")) |
---|
2696 | (:tree (:here "extlib/lisp")) |
---|
2697 | (:directory (:here "outlier/"))) |
---|
2698 | @end example |
---|
2699 | |
---|
2700 | Then when someone else (call her Y) checks out a copy of this |
---|
2701 | repository, she need only add |
---|
2702 | @example |
---|
2703 | (:include "/path/to/my/checkout/directory/asdf.conf") |
---|
2704 | @end example |
---|
2705 | to one of her previously-existing asdf source location configuration |
---|
2706 | files, or invoke @code{initialize-source-registry} with a configuration |
---|
2707 | form containing that s-expression. ASDF will find the .conf file that X |
---|
2708 | has provided, and then set up source locations within the working |
---|
2709 | directory according to X's (relative) instructions. |
---|
2710 | |
---|
2711 | @section Shell-friendly syntax for configuration |
---|
2712 | |
---|
2713 | When considering environment variable @code{CL_SOURCE_REGISTRY} |
---|
2714 | ASDF will skip to next configuration if it's an empty string. |
---|
2715 | It will @code{READ} the string as a SEXP in the DSL |
---|
2716 | if it begins with a paren @code{(} |
---|
2717 | and it will be interpreted much like @code{TEXINPUTS} |
---|
2718 | list of paths, where |
---|
2719 | |
---|
2720 | * paths are separated |
---|
2721 | by a @code{:} (colon) on Unix platforms (including cygwin), |
---|
2722 | by a @code{;} (semicolon) on other platforms (mainly, Windows). |
---|
2723 | |
---|
2724 | * each entry is a directory to add to the search path. |
---|
2725 | |
---|
2726 | * if the entry ends with a double slash @code{//} |
---|
2727 | then it instead indicates a tree in the subdirectories |
---|
2728 | of which to recurse. |
---|
2729 | |
---|
2730 | * if the entry is the empty string (which may only appear once), |
---|
2731 | then it indicates that the inherited configuration should be |
---|
2732 | spliced there. |
---|
2733 | |
---|
2734 | |
---|
2735 | @section Search Algorithm |
---|
2736 | @vindex *default-source-registry-exclusions* |
---|
2737 | |
---|
2738 | In case that isn't clear, the semantics of the configuration is that |
---|
2739 | when searching for a system of a given name, |
---|
2740 | directives are processed in order. |
---|
2741 | |
---|
2742 | When looking in a directory, if the system is found, the search succeeds, |
---|
2743 | otherwise it continues. |
---|
2744 | |
---|
2745 | When looking in a tree, if one system is found, the search succeeds. |
---|
2746 | If multiple systems are found, the consequences are unspecified: |
---|
2747 | the search may succeed with any of the found systems, |
---|
2748 | or an error may be raised. |
---|
2749 | ASDF currently returns the first system found, |
---|
2750 | XCVB currently raised an error. |
---|
2751 | If none is found, the search continues. |
---|
2752 | |
---|
2753 | Exclude statements specify patterns of subdirectories |
---|
2754 | the systems from which to ignore. |
---|
2755 | Typically you don't want to use copies of files kept by such |
---|
2756 | version control systems as Darcs. |
---|
2757 | Exclude statements are not propagated to further included or inherited |
---|
2758 | configuration files or expressions; |
---|
2759 | instead the defaults are reset around every configuration statement |
---|
2760 | to the default defaults from @code{asdf::*default-source-registry-exclusions*}. |
---|
2761 | |
---|
2762 | Include statements cause the search to recurse with the path specifications |
---|
2763 | from the file specified. |
---|
2764 | |
---|
2765 | An inherit-configuration statement cause the search to recurse with the path |
---|
2766 | specifications from the next configuration |
---|
2767 | (@pxref{Controlling where ASDF searches for systems,,Configurations} above). |
---|
2768 | |
---|
2769 | |
---|
2770 | @section Caching Results |
---|
2771 | |
---|
2772 | The implementation is allowed to either eagerly compute the information |
---|
2773 | from the configurations and file system, or to lazily re-compute it |
---|
2774 | every time, or to cache any part of it as it goes. |
---|
2775 | To explicitly flush any information cached by the system, use the API below. |
---|
2776 | |
---|
2777 | |
---|
2778 | @section Configuration API |
---|
2779 | |
---|
2780 | The specified functions are exported from your build system's package. |
---|
2781 | Thus for ASDF the corresponding functions are in package ASDF, |
---|
2782 | and for XCVB the corresponding functions are in package XCVB. |
---|
2783 | |
---|
2784 | @defun initialize-source-registry @Aoptional PARAMETER |
---|
2785 | will read the configuration and initialize all internal variables. |
---|
2786 | You may extend or override configuration |
---|
2787 | from the environment and configuration files |
---|
2788 | with the given @var{PARAMETER}, which can be |
---|
2789 | @code{nil} (no configuration override), |
---|
2790 | or a SEXP (in the SEXP DSL), |
---|
2791 | a string (as in the string DSL), |
---|
2792 | a pathname (of a file or directory with configuration), |
---|
2793 | or a symbol (fbound to function that when called returns one of the above). |
---|
2794 | @end defun |
---|
2795 | |
---|
2796 | @defun clear-source-registry |
---|
2797 | undoes any source registry configuration |
---|
2798 | and clears any cache for the search algorithm. |
---|
2799 | You might want to call this function |
---|
2800 | (or better, @code{clear-configuration}) |
---|
2801 | before you dump an image that would be resumed |
---|
2802 | with a different configuration, |
---|
2803 | and return an empty configuration. |
---|
2804 | Note that this does not include clearing information about |
---|
2805 | systems defined in the current image, only about |
---|
2806 | where to look for systems not yet defined. |
---|
2807 | @end defun |
---|
2808 | |
---|
2809 | @defun ensure-source-registry @Aoptional PARAMETER |
---|
2810 | checks whether a source registry has been initialized. |
---|
2811 | If not, initialize it with the given @var{PARAMETER}. |
---|
2812 | @end defun |
---|
2813 | |
---|
2814 | Every time you use ASDF's @code{find-system}, or |
---|
2815 | anything that uses it (such as @code{operate}, @code{load-system}, etc.), |
---|
2816 | @code{ensure-source-registry} is called with parameter @code{nil}, |
---|
2817 | which the first time around causes your configuration to be read. |
---|
2818 | If you change a configuration file, |
---|
2819 | you need to explicitly @code{initialize-source-registry} again, |
---|
2820 | or maybe simply to @code{clear-source-registry} (or @code{clear-configuration}) |
---|
2821 | which will cause the initialization to happen next time around. |
---|
2822 | |
---|
2823 | |
---|
2824 | @section Status |
---|
2825 | |
---|
2826 | This mechanism is vastly successful, and we have declared |
---|
2827 | that @code{asdf:*central-registry*} is not recommended anymore, |
---|
2828 | though we will continue to support it. |
---|
2829 | All hooks into implementation-specific search mechanisms |
---|
2830 | have been integrated in the @code{wrapping-source-registry} |
---|
2831 | that everyone uses implicitly. |
---|
2832 | |
---|
2833 | |
---|
2834 | @section Rejected ideas |
---|
2835 | |
---|
2836 | Alternatives I considered and rejected included: |
---|
2837 | |
---|
2838 | @enumerate |
---|
2839 | @item Keep @code{asdf:*central-registry*} as the master with its current semantics, |
---|
2840 | and somehow the configuration parser expands the new configuration |
---|
2841 | language into a expanded series of directories of subdirectories to |
---|
2842 | lookup, pre-recursing through specified hierarchies. This is kludgy, |
---|
2843 | and leaves little space of future cleanups and extensions. |
---|
2844 | |
---|
2845 | @item Keep @code{asdf:*central-registry*} remains the master but extend its semantics |
---|
2846 | in completely new ways, so that new kinds of entries may be implemented |
---|
2847 | as a recursive search, etc. This seems somewhat backwards. |
---|
2848 | |
---|
2849 | @item Completely remove @code{asdf:*central-registry*} |
---|
2850 | and break backwards compatibility. |
---|
2851 | Hopefully this will happen in a few years after everyone migrate to |
---|
2852 | a better ASDF and/or to XCVB, but it would be very bad to do it now. |
---|
2853 | |
---|
2854 | @item Replace @code{asdf:*central-registry*} by a symbol-macro with appropriate magic |
---|
2855 | when you dereference it or setf it. Only the new variable with new |
---|
2856 | semantics is handled by the new search procedure. |
---|
2857 | Complex and still introduces subtle semantic issues. |
---|
2858 | @end enumerate |
---|
2859 | |
---|
2860 | |
---|
2861 | I've been suggested the below features, but have rejected them, |
---|
2862 | for the sake of keeping ASDF no more complex than strictly necessary. |
---|
2863 | |
---|
2864 | @itemize |
---|
2865 | @item |
---|
2866 | More syntactic sugar: synonyms for the configuration directives, such as |
---|
2867 | @code{(:add-directory X)} for @code{(:directory X)}, or @code{(:add-directory-hierarchy X)} |
---|
2868 | or @code{(:add-directory X :recurse t)} for @code{(:tree X)}. |
---|
2869 | |
---|
2870 | @item |
---|
2871 | The possibility to register individual files instead of directories. |
---|
2872 | |
---|
2873 | @item |
---|
2874 | Integrate Xach Beane's tilde expander into the parser, |
---|
2875 | or something similar that is shell-friendly or shell-compatible. |
---|
2876 | I'd rather keep ASDF minimal. But maybe this precisely keeps it |
---|
2877 | minimal by removing the need for evaluated entries that ASDF has? |
---|
2878 | i.e. uses of @code{USER-HOMEDIR-PATHNAME} and @code{$SBCL_HOME} |
---|
2879 | Hopefully, these are already superseded by the @code{:default-registry} |
---|
2880 | |
---|
2881 | @item |
---|
2882 | Using the shell-unfriendly syntax @code{/**} instead of @code{//} to specify recursion |
---|
2883 | down a filesystem tree in the environment variable. |
---|
2884 | It isn't that Lisp friendly either. |
---|
2885 | @end itemize |
---|
2886 | |
---|
2887 | @section TODO |
---|
2888 | |
---|
2889 | @itemize |
---|
2890 | @item Add examples |
---|
2891 | @end itemize |
---|
2892 | |
---|
2893 | |
---|
2894 | @section Credits for the source-registry |
---|
2895 | |
---|
2896 | Thanks a lot to Stelian Ionescu for the initial idea. |
---|
2897 | |
---|
2898 | Thanks to Rommel Martinez for the initial implementation attempt. |
---|
2899 | |
---|
2900 | All bad design ideas and implementation bugs are to mine, not theirs. |
---|
2901 | But so are good design ideas and elegant implementation tricks. |
---|
2902 | |
---|
2903 | --- Francois-Rene Rideau @email{fare@@tunes.org}, Mon, 22 Feb 2010 00:07:33 -0500 |
---|
2904 | |
---|
2905 | |
---|
2906 | |
---|
2907 | @node Controlling where ASDF saves compiled files, Error handling, Controlling where ASDF searches for systems, Top |
---|
2908 | @comment node-name, next, previous, up |
---|
2909 | @chapter Controlling where ASDF saves compiled files |
---|
2910 | @cindex asdf-output-translations |
---|
2911 | @vindex ASDF_OUTPUT_TRANSLATIONS |
---|
2912 | |
---|
2913 | Each Common Lisp implementation has its own format |
---|
2914 | for compiled files (fasls for short, short for ``fast loading''). |
---|
2915 | If you use multiple implementations |
---|
2916 | (or multiple versions of the same implementation), |
---|
2917 | you'll soon find your source directories |
---|
2918 | littered with various @file{fasl}s, @file{dfsl}s, @file{cfsl}s and so on. |
---|
2919 | Worse yet, some implementations use the same file extension |
---|
2920 | while changing formats from version to version (or platform to platform) |
---|
2921 | which means that you'll have to recompile binaries |
---|
2922 | as you switch from one implementation to the next. |
---|
2923 | |
---|
2924 | Since ASDF 2, ASDF includes the @code{asdf-output-translations} facility |
---|
2925 | to mitigate the problem. |
---|
2926 | |
---|
2927 | @section Configurations |
---|
2928 | |
---|
2929 | Configurations specify mappings from input locations to output locations. |
---|
2930 | Once again we rely on the XDG base directory specification for configuration. |
---|
2931 | @xref{Controlling where ASDF searches for systems,,XDG base directory}. |
---|
2932 | |
---|
2933 | @enumerate |
---|
2934 | |
---|
2935 | @item |
---|
2936 | Some hardcoded wrapping output translations configuration may be used. |
---|
2937 | This allows special output translations (or usually, invariant directories) |
---|
2938 | to be specified corresponding to the similar special entries in the source registry. |
---|
2939 | |
---|
2940 | @item |
---|
2941 | An application may explicitly initialize the output-translations |
---|
2942 | configuration using the Configuration API |
---|
2943 | in which case this takes precedence. |
---|
2944 | (@pxref{Controlling where ASDF saves compiled files,,Configuration API}.) |
---|
2945 | It may itself compute this configuration from the command-line, |
---|
2946 | from a script, from its own configuration file, etc. |
---|
2947 | |
---|
2948 | @item |
---|
2949 | The source registry will be configured from |
---|
2950 | the environment variable @code{ASDF_OUTPUT_TRANSLATIONS} if it exists. |
---|
2951 | |
---|
2952 | @item |
---|
2953 | The source registry will be configured from |
---|
2954 | user configuration file |
---|
2955 | @file{$XDG_CONFIG_DIRS/common-lisp/asdf-output-translations.conf} |
---|
2956 | (which defaults to |
---|
2957 | @file{~/.config/common-lisp/asdf-output-translations.conf}) |
---|
2958 | if it exists. |
---|
2959 | |
---|
2960 | @item |
---|
2961 | The source registry will be configured from |
---|
2962 | user configuration directory |
---|
2963 | @file{$XDG_CONFIG_DIRS/common-lisp/asdf-output-translations.conf.d/} |
---|
2964 | (which defaults to |
---|
2965 | @file{~/.config/common-lisp/asdf-output-translations.conf.d/}) |
---|
2966 | if it exists. |
---|
2967 | |
---|
2968 | @item |
---|
2969 | The source registry will be configured from |
---|
2970 | system configuration file |
---|
2971 | @file{/etc/common-lisp/asdf-output-translations.conf} |
---|
2972 | if it exists. |
---|
2973 | |
---|
2974 | @item |
---|
2975 | The source registry will be configured from |
---|
2976 | system configuration directory |
---|
2977 | @file{/etc/common-lisp/asdf-output-translations.conf.d/} |
---|
2978 | if it exists. |
---|
2979 | |
---|
2980 | @end enumerate |
---|
2981 | |
---|
2982 | Each of these configurations is specified as a SEXP |
---|
2983 | in a trival domain-specific language (defined below). |
---|
2984 | Additionally, a more shell-friendly syntax is available |
---|
2985 | for the environment variable (defined yet below). |
---|
2986 | |
---|
2987 | Each of these configurations is only used if the previous |
---|
2988 | configuration explicitly or implicitly specifies that it |
---|
2989 | includes its inherited configuration. |
---|
2990 | |
---|
2991 | Note that by default, a per-user cache is used for output files. |
---|
2992 | This allows the seamless use of shared installations of software |
---|
2993 | between several users, and takes files out of the way of the developers |
---|
2994 | when they browse source code, |
---|
2995 | at the expense of taking a small toll when developers have to clean up |
---|
2996 | output files and find they need to get familiar with output-translations first. |
---|
2997 | |
---|
2998 | |
---|
2999 | @section Backward Compatibility |
---|
3000 | @cindex ASDF-BINARY-LOCATIONS compatibility |
---|
3001 | |
---|
3002 | |
---|
3003 | We purposefully do NOT provide backward compatibility with earlier versions of |
---|
3004 | @code{ASDF-Binary-Locations} (8 Sept 2009), |
---|
3005 | @code{common-lisp-controller} (7.0) or |
---|
3006 | @code{cl-launch} (2.35), |
---|
3007 | each of which had similar general capabilities. |
---|
3008 | The previous APIs of these programs were not designed |
---|
3009 | for configuration by the end-user |
---|
3010 | in an easy way with configuration files. |
---|
3011 | Recent versions of same packages use |
---|
3012 | the new @code{asdf-output-translations} API as defined below: |
---|
3013 | @code{common-lisp-controller} (7.2) and @code{cl-launch} (3.000). |
---|
3014 | @code{ASDF-Binary-Locations} is fully superseded and not to be used anymore. |
---|
3015 | |
---|
3016 | This incompatibility shouldn't inconvenience many people. |
---|
3017 | Indeed, few people use and customize these packages; |
---|
3018 | these few people are experts who can trivially adapt to the new configuration. |
---|
3019 | Most people are not experts, could not properly configure these features |
---|
3020 | (except inasmuch as the default configuration of |
---|
3021 | @code{common-lisp-controller} and/or @code{cl-launch} |
---|
3022 | might have been doing the right thing for some users), |
---|
3023 | and yet will experience software that ``just works'', |
---|
3024 | as configured by the system distributor, or by default. |
---|
3025 | |
---|
3026 | Nevertheless, if you are a fan of @code{ASDF-Binary-Locations}, |
---|
3027 | we provide a limited emulation mode: |
---|
3028 | |
---|
3029 | @defun enable-asdf-binary-locations-compatibility @Akey centralize-lisp-binaries default-toplevel-directory include-per-user-information map-all-source-files source-to-target-mappings |
---|
3030 | This function will initialize the new @code{asdf-output-translations} facility in a way |
---|
3031 | that emulates the behavior of the old @code{ASDF-Binary-Locations} facility. |
---|
3032 | Where you would previously set global variables |
---|
3033 | @var{*centralize-lisp-binaries*}, |
---|
3034 | @var{*default-toplevel-directory*}, |
---|
3035 | @var{*include-per-user-information*}, |
---|
3036 | @var{*map-all-source-files*} or @var{*source-to-target-mappings*} |
---|
3037 | you will now have to pass the same values as keyword arguments to this function. |
---|
3038 | Note however that as an extension the @code{:source-to-target-mappings} keyword argument |
---|
3039 | will accept any valid pathname designator for @code{asdf-output-translations} |
---|
3040 | instead of just strings and pathnames. |
---|
3041 | @end defun |
---|
3042 | |
---|
3043 | If you insist, you can also keep using the old @code{ASDF-Binary-Locations} |
---|
3044 | (the one available as an extension to load of top of ASDF, |
---|
3045 | not the one built into a few old versions of ASDF), |
---|
3046 | but first you must disable @code{asdf-output-translations} |
---|
3047 | with @code{(asdf:disable-output-translations)}, |
---|
3048 | or you might experience ``interesting'' issues. |
---|
3049 | |
---|
3050 | Also, note that output translation is enabled by default. |
---|
3051 | To disable it, use @code{(asdf:disable-output-translations)}. |
---|
3052 | |
---|
3053 | |
---|
3054 | @section Configuration DSL |
---|
3055 | |
---|
3056 | Here is the grammar of the SEXP DSL |
---|
3057 | for @code{asdf-output-translations} configuration: |
---|
3058 | |
---|
3059 | @verbatim |
---|
3060 | ;; A configuration is single SEXP starting with keyword :source-registry |
---|
3061 | ;; followed by a list of directives. |
---|
3062 | CONFIGURATION := (:output-translations DIRECTIVE ...) |
---|
3063 | |
---|
3064 | ;; A directive is one of the following: |
---|
3065 | DIRECTIVE := |
---|
3066 | ;; INHERITANCE DIRECTIVE: |
---|
3067 | ;; Your configuration expression MUST contain |
---|
3068 | ;; exactly one of either of these: |
---|
3069 | :inherit-configuration | ; splices inherited configuration (often specified last) |
---|
3070 | :ignore-inherited-configuration | ; drop inherited configuration (specified anywhere) |
---|
3071 | |
---|
3072 | ;; forward compatibility directive (since ASDF 2.011.4), useful when |
---|
3073 | ;; you want to use new configuration features but have to bootstrap a |
---|
3074 | ;; the newer required ASDF from an older release that doesn't sport said features: |
---|
3075 | :ignore-invalid-entries | ; drops subsequent invalid entries instead of erroring out |
---|
3076 | |
---|
3077 | ;; include a configuration file or directory |
---|
3078 | (:include PATHNAME-DESIGNATOR) | |
---|
3079 | |
---|
3080 | ;; enable global cache in ~/.common-lisp/cache/sbcl-1.0.45-linux-amd64/ or something. |
---|
3081 | :enable-user-cache | |
---|
3082 | ;; Disable global cache. Map / to / |
---|
3083 | :disable-cache | |
---|
3084 | |
---|
3085 | ;; add a single directory to be scanned (no recursion) |
---|
3086 | (DIRECTORY-DESIGNATOR DIRECTORY-DESIGNATOR) |
---|
3087 | |
---|
3088 | ;; use a function to return the translation of a directory designator |
---|
3089 | (DIRECTORY-DESIGNATOR (:function TRANSLATION-FUNCTION)) |
---|
3090 | |
---|
3091 | DIRECTORY-DESIGNATOR := |
---|
3092 | NIL | ;; As source: skip this entry. As destination: same as source |
---|
3093 | T | ;; as source matches anything, as destination leaves pathname unmapped. |
---|
3094 | ABSOLUTE-COMPONENT-DESIGNATOR ;; same as in the source-registry language |
---|
3095 | |
---|
3096 | TRANSLATION-FUNCTION := |
---|
3097 | SYMBOL | ;; symbol of a function that takes two arguments, |
---|
3098 | ;; the pathname to be translated and the matching DIRECTORY-DESIGNATOR |
---|
3099 | LAMBDA ;; A form which evalutates to a function taking two arguments consisting of |
---|
3100 | ;; the pathname to be translated and the matching DIRECTORY-DESIGNATOR |
---|
3101 | |
---|
3102 | @end verbatim |
---|
3103 | |
---|
3104 | Relative components better be either relative |
---|
3105 | or subdirectories of the path before them, or bust. |
---|
3106 | |
---|
3107 | The last component, if not a pathname, is notionally completed by @file{/**/*.*}. |
---|
3108 | You can specify more fine-grained patterns |
---|
3109 | by using a pathname object as the last component |
---|
3110 | e.g. @file{#p"some/path/**/foo*/bar-*.fasl"} |
---|
3111 | |
---|
3112 | You may use @code{#+features} to customize the configuration file. |
---|
3113 | |
---|
3114 | The second designator of a mapping may be @code{nil}, indicating that files are not mapped |
---|
3115 | to anything but themselves (same as if the second designator was the same as the first). |
---|
3116 | |
---|
3117 | When the first designator is @code{t}, |
---|
3118 | the mapping always matches. |
---|
3119 | When the first designator starts with @code{:root}, |
---|
3120 | the mapping matches any host and device. |
---|
3121 | In either of these cases, if the second designator |
---|
3122 | isn't @code{t} and doesn't start with @code{:root}, |
---|
3123 | then strings indicating the host and pathname are somehow copied |
---|
3124 | in the beginning of the directory component of the source pathname |
---|
3125 | before it is translated. |
---|
3126 | |
---|
3127 | When the second designator is @code{t}, the mapping is the identity. |
---|
3128 | When the second designator starts with @code{:root}, |
---|
3129 | the mapping preserves the host and device of the original pathname. |
---|
3130 | Notably, this allows you to map files |
---|
3131 | to a subdirectory of the whichever directory the file is in. |
---|
3132 | Though the syntax is not quite as easy to use as we'd like, |
---|
3133 | you can have an (source destination) mapping entry such as follows |
---|
3134 | in your configuration file, |
---|
3135 | or you may use @code{enable-asdf-binary-locations-compatibility} |
---|
3136 | with @code{:centralize-lisp-binaries nil} |
---|
3137 | which will do the same thing internally for you: |
---|
3138 | @verbatim |
---|
3139 | #.(let ((wild-subdir (make-pathname :directory '(:relative :wild-inferiors))) |
---|
3140 | (wild-file (make-pathname :name :wild :version :wild :type :wild))) |
---|
3141 | `((:root ,wild-subdir ,wild-file) ;; Or using the implicit wildcard, just :root |
---|
3142 | (:root ,wild-subdir :implementation ,wild-file))) |
---|
3143 | @end verbatim |
---|
3144 | Starting with ASDF 2.011.4, you can use the simpler: |
---|
3145 | @code{`(:root (:root :**/ :implementation :*.*.*))} |
---|
3146 | |
---|
3147 | |
---|
3148 | |
---|
3149 | @code{:include} statements cause the search to recurse with the path specifications |
---|
3150 | from the file specified. |
---|
3151 | |
---|
3152 | If the @code{translate-pathname} mechanism cannot achieve a desired |
---|
3153 | translation, the user may provide a function which provides the |
---|
3154 | required algorithim. Such a translation function is specified by |
---|
3155 | supplying a list as the second @code{directory-designator} |
---|
3156 | the first element of which is the keyword @code{:function}, |
---|
3157 | and the second element of which is |
---|
3158 | either a symbol which designates a function or a lambda expression. |
---|
3159 | The function designated by the second argument must take two arguments, |
---|
3160 | the first being the pathname of the source file, |
---|
3161 | the second being the wildcard that was matched. |
---|
3162 | The result of the function invocation should be the translated pathname. |
---|
3163 | |
---|
3164 | An @code{:inherit-configuration} statement cause the search to recurse with the path |
---|
3165 | specifications from the next configuration. |
---|
3166 | @xref{Controlling where ASDF saves compiled files,,Configurations}, above. |
---|
3167 | |
---|
3168 | @itemize |
---|
3169 | @item |
---|
3170 | @code{:enable-user-cache} is the same as @code{(t :user-cache)}. |
---|
3171 | @item |
---|
3172 | @code{:disable-cache} is the same as @code{(t t)}. |
---|
3173 | @item |
---|
3174 | @code{:user-cache} uses the contents of variable @code{asdf::*user-cache*} |
---|
3175 | which by default is the same as using |
---|
3176 | @code{(:home ".cache" "common-lisp" :implementation)}. |
---|
3177 | @item |
---|
3178 | @code{:system-cache} uses the contents of variable @code{asdf::*system-cache*} |
---|
3179 | which by default is the same as using |
---|
3180 | @code{("/var/cache/common-lisp" :uid :implementation-type)} |
---|
3181 | (on Unix and cygwin), or something semi-sensible on Windows. |
---|
3182 | @end itemize |
---|
3183 | |
---|
3184 | |
---|
3185 | @section Configuration Directories |
---|
3186 | |
---|
3187 | Configuration directories consist in files each contains |
---|
3188 | a list of directives without any enclosing |
---|
3189 | @code{(:output-translations ...)} form. |
---|
3190 | The files will be sorted by namestring as if by @code{string<} and |
---|
3191 | the lists of directives of these files with be concatenated in order. |
---|
3192 | An implicit @code{:inherit-configuration} will be included |
---|
3193 | at the @emph{end} of the list. |
---|
3194 | |
---|
3195 | This allows for packaging software that has file granularity |
---|
3196 | (e.g. Debian's @command{dpkg} or some future version of @command{clbuild}) |
---|
3197 | to easily include configuration information about software being distributed. |
---|
3198 | |
---|
3199 | The convention is that, for sorting purposes, |
---|
3200 | the names of files in such a directory begin with two digits |
---|
3201 | that determine the order in which these entries will be read. |
---|
3202 | Also, the type of these files is conventionally @code{"conf"} |
---|
3203 | and as a limitation of some implementations, the type cannot be @code{nil}. |
---|
3204 | |
---|
3205 | Directories may be included by specifying a directory pathname |
---|
3206 | or namestring in an @code{:include} directive, e.g.: |
---|
3207 | @verbatim |
---|
3208 | (:include "/foo/bar/") |
---|
3209 | @end verbatim |
---|
3210 | |
---|
3211 | @section Shell-friendly syntax for configuration |
---|
3212 | |
---|
3213 | When considering environment variable @code{ASDF_OUTPUT_TRANSLATIONS} |
---|
3214 | ASDF will skip to next configuration if it's an empty string. |
---|
3215 | It will @code{READ} the string as an SEXP in the DSL |
---|
3216 | if it begins with a paren @code{(} |
---|
3217 | and it will be interpreted as a list of directories. |
---|
3218 | Directories should come by pairs, indicating a mapping directive. |
---|
3219 | Entries are separated |
---|
3220 | by a @code{:} (colon) on Unix platforms (including cygwin), |
---|
3221 | by a @code{;} (semicolon) on other platforms (mainly, Windows). |
---|
3222 | |
---|
3223 | The magic empty entry, |
---|
3224 | if it comes in what would otherwise be the first entry in a pair, |
---|
3225 | indicates the splicing of inherited configuration. |
---|
3226 | If it comes as the second entry in a pair, |
---|
3227 | it indicates that the directory specified first is to be left untranslated |
---|
3228 | (which has the same effect as if the directory had been repeated). |
---|
3229 | |
---|
3230 | |
---|
3231 | @section Semantics of Output Translations |
---|
3232 | |
---|
3233 | From the specified configuration, |
---|
3234 | a list of mappings is extracted in a straightforward way: |
---|
3235 | mappings are collected in order, recursing through |
---|
3236 | included or inherited configuration as specified. |
---|
3237 | To this list is prepended some implementation-specific mappings, |
---|
3238 | and is appended a global default. |
---|
3239 | |
---|
3240 | The list is then compiled to a mapping table as follows: |
---|
3241 | for each entry, in order, resolve the first designated directory |
---|
3242 | into an actual directory pathname for source locations. |
---|
3243 | If no mapping was specified yet for that location, |
---|
3244 | resolve the second designated directory to an output location directory |
---|
3245 | add a mapping to the table mapping the source location to the output location, |
---|
3246 | and add another mapping from the output location to itself |
---|
3247 | (unless a mapping already exists for the output location). |
---|
3248 | |
---|
3249 | Based on the table, a mapping function is defined, |
---|
3250 | mapping source pathnames to output pathnames: |
---|
3251 | given a source pathname, locate the longest matching prefix |
---|
3252 | in the source column of the mapping table. |
---|
3253 | Replace that prefix by the corresponding output column |
---|
3254 | in the same row of the table, and return the result. |
---|
3255 | If no match is found, return the source pathname. |
---|
3256 | (A global default mapping the filesystem root to itself |
---|
3257 | may ensure that there will always be a match, |
---|
3258 | with same fall-through semantics). |
---|
3259 | |
---|
3260 | @section Caching Results |
---|
3261 | |
---|
3262 | The implementation is allowed to either eagerly compute the information |
---|
3263 | from the configurations and file system, or to lazily re-compute it |
---|
3264 | every time, or to cache any part of it as it goes. |
---|
3265 | To explicitly flush any information cached by the system, use the API below. |
---|
3266 | |
---|
3267 | |
---|
3268 | @section Output location API |
---|
3269 | |
---|
3270 | The specified functions are exported from package ASDF. |
---|
3271 | |
---|
3272 | @defun initialize-output-translations @Aoptional PARAMETER |
---|
3273 | will read the configuration and initialize all internal variables. |
---|
3274 | You may extend or override configuration |
---|
3275 | from the environment and configuration files |
---|
3276 | with the given @var{PARAMETER}, which can be |
---|
3277 | @code{nil} (no configuration override), |
---|
3278 | or a SEXP (in the SEXP DSL), |
---|
3279 | a string (as in the string DSL), |
---|
3280 | a pathname (of a file or directory with configuration), |
---|
3281 | or a symbol (fbound to function that when called returns one of the above). |
---|
3282 | @end defun |
---|
3283 | |
---|
3284 | @defun disable-output-translations |
---|
3285 | will initialize output translations in a way |
---|
3286 | that maps every pathname to itself, |
---|
3287 | effectively disabling the output translation facility. |
---|
3288 | @end defun |
---|
3289 | |
---|
3290 | @defun clear-output-translations |
---|
3291 | undoes any output translation configuration |
---|
3292 | and clears any cache for the mapping algorithm. |
---|
3293 | You might want to call this function |
---|
3294 | (or better, @code{clear-configuration}) |
---|
3295 | before you dump an image that would be resumed |
---|
3296 | with a different configuration, |
---|
3297 | and return an empty configuration. |
---|
3298 | Note that this does not include clearing information about |
---|
3299 | systems defined in the current image, only about |
---|
3300 | where to look for systems not yet defined. |
---|
3301 | @end defun |
---|
3302 | |
---|
3303 | @defun ensure-output-translations @Aoptional PARAMETER |
---|
3304 | checks whether output translations have been initialized. |
---|
3305 | If not, initialize them with the given @var{PARAMETER}. |
---|
3306 | This function will be called before any attempt to operate on a system. |
---|
3307 | @end defun |
---|
3308 | |
---|
3309 | @defun apply-output-translations PATHNAME |
---|
3310 | Applies the configured output location translations to @var{PATHNAME} |
---|
3311 | (calls @code{ensure-output-translations} for the translations). |
---|
3312 | @end defun |
---|
3313 | |
---|
3314 | Every time you use ASDF's @code{output-files}, or |
---|
3315 | anything that uses it (that may compile, such as @code{operate}, @code{perform}, etc.), |
---|
3316 | @code{ensure-output-translations} is called with parameter @code{nil}, |
---|
3317 | which the first time around causes your configuration to be read. |
---|
3318 | If you change a configuration file, |
---|
3319 | you need to explicitly @code{initialize-output-translations} again, |
---|
3320 | or maybe @code{clear-output-translations} (or @code{clear-configuration}), |
---|
3321 | which will cause the initialization to happen next time around. |
---|
3322 | |
---|
3323 | |
---|
3324 | @section Credits for output translations |
---|
3325 | |
---|
3326 | Thanks a lot to Bjorn Lindberg and Gary King for @code{ASDF-Binary-Locations}, |
---|
3327 | and to Peter van Eynde for @code{Common Lisp Controller}. |
---|
3328 | |
---|
3329 | All bad design ideas and implementation bugs are to mine, not theirs. |
---|
3330 | But so are good design ideas and elegant implementation tricks. |
---|
3331 | |
---|
3332 | --- Francois-Rene Rideau @email{fare@@tunes.org} |
---|
3333 | |
---|
3334 | @c @section Default locations |
---|
3335 | @c @findex output-files-for-system-and-operation |
---|
3336 | |
---|
3337 | @c The default binary location for each Lisp implementation |
---|
3338 | @c is a subdirectory of each source directory. |
---|
3339 | @c To account for different Lisps, Operating Systems, Implementation versions, |
---|
3340 | @c and so on, ASDF borrows code from SLIME |
---|
3341 | @c to create reasonable custom directory names. |
---|
3342 | @c Here are some examples: |
---|
3343 | |
---|
3344 | @c @itemize |
---|
3345 | @c @item |
---|
3346 | @c SBCL, version 1.0.45 on Mac OS X for Intel: @code{sbcl-1.0.45-darwin-x86} |
---|
3347 | |
---|
3348 | @c @item |
---|
3349 | @c Franz Allegro, version 8.0, ANSI Common Lisp: @code{allegro-8.0a-macosx-x86} |
---|
3350 | |
---|
3351 | @c @item |
---|
3352 | @c Franz Allegro, version 8.1, Modern (case sensitive) Common Lisp: @code{allegro-8.1m-macosx-x86} |
---|
3353 | @c @end itemize |
---|
3354 | |
---|
3355 | @c By default, all output file pathnames will be relocated |
---|
3356 | @c to some thus-named subdirectory of @file{~/.cache/common-lisp/}. |
---|
3357 | |
---|
3358 | @c See the document @file{README.asdf-output-translations} |
---|
3359 | @c for a full specification on how to configure @code{asdf-output-translations}. |
---|
3360 | |
---|
3361 | @node Error handling, Miscellaneous additional functionality, Controlling where ASDF saves compiled files, Top |
---|
3362 | @comment node-name, next, previous, up |
---|
3363 | @chapter Error handling |
---|
3364 | @findex SYSTEM-DEFINITION-ERROR |
---|
3365 | @findex OPERATION-ERROR |
---|
3366 | |
---|
3367 | @section ASDF errors |
---|
3368 | |
---|
3369 | If ASDF detects an incorrect system definition, it will signal a generalised instance of |
---|
3370 | @code{SYSTEM-DEFINITION-ERROR}. |
---|
3371 | |
---|
3372 | Operations may go wrong (for example when source files contain errors). |
---|
3373 | These are signalled using generalised instances of |
---|
3374 | @code{OPERATION-ERROR}. |
---|
3375 | |
---|
3376 | @section Compilation error and warning handling |
---|
3377 | @vindex *compile-file-warnings-behaviour* |
---|
3378 | @vindex *compile-file-errors-behavior* |
---|
3379 | |
---|
3380 | ASDF checks for warnings and errors when a file is compiled. |
---|
3381 | The variables @var{*compile-file-warnings-behaviour*} and |
---|
3382 | @var{*compile-file-errors-behavior*} |
---|
3383 | control the handling of any such events. |
---|
3384 | The valid values for these variables are |
---|
3385 | @code{:error}, @code{:warn}, and @code{:ignore}. |
---|
3386 | |
---|
3387 | @node Miscellaneous additional functionality, Getting the latest version, Error handling, Top |
---|
3388 | @comment node-name, next, previous, up |
---|
3389 | @chapter Miscellaneous additional functionality |
---|
3390 | |
---|
3391 | ASDF includes several additional features that are generally |
---|
3392 | useful for system definition and development. |
---|
3393 | |
---|
3394 | @section Controlling file compilation |
---|
3395 | @cindex :around-compile |
---|
3396 | @cindex around-compile keyword |
---|
3397 | @cindex compile-check keyword |
---|
3398 | @cindex :compile-check |
---|
3399 | @findex compile-file* |
---|
3400 | |
---|
3401 | When declaring a component (system, module, file), |
---|
3402 | you can specify a keyword argument @code{:around-compile function}. |
---|
3403 | If left unspecified (and therefore unbound), |
---|
3404 | the value will be inherited from the parent component if any, |
---|
3405 | or with a default of @code{nil} |
---|
3406 | if no value is specified in any transitive parent. |
---|
3407 | |
---|
3408 | The argument must be a either @code{nil}, a fbound symbol, |
---|
3409 | a lambda-expression (e.g. @code{(lambda (thunk) ...(funcall thunk ...) ...)}) |
---|
3410 | a function object (e.g. using @code{#.#'} but that's discouraged |
---|
3411 | because it prevents the introspection done by e.g. asdf-dependency-grovel), |
---|
3412 | or a string that when @code{read} yields a symbol or a lambda-expression. |
---|
3413 | @code{nil} means the normal compile-file function will be called. |
---|
3414 | A non-nil value designates a function of one argument |
---|
3415 | that will be called with a function that will |
---|
3416 | invoke @code{compile-file*} with various arguments; |
---|
3417 | the around-compile hook may supply additional keyword arguments |
---|
3418 | to pass to that call to @code{compile-file*}. |
---|
3419 | |
---|
3420 | One notable argument that is heeded by @code{compile-file*} is |
---|
3421 | @code{:compile-check}, |
---|
3422 | a function called when the compilation was otherwise a success, |
---|
3423 | with the same arguments as @code{compile-file}; |
---|
3424 | the function shall return true if the compilation |
---|
3425 | and its resulting compiled file respected all system-specific invariants, |
---|
3426 | and false (@code{nil}) if it broke any of those invariants; |
---|
3427 | it may issue warnings or errors before it returns @code{nil}. |
---|
3428 | (NB: The ability to pass such extra flags |
---|
3429 | is only available starting with ASDF 2.22.3.) |
---|
3430 | This feature is notably exercised by asdf-finalizers. |
---|
3431 | |
---|
3432 | By using a string, you may reference |
---|
3433 | a function, symbol and/or package |
---|
3434 | that will only be created later during the build, but |
---|
3435 | isn't yet present at the time the defsystem form is evaluated. |
---|
3436 | However, if your entire system is using such a hook, you may have to |
---|
3437 | explicitly override the hook with @code{nil} for all the modules and files |
---|
3438 | that are compiled before the hook is defined. |
---|
3439 | |
---|
3440 | Using this hook, you may achieve such effects as: |
---|
3441 | locally renaming packages, |
---|
3442 | binding @var{*readtables*} and other syntax-controlling variables, |
---|
3443 | handling warnings and other conditions, |
---|
3444 | proclaiming consistent optimization settings, |
---|
3445 | saving code coverage information, |
---|
3446 | maintaining meta-data about compilation timings, |
---|
3447 | setting gensym counters and PRNG seeds and other sources of non-determinism, |
---|
3448 | overriding the source-location and/or timestamping systems, |
---|
3449 | checking that some compile-time side-effects were properly balanced, |
---|
3450 | etc. |
---|
3451 | |
---|
3452 | Note that there is no around-load hook. This is on purpose. |
---|
3453 | Some implementations such as ECL, GCL or MKCL link object files, |
---|
3454 | which allows for no such hook. |
---|
3455 | Other implementations allow for concatenating FASL files, |
---|
3456 | which doesn't allow for such a hook either. |
---|
3457 | We aim to discourage something that's not portable, |
---|
3458 | and has some dubious impact on performance and semantics |
---|
3459 | even when it is possible. |
---|
3460 | Things you might want to do with an around-load hook |
---|
3461 | are better done around-compile, |
---|
3462 | though it may at times require some creativity |
---|
3463 | (see e.g. the @code{package-renaming} system). |
---|
3464 | |
---|
3465 | |
---|
3466 | @section Controlling source file character encoding |
---|
3467 | |
---|
3468 | Starting with ASDF 2.21, components accept a @code{:encoding} option |
---|
3469 | so authors may specify which character encoding should be used |
---|
3470 | to read and evaluate their source code. |
---|
3471 | When left unspecified, the encoding is inherited |
---|
3472 | from the parent module or system; |
---|
3473 | if no encoding is specified at any point, |
---|
3474 | the default @code{:autodetect} is assumed. |
---|
3475 | By default, only @code{:default}, @code{:utf-8} |
---|
3476 | and @code{:autodetect} are accepted. |
---|
3477 | @code{:autodetect}, the default, calls |
---|
3478 | @code{*encoding-detection-hook*} which by default always returns |
---|
3479 | @code{*default-encoding*} which itself defaults to @code{:default}. |
---|
3480 | |
---|
3481 | In other words, there now are plenty of extension hooks, but |
---|
3482 | by default ASDF follows the backwards compatible behavior |
---|
3483 | of using whichever @code{:default} encoding your implementation uses, |
---|
3484 | which itself may or may not vary based on environment variables |
---|
3485 | and other locale settings. |
---|
3486 | In practice this means that only source code that only uses ASCII |
---|
3487 | is guaranteed to be read the same on all implementations |
---|
3488 | independently from any user setting. |
---|
3489 | |
---|
3490 | Additionally, for backward-compatibility with older versions of ASDF |
---|
3491 | and/or with implementations that do not support unicode and its many encodings, |
---|
3492 | you may want to use |
---|
3493 | the reader conditionals @code{#+asdf-unicode #+asdf-unicode} |
---|
3494 | to protect any @code{:encoding @emph{encoding}} statement |
---|
3495 | as @code{:asdf-unicode} will be present in @code{*features*} |
---|
3496 | only if you're using a recent ASDF |
---|
3497 | on an implementation that supports unicode. |
---|
3498 | We recommend that you avoid using unprotected @code{:encoding} specifications |
---|
3499 | until after ASDF 2.21 or later becomes widespread, hopefully by the end of 2012. |
---|
3500 | |
---|
3501 | While it offers plenty of hooks for extension, |
---|
3502 | and one such extension is being developed (see below), |
---|
3503 | ASDF itself only recognizes one encoding beside @code{:default}, |
---|
3504 | and that is @code{:utf-8}, which is the @emph{de facto} standard, |
---|
3505 | already used by the vast majority of libraries that use more than ASCII. |
---|
3506 | On implementations that do not support unicode, |
---|
3507 | the feature @code{:asdf-unicode} is absent, and |
---|
3508 | the @code{:default} external-format is used |
---|
3509 | to read even source files declared as @code{:utf-8}. |
---|
3510 | On these implementations, non-ASCII characters |
---|
3511 | intended to be read as one CL character |
---|
3512 | may thus end up being read as multiple CL characters. |
---|
3513 | In most cases, this shouldn't affect the software's semantics: |
---|
3514 | comments will be skipped just the same, strings with be read and printed |
---|
3515 | with slightly different lengths, symbol names will be accordingly longer, |
---|
3516 | but none of it should matter. |
---|
3517 | But a few systems that actually depend on unicode characters |
---|
3518 | may fail to work properly, or may work in a subtly different way. |
---|
3519 | See for instance @code{lambda-reader}. |
---|
3520 | |
---|
3521 | We invite you to embrace UTF-8 |
---|
3522 | as the encoding for non-ASCII characters starting today, |
---|
3523 | even without any explicit specification in your @code{.asd} files. |
---|
3524 | Indeed, on some implementations and configurations, |
---|
3525 | UTF-8 is already the @code{:default}, |
---|
3526 | and loading your code may cause errors if it is encoded in anything but UTF-8. |
---|
3527 | Therefore, even with the legacy behavior, |
---|
3528 | non-UTF-8 is guaranteed to break for some users, |
---|
3529 | whereas UTF-8 is pretty much guaranteed not to break anywhere |
---|
3530 | (provided you do @emph{not} use a BOM), |
---|
3531 | although it might be read incorrectly on some implementations. |
---|
3532 | In the future, we intend to make @code{:utf-8} |
---|
3533 | the default value of @code{*default-encoding*}, |
---|
3534 | to be enforced everywhere, so at least the code is guaranteed |
---|
3535 | to be read correctly everywhere it can be. |
---|
3536 | |
---|
3537 | If you need non-standard character encodings for your source code, |
---|
3538 | use the extension system @code{asdf-encodings}, by specifying |
---|
3539 | @code{:defsystem-depends-on (:asdf-encodings)} in your @code{defsystem}. |
---|
3540 | This extension system will register support for more encodings using the |
---|
3541 | @code{*encoding-external-format-hook*} facility, |
---|
3542 | so you can explicitly specify @code{:encoding :latin1} |
---|
3543 | in your @code{.asd} file. |
---|
3544 | Using the @code{*encoding-detection-hook*} it will also |
---|
3545 | eventually implement some autodetection of a file's encoding |
---|
3546 | from an emacs-style @code{-*- mode: lisp ; coding: latin1 -*-} declaration, |
---|
3547 | or otherwise based on an analysis of octet patterns in the file. |
---|
3548 | At this point, asdf-encoding only supports the encodings |
---|
3549 | that are supported as part of your implementation. |
---|
3550 | Since the list varies depending on implementations, |
---|
3551 | we once again recommend you use @code{:utf-8} everywhere, |
---|
3552 | which is the most portable (next is @code{:latin1}). |
---|
3553 | |
---|
3554 | If you're not using a version of Quicklisp that has it, |
---|
3555 | you may get the source for @code{asdf-encodings} using git: |
---|
3556 | @kbd{git clone git://common-lisp.net/projects/asdf/asdf-encodings.git} |
---|
3557 | or |
---|
3558 | @kbd{git clone ssh://common-lisp.net/project/asdf/git/asdf-encodings.git}. |
---|
3559 | You can also browse the repository on |
---|
3560 | @url{http://common-lisp.net/gitweb?p=projects/asdf/asdf-encodings.git}. |
---|
3561 | |
---|
3562 | In the future, we intend to change the default @code{*default-encoding*} |
---|
3563 | to @code{:utf-8}, which is already the de facto standard |
---|
3564 | for most libraries that use non-ASCII characters: |
---|
3565 | utf-8 works everywhere and was backhandedly enforced by |
---|
3566 | a lot of people using SBCL and utf-8 and sending reports to authors |
---|
3567 | so they make their packages compatible. |
---|
3568 | A survey showed only about a handful few libraries |
---|
3569 | are incompatible with non-UTF-8, and then, only in comments, |
---|
3570 | and we believe that authors will adopt UTF-8 when prompted. |
---|
3571 | See the April 2012 discussion on the asdf-devel mailing-list. |
---|
3572 | For backwards compatibility with users who insist on a non-UTF-8 encoding, |
---|
3573 | but cannot immediately transition to using @code{asdf-encodings} |
---|
3574 | (maybe because it isn't ready), it will still be possible to use |
---|
3575 | the @code{:encoding :default} option in your @code{defsystem} form |
---|
3576 | to restore the behavior of ASDF 2.20 and earlier. |
---|
3577 | This shouldn't be required in libraries, |
---|
3578 | because user pressure as mentioned above will already have pushed |
---|
3579 | library authors towards using UTF-8; |
---|
3580 | but authors of end-user programs might care. |
---|
3581 | |
---|
3582 | When you use @code{asdf-encodings}, any further loaded @code{.asd} file |
---|
3583 | will use the autodetection algorithm to determine its encoding; |
---|
3584 | yet if you depend on this detection happening, |
---|
3585 | you may want to explicitly load @code{asdf-encodings} early in your build, |
---|
3586 | for by the time you can use @code{:defsystem-depends-on}, |
---|
3587 | it is already too late to load it. |
---|
3588 | In practice, this means that the @code{*default-encoding*} |
---|
3589 | is usually used for @code{.asd} files. |
---|
3590 | Currently, this defaults to @code{:default} for backwards compatibility, |
---|
3591 | and that means that you shouldn't rely on non-ASCII characters in a .asd file. |
---|
3592 | Since component (path)names are the only real data in these files, |
---|
3593 | and non-ASCII characters are not very portable for file names, |
---|
3594 | this isn't too much of an issue. |
---|
3595 | We still encourage you to use either plain ASCII or UTF-8 |
---|
3596 | in @code{.asd} files, |
---|
3597 | as we intend to make @code{:utf-8} the default encoding in the future. |
---|
3598 | This might matter, for instance, in meta-data about author's names. |
---|
3599 | |
---|
3600 | |
---|
3601 | @section Miscellaneous Functions |
---|
3602 | |
---|
3603 | These functions are exported by ASDF for your convenience. |
---|
3604 | |
---|
3605 | @defun system-relative-pathname system name @Akey type |
---|
3606 | |
---|
3607 | It's often handy to locate a file relative to some system. |
---|
3608 | The @code{system-relative-pathname} function meets this need. |
---|
3609 | |
---|
3610 | It takes two mandatory arguments @var{system} and @var{name} |
---|
3611 | and a keyword argument @var{type}: |
---|
3612 | @var{system} is name of a system, whereas @var{name} and optionally @var{type} |
---|
3613 | specify a relative pathname, interpreted like a component pathname specifier |
---|
3614 | by @code{coerce-pathname}. @xref{The defsystem grammar,,Pathname specifiers}. |
---|
3615 | |
---|
3616 | It returns a pathname built from the location of the system's |
---|
3617 | source directory and the relative pathname. For example: |
---|
3618 | |
---|
3619 | @lisp |
---|
3620 | > (asdf:system-relative-pathname 'cl-ppcre "regex.data") |
---|
3621 | #P"/repository/other/cl-ppcre/regex.data" |
---|
3622 | @end lisp |
---|
3623 | |
---|
3624 | @end defun |
---|
3625 | |
---|
3626 | @defun system-source-directory system-designator |
---|
3627 | |
---|
3628 | ASDF does not provide a turnkey solution for locating |
---|
3629 | data (or other miscellaneous) files |
---|
3630 | that are distributed together with the source code of a system. |
---|
3631 | Programmers can use @code{system-source-directory} to find such files. |
---|
3632 | Returns a pathname object. |
---|
3633 | The @var{system-designator} may be a string, symbol, or ASDF system object. |
---|
3634 | @end defun |
---|
3635 | |
---|
3636 | @defun clear-system system-designator |
---|
3637 | |
---|
3638 | It is sometimes useful to force recompilation of a previously loaded system. |
---|
3639 | In these cases, it may be useful to @code{(asdf:clear-system :foo)} |
---|
3640 | to remove the system from the table of currently loaded systems; |
---|
3641 | the next time the system @code{foo} or one that depends on it is re-loaded, |
---|
3642 | @code{foo} will then be loaded again. |
---|
3643 | Alternatively, you could touch @code{foo.asd} or |
---|
3644 | remove the corresponding fasls from the output file cache. |
---|
3645 | (It was once conceived that one should provide |
---|
3646 | a list of systems the recompilation of which to force |
---|
3647 | as the @code{:force} keyword argument to @code{load-system}; |
---|
3648 | but this has never worked, and though the feature was fixed in ASDF 2.000, |
---|
3649 | it remains @code{cerror}'ed out as nobody ever used it.) |
---|
3650 | |
---|
3651 | Note that this does not and cannot by itself undo the previous loading |
---|
3652 | of the system. Common Lisp has no provision for such an operation, |
---|
3653 | and its reliance on irreversible side-effects to global datastructures |
---|
3654 | makes such a thing impossible in the general case. |
---|
3655 | If the software being re-loaded is not conceived with hot upgrade in mind, |
---|
3656 | this re-loading may cause many errors, warnings or subtle silent problems, |
---|
3657 | as packages, generic function signatures, structures, types, macros, constants, etc. |
---|
3658 | are being redefined incompatibly. |
---|
3659 | It is up to the user to make sure that reloading is possible and has the desired effect. |
---|
3660 | In some cases, extreme measures such as recursively deleting packages, |
---|
3661 | unregistering symbols, defining methods on @code{update-instance-for-redefined-class} |
---|
3662 | and much more are necessary for reloading to happen smoothly. |
---|
3663 | ASDF itself goes through notable pains to make such a hot upgrade possible |
---|
3664 | with respect to its own code, and what it does is ridiculously complex; |
---|
3665 | look at the beginning of @file{asdf.lisp} to see what it does. |
---|
3666 | @end defun |
---|
3667 | |
---|
3668 | @defun register-preloaded-system name @Arest keys |
---|
3669 | A system with name @var{name}, |
---|
3670 | created by @code{make-instance} with extra keys @var{keys} |
---|
3671 | (e.g. @code{:version}), |
---|
3672 | is registered as @emph{preloaded}. |
---|
3673 | That is, its code has already been loaded into the current image, |
---|
3674 | and if at some point some other system @code{:depends-on} it yet no source code is found, |
---|
3675 | it is considered as already provided, |
---|
3676 | and ASDF will not raise a @code{missing-component} error. |
---|
3677 | |
---|
3678 | This function is particularly useful if you distribute your code |
---|
3679 | as fasls with either @code{fasl-op} or @code{monolithic-fasl-op}, |
---|
3680 | and want to register systems so that dependencies will work uniformly |
---|
3681 | whether you're using your software from source or from fasl. |
---|
3682 | @end defun |
---|
3683 | |
---|
3684 | @defun run-shell-command control-string @Arest args |
---|
3685 | |
---|
3686 | This function is obsolete and present only for the sake of backwards-compatibility: |
---|
3687 | ``If it's not backwards, it's not compatible''. We @emph{strongly} discourage its use. |
---|
3688 | Its current behavior is only well-defined on Unix platforms |
---|
3689 | (which include MacOS X and cygwin). On Windows, anything goes. |
---|
3690 | The following documentation is only for the purpose of your migrating away from it |
---|
3691 | in a way that preserves semantics. |
---|
3692 | |
---|
3693 | Instead we recommend the use @code{run-program}, described in the next section, and |
---|
3694 | available as part of ASDF since ASDF 3. |
---|
3695 | |
---|
3696 | @code{run-shell-command} takes as arguments a format @code{control-string} |
---|
3697 | and arguments to be passed to @code{format} after this control-string |
---|
3698 | to produce a string. |
---|
3699 | This string is a command that will be evaluated with a POSIX shell if possible; |
---|
3700 | yet, on Windows, some implementations will use CMD.EXE, |
---|
3701 | while others (like SBCL) will make an attempt at invoking a POSIX shell |
---|
3702 | (and fail if it is not present). |
---|
3703 | @end defun |
---|
3704 | |
---|
3705 | @section Some Utility Functions |
---|
3706 | |
---|
3707 | The below functions are not exported by ASDF itself, but by UIOP, available since ASDF 3. |
---|
3708 | Some of them have precursors in ASDF 2, but we recommend |
---|
3709 | you rely on ASDF 3 for active developments. |
---|
3710 | UIOP provides many, many more utility functions, and we recommend |
---|
3711 | you read its README and sources for more information. |
---|
3712 | |
---|
3713 | |
---|
3714 | @defun parse-unix-namestring name @Akey type defaults dot-dot ensure-directory @AallowOtherKeys |
---|
3715 | Coerce NAME into a PATHNAME using standard Unix syntax. |
---|
3716 | |
---|
3717 | Unix syntax is used whether or not the underlying system is Unix; |
---|
3718 | on such non-Unix systems it is only usable but for relative pathnames; |
---|
3719 | but especially to manipulate relative pathnames portably, it is of crucial |
---|
3720 | to possess a portable pathname syntax independent of the underlying OS. |
---|
3721 | This is what @code{parse-unix-namestring} provides, and why we use it in ASDF. |
---|
3722 | |
---|
3723 | When given a @code{pathname} object, just return it untouched. |
---|
3724 | When given @code{nil}, just return @code{nil}. |
---|
3725 | When given a non-null @code{symbol}, first downcase its name and treat it as a string. |
---|
3726 | When given a @code{string}, portably decompose it into a pathname as below. |
---|
3727 | |
---|
3728 | @code{#\/} separates directory components. |
---|
3729 | |
---|
3730 | The last @code{#\/}-separated substring is interpreted as follows: |
---|
3731 | 1- If @var{type} is @code{:directory} or @var{ensure-directory} is true, |
---|
3732 | the string is made the last directory component, and its @code{name} and @code{type} are @code{nil}. |
---|
3733 | if the string is empty, it's the empty pathname with all slots @code{nil}. |
---|
3734 | 2- If @var{type} is @code{nil}, the substring is a file-namestring, |
---|
3735 | and its @code{name} and @code{type} are separated by @code{split-name-type}. |
---|
3736 | 3- If @var{type} is a string, it is the given @code{type}, and the whole string is the @code{name}. |
---|
3737 | |
---|
3738 | Directory components with an empty name the name @code{.} are removed. |
---|
3739 | Any directory named @code{..} is read as @var{dot-dot}, |
---|
3740 | which must be one of @code{:back} or @code{:up} and defaults to @code{:back}. |
---|
3741 | |
---|
3742 | @code{host}, @code{device} and @code{version} components are taken from @var{defaults}, |
---|
3743 | which itself defaults to @code{*nil-pathname*}, also used if @var{defaults} is @code{nil}. |
---|
3744 | No host or device can be specified in the string itself, |
---|
3745 | which makes it unsuitable for absolute pathnames outside Unix. |
---|
3746 | |
---|
3747 | For relative pathnames, these components (and hence the defaults) won't matter |
---|
3748 | if you use @code{merge-pathnames*} but will matter if you use @code{merge-pathnames}, |
---|
3749 | which is an important reason to always use @code{merge-pathnames*}. |
---|
3750 | |
---|
3751 | Arbitrary keys are accepted, and the parse result is passed to @code{ensure-pathname} |
---|
3752 | with those keys, removing @var{type}, @var{defaults} and @var{dot-dot}. |
---|
3753 | When you're manipulating pathnames that are supposed to make sense portably |
---|
3754 | even though the OS may not be Unixish, we recommend you use @code{:want-relative t} |
---|
3755 | to throw an error if the pathname is absolute |
---|
3756 | @end defun |
---|
3757 | |
---|
3758 | @defun merge-pathnames* specified @Aoptional defaults |
---|
3759 | |
---|
3760 | This function is a replacement for @code{merge-pathnames} that uses the host and device |
---|
3761 | from the @var{defaults} rather than the @var{specified} pathname when the latter |
---|
3762 | is a relative pathname. This allows ASDF and its users to create and use relative pathnames |
---|
3763 | without having to know beforehand what are the host and device |
---|
3764 | of the absolute pathnames they are relative to. |
---|
3765 | |
---|
3766 | @end defun |
---|
3767 | |
---|
3768 | @defun subpathname pathname subpath @Akey type |
---|
3769 | |
---|
3770 | This function takes a @var{pathname} and a @var{subpath} and a @var{type}. |
---|
3771 | If @var{subpath} is already a @code{pathname} object (not namestring), |
---|
3772 | and is an absolute pathname at that, it is returned unchanged; |
---|
3773 | otherwise, @var{subpath} is turned into a relative pathname with given @var{type} |
---|
3774 | as per @code{parse-unix-namestring} with @code{:want-relative t :type }@var{type}, |
---|
3775 | then it is merged with the @code{pathname-directory-pathname} of @var{pathname}, |
---|
3776 | as per @code{merge-pathnames*}. |
---|
3777 | |
---|
3778 | We strongly encourage the use of this function |
---|
3779 | for portably resolving relative pathnames in your code base. |
---|
3780 | @end defun |
---|
3781 | |
---|
3782 | @defun subpathname* pathname subpath @Akey type |
---|
3783 | |
---|
3784 | This function returns @code{nil} if the base @var{pathname} is @code{nil}, |
---|
3785 | otherwise acts like @code{subpathname}. |
---|
3786 | @end defun |
---|
3787 | |
---|
3788 | @defun run-program command @Akey ignore-error-status force-shell input output error-output |
---|
3789 | if-input-does-not-exist if-output-exists if-error-output-exists |
---|
3790 | element-type external-format @AallowOtherKeys |
---|
3791 | |
---|
3792 | @code{run-program} takes a @var{command} argument that is either |
---|
3793 | a list of a program name or path and its arguments, |
---|
3794 | or a string to be executed by a shell. |
---|
3795 | It spawns the command, waits for it to return, |
---|
3796 | verifies that it exited cleanly (unless told not too below), |
---|
3797 | and optionally captures and processes its output. |
---|
3798 | It accepts many keyword arguments to configure its behavior. |
---|
3799 | |
---|
3800 | @code{run-program} returns three values: the first for the output, |
---|
3801 | the second for the error-output, and the third for the return value. |
---|
3802 | (Beware that before ASDF 3.0.2.11, it didn't handle input or error-output, |
---|
3803 | and returned only one value, |
---|
3804 | the one for the output if any handler was specified, or else the exit code; |
---|
3805 | please upgrade ASDF, or at least UIOP, to rely on the new enhanced behavior.) |
---|
3806 | |
---|
3807 | @var{output} is its most important argument; |
---|
3808 | it specifies how the output is captured and processed. |
---|
3809 | If it is @code{nil}, then the output is redirected to the null device, |
---|
3810 | that will discard it. |
---|
3811 | If it is @code{:interactive}, then it is inherited from the current process |
---|
3812 | (beware: this may be different from your @var{*standard-output*}, |
---|
3813 | and under SLIME will be on your @code{*inferior-lisp*} buffer). |
---|
3814 | If it is @code{t}, output goes to your current @var{*standard-output*} stream. |
---|
3815 | Otherwise, @var{output} should be a value that is a suitable first argument to |
---|
3816 | @code{slurp-input-stream} (see below), or |
---|
3817 | a list of such a value and keyword arguments. |
---|
3818 | In this case, @code{run-program} will |
---|
3819 | create a temporary stream for the program output; |
---|
3820 | the program output, in that stream, |
---|
3821 | will be processed by a call to @code{slurp-input-stream}, |
---|
3822 | using @var{output} as the first argument |
---|
3823 | (or if it's a list the first element of @var{output} and the rest as keywords). |
---|
3824 | The primary value resulting from that call |
---|
3825 | (or @code{nil} if no call was needed) |
---|
3826 | will be the first value returned by @code{run-program}. |
---|
3827 | E.g., using @code{:output :string} |
---|
3828 | will have it return the entire output stream as a string. |
---|
3829 | And using @code{:output '(:string :stripped t)} |
---|
3830 | will have it return the same string stripped of any ending newline. |
---|
3831 | |
---|
3832 | @var{error-output} is similar to @var{output}, except that |
---|
3833 | the resulting value is returned as the second value of @code{run-program}. |
---|
3834 | @code{t} designates the @var{*error-output*}. |
---|
3835 | Also @code{:output} means redirecting the error output to the output stream, |
---|
3836 | in which case @code{nil} is returned. |
---|
3837 | |
---|
3838 | @var{input} is similar to @var{output}, except that |
---|
3839 | @code{vomit-output-stream} is used, no value is returned, |
---|
3840 | and @code{t} designates the @var{*standard-input*}. |
---|
3841 | |
---|
3842 | @code{element-type} and @code{external-format} are passed on |
---|
3843 | to your Lisp implementation, when applicable, for creation of the output stream. |
---|
3844 | |
---|
3845 | One and only one of the stream slurping or vomiting may or may not happen |
---|
3846 | in parallel in parallel with the subprocess, |
---|
3847 | depending on options and implementation, |
---|
3848 | and with priority being given to output processing. |
---|
3849 | Other streams are completely produced or consumed |
---|
3850 | before or after the subprocess is spawned, using temporary files. |
---|
3851 | |
---|
3852 | @code{force-shell} forces evaluation of the command through a shell, |
---|
3853 | even if it was passed as a list rather than a string. |
---|
3854 | If a shell is used, it is @file{/bin/sh} on Unix or @file{CMD.EXE} on Windows, |
---|
3855 | except on implementations that (erroneously, IMNSHO) |
---|
3856 | insist on consulting @code{$SHELL} like clisp. |
---|
3857 | |
---|
3858 | @code{ignore-error-status} causes @code{run-program} |
---|
3859 | to not raise an error if the spawned program exits in error. |
---|
3860 | Following POSIX convention, an error is anything but |
---|
3861 | a normal exit with status code zero. |
---|
3862 | By default, an error of type @code{subprocess-error} is raised in this case. |
---|
3863 | |
---|
3864 | @code{run-program} works on all platforms supported by ASDF, except Genera. |
---|
3865 | See the source code for more documentation. |
---|
3866 | |
---|
3867 | @end defun |
---|
3868 | |
---|
3869 | @defun slurp-input-stream processor input-stream @Akey |
---|
3870 | |
---|
3871 | It's a generic function of two arguments, a target object and an input stream, |
---|
3872 | and accepting keyword arguments. |
---|
3873 | Predefined methods based on the target object are as follow: |
---|
3874 | |
---|
3875 | If the object is a function, the function is called with the stream as argument. |
---|
3876 | |
---|
3877 | If the object is a cons, its first element is applied to its rest appended by |
---|
3878 | a list of the input stream. |
---|
3879 | |
---|
3880 | If the object is an output stream, the contents of the input stream are copied to it. |
---|
3881 | If the @var{linewise} keyword argument is provided, copying happens line by line, |
---|
3882 | and an optional @var{prefix} is printed before each line. |
---|
3883 | Otherwise, copying happen based on a buffer of size @var{buffer-size}, |
---|
3884 | using the specified @var{element-type}. |
---|
3885 | |
---|
3886 | If the object is @code{'string} or @code{:string}, the content is captured into a string. |
---|
3887 | Accepted keywords include the @var{element-type} and a flag @var{stripped}, |
---|
3888 | which when true causes any single line ending to be removed as per @code{uiop:stripln}. |
---|
3889 | |
---|
3890 | If the object is @code{:lines}, the content is captured as a list of strings, |
---|
3891 | one per line, without line ending. If the @var{count} keyword argument is provided, |
---|
3892 | it is a maximum count of lines to be read. |
---|
3893 | |
---|
3894 | If the object is @code{:line}, the content is capture as with @code{:lines} above, |
---|
3895 | and then its sub-object is extracted with the @var{at} argument, |
---|
3896 | which defaults to @code{0}, extracting the first line. |
---|
3897 | A number will extract the corresponding line. |
---|
3898 | See the documentation for @code{uiop:access-at}. |
---|
3899 | |
---|
3900 | If the object is @code{:forms}, the content is captured as a list of S-expressions, |
---|
3901 | as read by the Lisp reader. |
---|
3902 | If the @var{count} argument is provided, |
---|
3903 | it is a maximum count of lines to be read. |
---|
3904 | We recommend you control the syntax with such macro as |
---|
3905 | @code{uiop:with-safe-io-syntax}. |
---|
3906 | |
---|
3907 | If the object is @code{:form}, the content is capture as with @code{:forms} above, |
---|
3908 | and then its sub-object is extracted with the @var{at} argument, |
---|
3909 | which defaults to @code{0}, extracting the first form. |
---|
3910 | A number will extract the corresponding form. |
---|
3911 | See the documentation for @code{uiop:access-at}. |
---|
3912 | We recommend you control the syntax with such macro as |
---|
3913 | @code{uiop:with-safe-io-syntax}. |
---|
3914 | |
---|
3915 | @end defun |
---|
3916 | |
---|
3917 | |
---|
3918 | @node Getting the latest version, FAQ, Miscellaneous additional functionality, Top |
---|
3919 | @comment node-name, next, previous, up |
---|
3920 | @chapter Getting the latest version |
---|
3921 | |
---|
3922 | Decide which version you want. |
---|
3923 | The @code{master} branch is where development happens; |
---|
3924 | its @code{HEAD} is usually OK, including the latest fixes and portability tweaks, |
---|
3925 | but an occasional regression may happen despite our (limited) test suite. |
---|
3926 | |
---|
3927 | The @code{release} branch is what cautious people should be using; |
---|
3928 | it has usually been tested more, and releases are cut at a point |
---|
3929 | where there isn't any known unresolved issue. |
---|
3930 | |
---|
3931 | You may get the ASDF source repository using git: |
---|
3932 | @kbd{git clone git://common-lisp.net/projects/asdf/asdf.git} |
---|
3933 | |
---|
3934 | You will find the above referenced tags in this repository. |
---|
3935 | You can also browse the repository on |
---|
3936 | @url{http://common-lisp.net/gitweb?p=projects/asdf/asdf.git}. |
---|
3937 | |
---|
3938 | Discussion of ASDF development is conducted on the |
---|
3939 | mailing list |
---|
3940 | @kbd{asdf-devel@@common-lisp.net}. |
---|
3941 | @url{http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel} |
---|
3942 | |
---|
3943 | |
---|
3944 | @node FAQ, TODO list, Getting the latest version, Top |
---|
3945 | @comment node-name, next, previous, up |
---|
3946 | @chapter FAQ |
---|
3947 | |
---|
3948 | @section ``Where do I report a bug?'' |
---|
3949 | |
---|
3950 | ASDF bugs are tracked on launchpad: @url{https://launchpad.net/asdf}. |
---|
3951 | |
---|
3952 | If you're unsure about whether something is a bug, or for general discussion, |
---|
3953 | use the @url{http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel,asdf-devel mailing list} |
---|
3954 | |
---|
3955 | |
---|
3956 | @section ``What has changed between ASDF 1 and ASDF 2?'' |
---|
3957 | |
---|
3958 | @subsection What are ASDF 1 and ASDF 2? |
---|
3959 | |
---|
3960 | On May 31st 2010, we have released ASDF 2. |
---|
3961 | ASDF 2 refers to release 2.000 and later. |
---|
3962 | (Releases between 1.656 and 1.728 were development releases for ASDF 2.) |
---|
3963 | ASDF 1 to any release earlier than 1.369 or so. |
---|
3964 | If your ASDF doesn't sport a version, it's an old ASDF 1. |
---|
3965 | |
---|
3966 | ASDF 2 and its release candidates push |
---|
3967 | @code{:asdf2} onto @code{*features*} so that if you are writing |
---|
3968 | ASDF-dependent code you may check for this feature |
---|
3969 | to see if the new API is present. |
---|
3970 | @emph{All} versions of ASDF should have the @code{:asdf} feature. |
---|
3971 | |
---|
3972 | Additionally, all versions of ASDF 2 |
---|
3973 | define a function @code{(asdf:asdf-version)} you may use to query the version; |
---|
3974 | and the source code of recent versions of ASDF 2 features the version number |
---|
3975 | prominently on the second line of its source code. |
---|
3976 | |
---|
3977 | If you are experiencing problems or limitations of any sort with ASDF 1, |
---|
3978 | we recommend that you should upgrade to ASDF 2, |
---|
3979 | or whatever is the latest release. |
---|
3980 | |
---|
3981 | |
---|
3982 | @subsection ASDF can portably name files in subdirectories |
---|
3983 | |
---|
3984 | Common Lisp namestrings are not portable, |
---|
3985 | except maybe for logical pathnamestrings, |
---|
3986 | that themselves have various limitations and require a lot of setup |
---|
3987 | that is itself ultimately non-portable. |
---|
3988 | |
---|
3989 | In ASDF 1, the only portable ways to refer to pathnames inside systems and components |
---|
3990 | were very awkward, using @code{#.(make-pathname ...)} and |
---|
3991 | @code{#.(merge-pathnames ...)}. |
---|
3992 | Even the above were themselves were inadequate in the general case |
---|
3993 | due to host and device issues, unless horribly complex patterns were used. |
---|
3994 | Plenty of simple cases that looked portable actually weren't, |
---|
3995 | leading to much confusion and greavance. |
---|
3996 | |
---|
3997 | ASDF 2 implements its own portable syntax for strings as pathname specifiers. |
---|
3998 | Naming files within a system definition becomes easy and portable again. |
---|
3999 | @xref{Miscellaneous additional functionality,asdf:system-relative-pathname}, |
---|
4000 | @code{merge-pathnames*}, |
---|
4001 | @code{coerce-pathname}. |
---|
4002 | |
---|
4003 | On the other hand, there are places where systems used to accept namestrings |
---|
4004 | where you must now use an explicit pathname object: |
---|
4005 | @code{(defsystem ... :pathname "LOGICAL-HOST:PATH;TO;SYSTEM;" ...)} |
---|
4006 | must now be written with the @code{#p} syntax: |
---|
4007 | @code{(defsystem ... :pathname #p"LOGICAL-HOST:PATH;TO;SYSTEM;" ...)} |
---|
4008 | |
---|
4009 | @xref{The defsystem grammar,,Pathname specifiers}. |
---|
4010 | |
---|
4011 | |
---|
4012 | @subsection Output translations |
---|
4013 | |
---|
4014 | A popular feature added to ASDF was output pathname translation: |
---|
4015 | @code{asdf-binary-locations}, @code{common-lisp-controller}, |
---|
4016 | @code{cl-launch} and other hacks were all implementing it in ways |
---|
4017 | both mutually incompatible and difficult to configure. |
---|
4018 | |
---|
4019 | Output pathname translation is essential to share |
---|
4020 | source directories of portable systems across multiple implementations |
---|
4021 | or variants thereof, |
---|
4022 | or source directories of shared installations of systems across multiple users, |
---|
4023 | or combinations of the above. |
---|
4024 | |
---|
4025 | In ASDF 2, a standard mechanism is provided for that, |
---|
4026 | @code{asdf-output-translations}, |
---|
4027 | with sensible defaults, adequate configuration languages, |
---|
4028 | a coherent set of configuration files and hooks, |
---|
4029 | and support for non-Unix platforms. |
---|
4030 | |
---|
4031 | @xref{Controlling where ASDF saves compiled files}. |
---|
4032 | |
---|
4033 | @subsection Source Registry Configuration |
---|
4034 | |
---|
4035 | Configuring ASDF used to require special magic |
---|
4036 | to be applied just at the right moment, |
---|
4037 | between the moment ASDF is loaded and the moment it is used, |
---|
4038 | in a way that is specific to the user, |
---|
4039 | the implementation he is using and the application he is building. |
---|
4040 | |
---|
4041 | This made for awkward configuration files and startup scripts |
---|
4042 | that could not be shared between users, managed by administrators |
---|
4043 | or packaged by distributions. |
---|
4044 | |
---|
4045 | ASDF 2 provides a well-documented way to configure ASDF, |
---|
4046 | with sensible defaults, adequate configuration languages, |
---|
4047 | and a coherent set of configuration files and hooks. |
---|
4048 | |
---|
4049 | We believe it's a vast improvement because it decouples |
---|
4050 | application distribution from library distribution. |
---|
4051 | The application writer can avoid thinking where the libraries are, |
---|
4052 | and the library distributor (dpkg, clbuild, advanced user, etc.) |
---|
4053 | can configure them once and for every application. |
---|
4054 | Yet settings can be easily overridden where needed, |
---|
4055 | so whoever needs control has exactly as much as required. |
---|
4056 | |
---|
4057 | At the same time, ASDF 2 remains compatible |
---|
4058 | with the old magic you may have in your build scripts |
---|
4059 | (using @code{*central-registry*} and |
---|
4060 | @code{*system-definition-search-functions*}) |
---|
4061 | to tailor the ASDF configuration to your build automation needs, |
---|
4062 | and also allows for new magic, simpler and more powerful magic. |
---|
4063 | |
---|
4064 | @xref{Controlling where ASDF searches for systems}. |
---|
4065 | |
---|
4066 | |
---|
4067 | @subsection Usual operations are made easier to the user |
---|
4068 | |
---|
4069 | In ASDF 1, you had to use the awkward syntax |
---|
4070 | @code{(asdf:oos 'asdf:load-op :foo)} |
---|
4071 | to load a system, |
---|
4072 | and similarly for @code{compile-op}, @code{test-op}. |
---|
4073 | |
---|
4074 | In ASDF 2, you can use shortcuts for the usual operations: |
---|
4075 | @code{(asdf:load-system :foo)}, and |
---|
4076 | similarly for @code{compile-system}, @code{test-system}. |
---|
4077 | |
---|
4078 | |
---|
4079 | @subsection Many bugs have been fixed |
---|
4080 | |
---|
4081 | The following issues and many others have been fixed: |
---|
4082 | |
---|
4083 | @itemize |
---|
4084 | @item |
---|
4085 | The infamous TRAVERSE function has been revamped completely |
---|
4086 | between ASDF 1 and ASDF 2, with many bugs squashed. |
---|
4087 | In particular, dependencies were not correctly propagated |
---|
4088 | across modules but now are. |
---|
4089 | It has been completely rewritten many times over |
---|
4090 | between ASDF 2.000 and ASDF 3, |
---|
4091 | with fundamental issues in the original model being fixed. |
---|
4092 | Timestamps were not propagated at all, and now are. |
---|
4093 | The internal model of how actions depend on each other |
---|
4094 | is now both consistent and complete. |
---|
4095 | The :version and |
---|
4096 | the :force (system1 .. systemN) feature have been fixed. |
---|
4097 | |
---|
4098 | @item |
---|
4099 | Performance has been notably improved for large systems |
---|
4100 | (say with thousands of components) by using |
---|
4101 | hash-tables instead of linear search, |
---|
4102 | and linear-time list accumulation |
---|
4103 | instead of quadratic-time recursive appends. |
---|
4104 | |
---|
4105 | @item |
---|
4106 | Many features used to not be portable, |
---|
4107 | especially where pathnames were involved. |
---|
4108 | Windows support was notably quirky because of such non-portability. |
---|
4109 | |
---|
4110 | @item |
---|
4111 | The internal test suite used to massively fail on many implementations. |
---|
4112 | While still incomplete, it now fully passes |
---|
4113 | on all implementations supported by the test suite, |
---|
4114 | except for GCL (due to GCL bugs). |
---|
4115 | |
---|
4116 | @item |
---|
4117 | Support was lacking for some implementations. |
---|
4118 | ABCL and GCL were notably wholly broken. |
---|
4119 | ECL extensions were not integrated with ASDF release. |
---|
4120 | |
---|
4121 | @item |
---|
4122 | The documentation was grossly out of date. |
---|
4123 | |
---|
4124 | @end itemize |
---|
4125 | |
---|
4126 | |
---|
4127 | @subsection ASDF itself is versioned |
---|
4128 | |
---|
4129 | Between new features, old bugs fixed, and new bugs introduced, |
---|
4130 | there were various releases of ASDF in the wild, |
---|
4131 | and no simple way to check which release had which feature set. |
---|
4132 | People using or writing systems had to either make worst-case assumptions |
---|
4133 | as to what features were available and worked, |
---|
4134 | or take great pains to have the correct version of ASDF installed. |
---|
4135 | |
---|
4136 | With ASDF 2, we provide a new stable set of working features |
---|
4137 | that everyone can rely on from now on. |
---|
4138 | Use @code{#+asdf2} to detect presence of ASDF 2, |
---|
4139 | @code{(asdf:version-satisfies (asdf:asdf-version) "2.345.67")} |
---|
4140 | to check the availability of a version no earlier than required. |
---|
4141 | |
---|
4142 | |
---|
4143 | @subsection ASDF can be upgraded |
---|
4144 | |
---|
4145 | When an old version of ASDF was loaded, |
---|
4146 | it was very hard to upgrade ASDF in your current image |
---|
4147 | without breaking everything. |
---|
4148 | Instead you had to exit the Lisp process and |
---|
4149 | somehow arrange to start a new one from a simpler image. |
---|
4150 | Something that can't be done from within Lisp, |
---|
4151 | making automation of it difficult, |
---|
4152 | which compounded with difficulty in configuration, |
---|
4153 | made the task quite hard. |
---|
4154 | Yet as we saw before, the task would have been required |
---|
4155 | to not have to live with the worst case or non-portable |
---|
4156 | subset of ASDF features. |
---|
4157 | |
---|
4158 | With ASDF 2, it is easy to upgrade |
---|
4159 | from ASDF 2 to later versions from within Lisp, |
---|
4160 | and not too hard to upgrade from ASDF 1 to ASDF 2 from within Lisp. |
---|
4161 | We support hot upgrade of ASDF and any breakage is a bug |
---|
4162 | that we will do our best to fix. |
---|
4163 | There are still limitations on upgrade, though, |
---|
4164 | most notably the fact that after you upgrade ASDF, |
---|
4165 | you must also reload or upgrade all ASDF extensions. |
---|
4166 | |
---|
4167 | @subsection Decoupled release cycle |
---|
4168 | |
---|
4169 | When vendors were releasing their Lisp implementations with ASDF, |
---|
4170 | they had to basically never change version |
---|
4171 | because neither upgrade nor downgrade was possible |
---|
4172 | without breaking something for someone, |
---|
4173 | and no obvious upgrade path was visible and recommendable. |
---|
4174 | |
---|
4175 | With ASDF 2, upgrade is possible, easy and can be recommended. |
---|
4176 | This means that vendors can safely ship a recent version of ASDF, |
---|
4177 | confident that if a user isn't fully satisfied, |
---|
4178 | he can easily upgrade ASDF and deal |
---|
4179 | with a supported recent version of it. |
---|
4180 | This means that release cycles will be causally decoupled, |
---|
4181 | the practical consequence of which will mean faster convergence |
---|
4182 | towards the latest version for everyone. |
---|
4183 | |
---|
4184 | |
---|
4185 | @subsection Pitfalls of the transition to ASDF 2 |
---|
4186 | |
---|
4187 | The main pitfalls in upgrading to ASDF 2 seem to be related |
---|
4188 | to the output translation mechanism. |
---|
4189 | |
---|
4190 | @itemize |
---|
4191 | |
---|
4192 | @item |
---|
4193 | Output translations is enabled by default. This may surprise some users, |
---|
4194 | most of them in pleasant way (we hope), a few of them in an unpleasant way. |
---|
4195 | It is trivial to disable output translations. |
---|
4196 | @xref{FAQ,,``How can I wholly disable the compiler output cache?''}. |
---|
4197 | |
---|
4198 | @item |
---|
4199 | Some systems in the large have been known |
---|
4200 | not to play well with output translations. |
---|
4201 | They were relatively easy to fix. |
---|
4202 | Once again, it is also easy to disable output translations, |
---|
4203 | or to override its configuration. |
---|
4204 | |
---|
4205 | @item |
---|
4206 | The new ASDF output translations are incompatible with ASDF-Binary-Locations. |
---|
4207 | They replace A-B-L, and there is compatibility mode to emulate |
---|
4208 | your previous A-B-L configuration. |
---|
4209 | See @code{enable-asdf-binary-locations-compatibility} in |
---|
4210 | @pxref{Controlling where ASDF saves compiled files,,Backward Compatibility}. |
---|
4211 | But thou shalt not load ABL on top of ASDF 2. |
---|
4212 | |
---|
4213 | @end itemize |
---|
4214 | |
---|
4215 | Other issues include the following: |
---|
4216 | |
---|
4217 | @itemize |
---|
4218 | |
---|
4219 | @item |
---|
4220 | ASDF pathname designators are now specified |
---|
4221 | in places where they were unspecified, |
---|
4222 | and a few small adjustments have to be made to some non-portable defsystems. |
---|
4223 | Notably, in the @code{:pathname} argument |
---|
4224 | to a @code{defsystem} and its components, |
---|
4225 | a logical pathname (or implementation-dependent hierarchical pathname) |
---|
4226 | must now be specified with @code{#p} syntax |
---|
4227 | where the namestring might have previously sufficed; |
---|
4228 | moreover when evaluation is desired @code{#.} must be used, |
---|
4229 | where it wasn't necessary in the toplevel @code{:pathname} argument |
---|
4230 | (but necessary in other @code{:pathname} arguments). |
---|
4231 | |
---|
4232 | @item |
---|
4233 | There is a slight performance bug, notably on SBCL, |
---|
4234 | when initially searching for @file{asd} files, |
---|
4235 | the implicit @code{(directory "/configured/path/**/*.asd")} |
---|
4236 | for every configured path @code{(:tree "/configured/path/")} |
---|
4237 | in your @code{source-registry} configuration can cause a slight pause. |
---|
4238 | Try to @code{(time (asdf:initialize-source-registry))} |
---|
4239 | to see how bad it is or isn't on your system. |
---|
4240 | If you insist on not having this pause, |
---|
4241 | you can avoid the pause by overriding the default source-registry configuration |
---|
4242 | and not use any deep @code{:tree} entry but only @code{:directory} entries |
---|
4243 | or shallow @code{:tree} entries. |
---|
4244 | Or you can fix your implementation to not be quite that slow |
---|
4245 | when recursing through directories. |
---|
4246 | @emph{Update}: This performance bug fixed the hard way in 2.010. |
---|
4247 | |
---|
4248 | @item |
---|
4249 | On Windows, only LispWorks supports proper default configuration pathnames |
---|
4250 | based on the Windows registry. |
---|
4251 | Other implementations make do with environment variables, |
---|
4252 | that you may have to define yourself |
---|
4253 | if you're using an older version of Windows. |
---|
4254 | Windows support is somewhat less tested than Unix support. |
---|
4255 | Please help report and fix bugs. |
---|
4256 | @emph{Update}: As of ASDF 2.21, all implementations |
---|
4257 | should now use the same proper default configuration pathnames |
---|
4258 | and they should actually work, though they haven't all been tested. |
---|
4259 | |
---|
4260 | @item |
---|
4261 | The mechanism by which one customizes a system so that Lisp files |
---|
4262 | may use a different extension from the default @file{.lisp} has changed. |
---|
4263 | Previously, the pathname for a component |
---|
4264 | was lazily computed when operating on a system, |
---|
4265 | and you would |
---|
4266 | @code{(defmethod source-file-type ((component cl-source-file) (system (eql (find-system 'foo)))) |
---|
4267 | (declare (ignorable component system)) "lis")}. |
---|
4268 | Now, the pathname for a component is eagerly computed when defining the system, |
---|
4269 | and instead you will @code{(defclass cl-source-file.lis (cl-source-file) ((type :initform "lis")))} |
---|
4270 | and use @code{:default-component-class cl-source-file.lis} |
---|
4271 | as argument to @code{defsystem}, |
---|
4272 | as detailed in a @pxref{FAQ,How do I create a system definition where all the source files have a .cl extension?} below. |
---|
4273 | |
---|
4274 | @findex source-file-type |
---|
4275 | |
---|
4276 | |
---|
4277 | @end itemize |
---|
4278 | |
---|
4279 | |
---|
4280 | @section Issues with installing the proper version of ASDF |
---|
4281 | |
---|
4282 | @subsection ``My Common Lisp implementation comes with an outdated version of ASDF. What to do?'' |
---|
4283 | |
---|
4284 | We recommend you upgrade ASDF. |
---|
4285 | @xref{Loading ASDF,,Upgrading ASDF}. |
---|
4286 | |
---|
4287 | If this does not work, it is a bug, and you should report it. |
---|
4288 | @xref{FAQ, report-bugs, Where do I report a bug}. |
---|
4289 | In the meantime, you can load @file{asdf.lisp} directly. |
---|
4290 | @xref{Loading ASDF,Loading an otherwise installed ASDF}. |
---|
4291 | |
---|
4292 | |
---|
4293 | @subsection ``I'm a Common Lisp implementation vendor. When and how should I upgrade ASDF?'' |
---|
4294 | |
---|
4295 | Since ASDF 2, |
---|
4296 | it should always be a good time to upgrade to a recent version of ASDF. |
---|
4297 | You may consult with the maintainer for which specific version they recommend, |
---|
4298 | but the latest @code{release} should be correct. |
---|
4299 | Though we do try to test ASDF releases against all implementations that we can, |
---|
4300 | we may not be testing against all variants of your implementation, |
---|
4301 | and we may not be running enough tetst; |
---|
4302 | we trust you to thoroughly test it with your own implementation |
---|
4303 | before you release it. |
---|
4304 | If there are any issues with the current release, |
---|
4305 | it's a bug that you should report upstream and that we will fix ASAP. |
---|
4306 | |
---|
4307 | As to how to include ASDF, we recommend the following: |
---|
4308 | |
---|
4309 | @itemize |
---|
4310 | @item |
---|
4311 | If ASDF isn't loaded yet, then @code{(require "asdf")} |
---|
4312 | should load the version of ASDF that is bundled with your system. |
---|
4313 | If possible so should @code{(require "ASDF")}. |
---|
4314 | You may have it load some other version configured by the user, |
---|
4315 | if you allow such configuration. |
---|
4316 | |
---|
4317 | @item |
---|
4318 | If your system provides a mechanism to hook into @code{CL:REQUIRE}, |
---|
4319 | then it would be nice to add ASDF to this hook the same way that |
---|
4320 | ABCL, CCL, CLISP, CMUCL, ECL, SBCL and SCL do it. |
---|
4321 | Please send us appropriate code to this end. |
---|
4322 | |
---|
4323 | @item |
---|
4324 | You may, like SBCL, have ASDF be implicitly used to require systems |
---|
4325 | that are bundled with your Lisp distribution. |
---|
4326 | If you do have a few magic systems that come with your implementation |
---|
4327 | in a precompiled way such that one should only use the binary version |
---|
4328 | that goes with your distribution, like SBCL does, |
---|
4329 | then you should add them in the beginning of @code{wrapping-source-registry}. |
---|
4330 | |
---|
4331 | @item |
---|
4332 | If you have magic systems as above, like SBCL does, |
---|
4333 | then we explicitly ask you to @emph{NOT} distribute |
---|
4334 | @file{asdf.asd} as part of those magic systems. |
---|
4335 | You should still include the file @file{asdf.lisp} in your source distribution |
---|
4336 | and precompile it in your binary distribution, |
---|
4337 | but @file{asdf.asd} if included at all, |
---|
4338 | should be secluded from the magic systems, |
---|
4339 | in a separate file hierarchy. |
---|
4340 | Alternatively, you may provide the system |
---|
4341 | after renaming it and its @file{.asd} file to e.g. |
---|
4342 | @code{asdf-ecl} and @file{asdf-ecl.asd}, or |
---|
4343 | @code{sb-asdf} and @file{sb-asdf.asd}. |
---|
4344 | Indeed, if you made @file{asdf.asd} a magic system, |
---|
4345 | then users would no longer be able to upgrade ASDF using ASDF itself |
---|
4346 | to some version of their preference that |
---|
4347 | they maintain independently from your Lisp distribution. |
---|
4348 | |
---|
4349 | @item |
---|
4350 | If you do not have any such magic systems, or have other non-magic systems |
---|
4351 | that you want to bundle with your implementation, |
---|
4352 | then you may add them to the @code{wrapping-source-registry}, |
---|
4353 | and you are welcome to include @file{asdf.asd} amongst them. |
---|
4354 | Non-magic systems should be at the back of the @code{wrapping-source-registry} |
---|
4355 | while magic systems are at the front. |
---|
4356 | |
---|
4357 | @item |
---|
4358 | Since ASDF 3, the library UIOP comes transcluded in ASDF. |
---|
4359 | But for extra brownies, you may package UIOP separately, |
---|
4360 | so that one may @code{(require "uiop")} and not pull ASDF, |
---|
4361 | or one may @code{(require "asdf")} |
---|
4362 | and that would implicitly require the former. |
---|
4363 | |
---|
4364 | @item |
---|
4365 | Please send us upstream any patches you make to ASDF itself, |
---|
4366 | so we can merge them back in for the benefit of your users |
---|
4367 | when they upgrade to the upstream version. |
---|
4368 | |
---|
4369 | @end itemize |
---|
4370 | |
---|
4371 | |
---|
4372 | |
---|
4373 | @section Issues with configuring ASDF |
---|
4374 | |
---|
4375 | @subsection ``How can I customize where fasl files are stored?'' |
---|
4376 | |
---|
4377 | @xref{Controlling where ASDF saves compiled files}. |
---|
4378 | |
---|
4379 | Note that in the past there was an add-on to ASDF called |
---|
4380 | @code{ASDF-binary-locations}, developed by Gary King. |
---|
4381 | That add-on has been merged into ASDF proper, |
---|
4382 | then superseded by the @code{asdf-output-translations} facility. |
---|
4383 | |
---|
4384 | Note that use of @code{asdf-output-translations} |
---|
4385 | can interfere with one aspect of your systems |
---|
4386 | --- if your system uses @code{*load-truename*} to find files |
---|
4387 | (e.g., if you have some data files stored with your program), |
---|
4388 | then the relocation that this ASDF customization performs |
---|
4389 | is likely to interfere. |
---|
4390 | Use @code{asdf:system-relative-pathname} to locate a file |
---|
4391 | in the source directory of some system, and |
---|
4392 | use @code{asdf:apply-output-translations} to locate a file |
---|
4393 | whose pathname has been translated by the facility. |
---|
4394 | |
---|
4395 | @subsection ``How can I wholly disable the compiler output cache?'' |
---|
4396 | |
---|
4397 | To permanently disable the compiler output cache |
---|
4398 | for all future runs of ASDF, you can: |
---|
4399 | |
---|
4400 | @example |
---|
4401 | mkdir -p ~/.config/common-lisp/asdf-output-translations.conf.d/ |
---|
4402 | echo ':disable-cache' > ~/.config/common-lisp/asdf-output-translations.conf.d/99-disable-cache.conf |
---|
4403 | @end example |
---|
4404 | |
---|
4405 | This assumes that you didn't otherwise configure the ASDF files |
---|
4406 | (if you did, edit them again), |
---|
4407 | and don't somehow override the configuration at runtime |
---|
4408 | with a shell variable (see below) or some other runtime command |
---|
4409 | (e.g. some call to @code{asdf:initialize-output-translations}). |
---|
4410 | |
---|
4411 | To disable the compiler output cache in Lisp processes |
---|
4412 | run by your current shell, try (assuming @code{bash} or @code{zsh}) |
---|
4413 | (on Unix and cygwin only): |
---|
4414 | |
---|
4415 | @example |
---|
4416 | export ASDF_OUTPUT_TRANSLATIONS=/: |
---|
4417 | @end example |
---|
4418 | |
---|
4419 | To disable the compiler output cache just in the current Lisp process, |
---|
4420 | use (after loading ASDF but before using it): |
---|
4421 | |
---|
4422 | @example |
---|
4423 | (asdf:disable-output-translations) |
---|
4424 | @end example |
---|
4425 | |
---|
4426 | @section Issues with using and extending ASDF to define systems |
---|
4427 | |
---|
4428 | @subsection ``How can I cater for unit-testing in my system?'' |
---|
4429 | |
---|
4430 | ASDF provides a predefined test operation, @code{test-op}. |
---|
4431 | @xref{Predefined operations of ASDF, test-op}. |
---|
4432 | The test operation, however, is largely left to the system definer to specify. |
---|
4433 | @code{test-op} has been |
---|
4434 | a topic of considerable discussion on the |
---|
4435 | @url{http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel,asdf-devel mailing list}, |
---|
4436 | and on the |
---|
4437 | @url{https://launchpad.net/asdf,launchpad bug-tracker}. |
---|
4438 | |
---|
4439 | Here are some guidelines: |
---|
4440 | |
---|
4441 | @itemize |
---|
4442 | @item |
---|
4443 | For a given system, @var{foo}, you will want to define a corresponding |
---|
4444 | test system, such as @var{foo-test}. The reason that you will want this |
---|
4445 | separate system is that ASDF does not out of the box supply components |
---|
4446 | that are conditionally loaded. So if you want to have source files |
---|
4447 | (with the test definitions) that will not be loaded except when testing, |
---|
4448 | they should be put elsewhere. |
---|
4449 | |
---|
4450 | @item |
---|
4451 | The @var{foo-test} system can be defined in an asd file of its own or |
---|
4452 | together with @var{foo}. An aesthetic preference against cluttering up |
---|
4453 | the filesystem with extra asd files should be balanced against the |
---|
4454 | question of whether one might want to directly load @var{foo-test}. |
---|
4455 | Typically one would not want to do this except in early stages of |
---|
4456 | debugging. |
---|
4457 | |
---|
4458 | @item |
---|
4459 | Record that testing is implemented by @var{foo-test}. For example: |
---|
4460 | @example |
---|
4461 | (defsystem @var{foo} |
---|
4462 | :in-order-to ((test-op (test-op @var{foo-test}))) |
---|
4463 | ....) |
---|
4464 | |
---|
4465 | (defsystem @var{foo-test} |
---|
4466 | :depends-on (@var{foo} @var{my-test-library} ...) |
---|
4467 | ....) |
---|
4468 | @end example |
---|
4469 | @end itemize |
---|
4470 | |
---|
4471 | This procedure will allow you to support users who do not wish to |
---|
4472 | install your test framework. |
---|
4473 | |
---|
4474 | One oddity of ASDF is that @code{operate} (@pxref{Operations,operate}) |
---|
4475 | does not return a value. So in current versions of ASDF there is no |
---|
4476 | reliable programmatic means of determining whether or not a set of tests |
---|
4477 | has passed, or which tests have failed. The user must simply read the |
---|
4478 | console output. This limitation has been the subject of much |
---|
4479 | discussion. |
---|
4480 | |
---|
4481 | @subsection ``How can I cater for documentation generation in my system?'' |
---|
4482 | |
---|
4483 | The ASDF developers are currently working to add a @code{doc-op} |
---|
4484 | to the set of predefined ASDF operations. |
---|
4485 | @xref{Predefined operations of ASDF}. |
---|
4486 | See also @url{https://bugs.launchpad.net/asdf/+bug/479470}. |
---|
4487 | |
---|
4488 | |
---|
4489 | |
---|
4490 | @subsection ``How can I maintain non-Lisp (e.g. C) source files?'' |
---|
4491 | |
---|
4492 | See @code{cffi}'s @code{cffi-grovel}. |
---|
4493 | |
---|
4494 | @anchor{report-bugs} |
---|
4495 | |
---|
4496 | |
---|
4497 | @subsection ``I want to put my module's files at the top level. How do I do this?'' |
---|
4498 | |
---|
4499 | By default, the files contained in an asdf module go |
---|
4500 | in a subdirectory with the same name as the module. |
---|
4501 | However, this can be overridden by adding a @code{:pathname ""} argument |
---|
4502 | to the module description. |
---|
4503 | For example, here is how it could be done |
---|
4504 | in the spatial-trees ASDF system definition for ASDF 2: |
---|
4505 | |
---|
4506 | @example |
---|
4507 | (asdf:defsystem :spatial-trees |
---|
4508 | :components |
---|
4509 | ((:module base |
---|
4510 | :pathname "" |
---|
4511 | :components |
---|
4512 | ((:file "package") |
---|
4513 | (:file "basedefs" :depends-on ("package")) |
---|
4514 | (:file "rectangles" :depends-on ("package")))) |
---|
4515 | (:module tree-impls |
---|
4516 | :depends-on (base) |
---|
4517 | :pathname "" |
---|
4518 | :components |
---|
4519 | ((:file "r-trees") |
---|
4520 | (:file "greene-trees" :depends-on ("r-trees")) |
---|
4521 | (:file "rstar-trees" :depends-on ("r-trees")) |
---|
4522 | (:file "rplus-trees" :depends-on ("r-trees")) |
---|
4523 | (:file "x-trees" :depends-on ("r-trees" "rstar-trees")))) |
---|
4524 | (:module viz |
---|
4525 | :depends-on (base) |
---|
4526 | :pathname "" |
---|
4527 | :components |
---|
4528 | ((:static-file "spatial-tree-viz.lisp"))) |
---|
4529 | (:module tests |
---|
4530 | :depends-on (base) |
---|
4531 | :pathname "" |
---|
4532 | :components |
---|
4533 | ((:static-file "spatial-tree-test.lisp"))) |
---|
4534 | (:static-file "LICENCE") |
---|
4535 | (:static-file "TODO"))) |
---|
4536 | @end example |
---|
4537 | |
---|
4538 | All of the files in the @code{tree-impls} module are at the top level, |
---|
4539 | instead of in a @file{tree-impls/} subdirectory. |
---|
4540 | |
---|
4541 | Note that the argument to @code{:pathname} can be either a pathname object or a string. |
---|
4542 | A pathname object can be constructed with the @file{#p"foo/bar/"} syntax, |
---|
4543 | but this is discouraged because the results of parsing a namestring are not portable. |
---|
4544 | A pathname can only be portably constructed with such syntax as |
---|
4545 | @code{#.(make-pathname :directory '(:relative "foo" "bar"))}, |
---|
4546 | and similarly the current directory can only be portably specified as |
---|
4547 | @code{#.(make-pathname :directory '(:relative))}. |
---|
4548 | However, as of ASDF 2, you can portably use a string to denote a pathname. |
---|
4549 | The string will be parsed as a @code{/}-separated path from the current directory, |
---|
4550 | such that the empty string @code{""} denotes the current directory, and |
---|
4551 | @code{"foo/bar"} (no trailing @code{/} required in the case of modules) |
---|
4552 | portably denotes the same subdirectory as above. |
---|
4553 | When files are specified, the last @code{/}-separated component is interpreted |
---|
4554 | either as the name component of a pathname |
---|
4555 | (if the component class specifies a pathname type), |
---|
4556 | or as a name component plus optional dot-separated type component |
---|
4557 | (if the component class doesn't specifies a pathname type). |
---|
4558 | |
---|
4559 | @subsection How do I create a system definition where all the source files have a .cl extension? |
---|
4560 | |
---|
4561 | Starting with ASDF 2.014.14, you may just pass |
---|
4562 | the builtin class @code{cl-source-file.cl} as |
---|
4563 | the @code{:default-component-class} argument to @code{defsystem}: |
---|
4564 | |
---|
4565 | @lisp |
---|
4566 | (defsystem my-cl-system |
---|
4567 | :default-component-class cl-source-file.cl |
---|
4568 | ...) |
---|
4569 | @end lisp |
---|
4570 | |
---|
4571 | Another builtin class @code{cl-source-file.lsp} is offered |
---|
4572 | for files ending in @file{.lsp}. |
---|
4573 | |
---|
4574 | If you want to use a different extension |
---|
4575 | for which ASDF doesn't provide builtin support, |
---|
4576 | or want to support versions of ASDF |
---|
4577 | earlier than 2.014.14 (but later than 2.000), |
---|
4578 | you can define a class as follows: |
---|
4579 | |
---|
4580 | @lisp |
---|
4581 | ;; Prologue: make sure we're using a sane package. |
---|
4582 | (defpackage :my-asdf-extension |
---|
4583 | (:use :asdf :common-lisp) |
---|
4584 | (:export #:cl-source-file.lis)) |
---|
4585 | (in-package :my-asdf-extension) |
---|
4586 | |
---|
4587 | (defclass cl-source-file.lis (cl-source-file) |
---|
4588 | ((type :initform "lis"))) |
---|
4589 | @end lisp |
---|
4590 | |
---|
4591 | Then you can use it as follows: |
---|
4592 | @lisp |
---|
4593 | (defsystem my-cl-system |
---|
4594 | :default-component-class my-asdf-extension:cl-source-file.lis |
---|
4595 | ...) |
---|
4596 | @end lisp |
---|
4597 | |
---|
4598 | Of course, if you're in the same package, e.g. in the same file, |
---|
4599 | you won't need to use the package qualifier before @code{cl-source-file.lis}. |
---|
4600 | Actually, if all you're doing is defining this class |
---|
4601 | and using it in the same file without other fancy definitions, |
---|
4602 | you might skip package complications: |
---|
4603 | |
---|
4604 | @lisp |
---|
4605 | (in-package :asdf) |
---|
4606 | (defclass cl-source-file.lis (cl-source-file) |
---|
4607 | ((type :initform "lis"))) |
---|
4608 | (defsystem my-cl-system |
---|
4609 | :default-component-class cl-source-file.lis |
---|
4610 | ...) |
---|
4611 | @end lisp |
---|
4612 | |
---|
4613 | It is possible to achieve the same effect |
---|
4614 | in a way that supports both ASDF 1 and ASDF 2, |
---|
4615 | but really, friends don't let friends use ASDF 1. |
---|
4616 | Please upgrade to ASDF 3. |
---|
4617 | In short, though: do same as above, but |
---|
4618 | @emph{before} you use the class in a @code{defsystem}, |
---|
4619 | you also define the following method: |
---|
4620 | |
---|
4621 | @lisp |
---|
4622 | (defmethod source-file-type ((f cl-source-file.lis) (s system)) |
---|
4623 | (declare (ignorable f s)) |
---|
4624 | "lis") |
---|
4625 | @end lisp |
---|
4626 | |
---|
4627 | @comment FIXME: Add a FAQ about how to use a new system class... |
---|
4628 | |
---|
4629 | |
---|
4630 | @node TODO list, Inspiration, FAQ, Top |
---|
4631 | @comment node-name, next, previous, up |
---|
4632 | @chapter TODO list |
---|
4633 | |
---|
4634 | Here is an old list of things to do, |
---|
4635 | in addition to the bugs that are now tracked on launchpad: |
---|
4636 | @url{https://launchpad.net/asdf}. |
---|
4637 | |
---|
4638 | @section Outstanding spec questions, things to add |
---|
4639 | |
---|
4640 | ** packaging systems |
---|
4641 | |
---|
4642 | *** manual page component? |
---|
4643 | |
---|
4644 | ** style guide for .asd files |
---|
4645 | |
---|
4646 | You should either use keywords or be careful |
---|
4647 | with the package that you evaluate defsystem forms in. |
---|
4648 | Otherwise @code{(defsystem partition ...)} |
---|
4649 | being read in the @code{cl-user} package |
---|
4650 | will intern a @code{cl-user:partition} symbol, |
---|
4651 | which will then collide with the @code{partition:partition} symbol. |
---|
4652 | |
---|
4653 | Actually there's a hairier packages problem to think about too. |
---|
4654 | @code{in-order-to} is not a keyword: |
---|
4655 | if you read @code{defsystem} forms in a package that doesn't use ASDF, |
---|
4656 | odd things might happen. |
---|
4657 | |
---|
4658 | |
---|
4659 | ** extending defsystem with new options |
---|
4660 | |
---|
4661 | You might not want to write a whole parser, |
---|
4662 | but just to add options to the existing syntax. |
---|
4663 | Reinstate @code{parse-option} or something akin. |
---|
4664 | |
---|
4665 | |
---|
4666 | ** Diagnostics |
---|
4667 | |
---|
4668 | A ``dry run'' of an operation can be made with the following form: |
---|
4669 | |
---|
4670 | @lisp |
---|
4671 | (let ((asdf::*verbose-out* *standard-output*)) |
---|
4672 | (loop :for (op . comp) :in |
---|
4673 | (asdf::traverse (make-instance '<operation-name> :force t) |
---|
4674 | (asdf:find-system <system-name>)) |
---|
4675 | :do (asdf:explain op comp))) |
---|
4676 | @end lisp |
---|
4677 | |
---|
4678 | This uses unexported symbols. |
---|
4679 | What would be a nice interface for this functionality? |
---|
4680 | |
---|
4681 | @section Missing bits in implementation |
---|
4682 | |
---|
4683 | ** reuse the same scratch package whenever a system is reloaded from disk |
---|
4684 | |
---|
4685 | Have a package ASDF-USER instead of all these temporary packages? |
---|
4686 | |
---|
4687 | ** proclamations probably aren't |
---|
4688 | |
---|
4689 | ** A revert function |
---|
4690 | |
---|
4691 | Other possible interface: have a ``revert'' function akin to @code{make clean}. |
---|
4692 | |
---|
4693 | @lisp |
---|
4694 | (asdf:revert 'asdf:compile-op 'araneida) |
---|
4695 | @end lisp |
---|
4696 | |
---|
4697 | would delete any files produced by @code{(compile-system :araneida)}. |
---|
4698 | Of course, it wouldn't be able to do much about stuff in the image itself. |
---|
4699 | |
---|
4700 | How would this work? |
---|
4701 | |
---|
4702 | @code{traverse} |
---|
4703 | |
---|
4704 | There's a difference between a module's dependencies (peers) |
---|
4705 | and its components (children). |
---|
4706 | Perhaps there's a similar difference in operations? |
---|
4707 | For example, @code{(load "use") depends-on (load "macros")} is a peer, |
---|
4708 | whereas @code{(load "use") depends-on (compile "use")} |
---|
4709 | is more of a ``subservient'' relationship. |
---|
4710 | |
---|
4711 | @node Inspiration, Concept Index, TODO list, Top |
---|
4712 | @comment node-name, next, previous, up |
---|
4713 | @chapter Inspiration |
---|
4714 | |
---|
4715 | @section mk-defsystem (defsystem-3.x) |
---|
4716 | |
---|
4717 | We aim to solve basically the same problems as @code{mk-defsystem} does. |
---|
4718 | However, our architecture for extensibility |
---|
4719 | better exploits CL language features (and is documented), |
---|
4720 | and we intend to be portable rather than just widely-ported. |
---|
4721 | No slight on the @code{mk-defsystem} authors and maintainers is intended here; |
---|
4722 | that implementation has the unenviable task |
---|
4723 | of supporting pre-ANSI implementations, which is no longer necessary. |
---|
4724 | |
---|
4725 | The surface defsystem syntax of asdf is more-or-less compatible with |
---|
4726 | @code{mk-defsystem}, except that we do not support |
---|
4727 | the @code{source-foo} and @code{binary-foo} prefixes |
---|
4728 | for separating source and binary files, and |
---|
4729 | we advise the removal of all options to specify pathnames. |
---|
4730 | |
---|
4731 | The @code{mk-defsystem} code for topologically sorting |
---|
4732 | a module's dependency list was very useful. |
---|
4733 | |
---|
4734 | @section defsystem-4 proposal |
---|
4735 | |
---|
4736 | Marco and Peter's proposal for defsystem 4 served as the driver for |
---|
4737 | many of the features in here. Notable differences are: |
---|
4738 | |
---|
4739 | @itemize |
---|
4740 | @item |
---|
4741 | We don't specify output files or output file extensions |
---|
4742 | as part of the system. |
---|
4743 | |
---|
4744 | If you want to find out what files an operation would create, |
---|
4745 | ask the operation. |
---|
4746 | |
---|
4747 | @item |
---|
4748 | We don't deal with CL packages |
---|
4749 | |
---|
4750 | If you want to compile in a particular package, use an @code{in-package} form |
---|
4751 | in that file (ilisp / SLIME will like you more if you do this anyway) |
---|
4752 | |
---|
4753 | @item |
---|
4754 | There is no proposal here that @code{defsystem} does version control. |
---|
4755 | |
---|
4756 | A system has a given version which can be used to check dependencies, |
---|
4757 | but that's all. |
---|
4758 | @end itemize |
---|
4759 | |
---|
4760 | The defsystem 4 proposal tends to look more at the external features, |
---|
4761 | whereas this one centres on a protocol for system introspection. |
---|
4762 | |
---|
4763 | @section kmp's ``The Description of Large Systems'', MIT AI Memo 801 |
---|
4764 | |
---|
4765 | Available in updated-for-CL form on the web at |
---|
4766 | @url{http://nhplace.com/kent/Papers/Large-Systems.html} |
---|
4767 | |
---|
4768 | In our implementation we borrow kmp's overall @code{PROCESS-OPTIONS} |
---|
4769 | and concept to deal with creating component trees |
---|
4770 | from @code{defsystem} surface syntax. |
---|
4771 | [ this is not true right now, though it used to be and |
---|
4772 | probably will be again soon ] |
---|
4773 | |
---|
4774 | |
---|
4775 | @c ------------------- |
---|
4776 | |
---|
4777 | |
---|
4778 | @node Concept Index, Function and Class Index, Inspiration, Top |
---|
4779 | @unnumbered Concept Index |
---|
4780 | |
---|
4781 | @printindex cp |
---|
4782 | |
---|
4783 | @node Function and Class Index, Variable Index, Concept Index, Top |
---|
4784 | @unnumbered Function and Class Index |
---|
4785 | |
---|
4786 | @printindex fn |
---|
4787 | |
---|
4788 | @node Variable Index, , Function and Class Index, Top |
---|
4789 | @unnumbered Variable Index |
---|
4790 | |
---|
4791 | @printindex vr |
---|
4792 | |
---|
4793 | @bye |
---|