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