Next: , Previous: , Up: Controlling where ASDF saves compiled files   [Contents][Index]


9.3 Configuration DSL

Here is the grammar of the SEXP DSL for asdf-output-translations configuration:

;; A configuration is single SEXP starting with keyword :output-translations
;; followed by a list of directives.
CONFIGURATION := (:output-translations DIRECTIVE ...)

;; A directive is one of the following:
DIRECTIVE :=
    ;; INHERITANCE DIRECTIVE:
    ;; Your configuration expression MUST contain
    ;; exactly one of either of these:
    :inherit-configuration |
      ;; splices inherited configuration (often specified last)
    :ignore-inherited-configuration |
      ;; drop inherited configuration (specified anywhere)

    ;; forward compatibility directive (since ASDF 2.011.4), useful when
    ;; you want to use new configuration features but have to bootstrap a
    ;; the newer required ASDF from an older release that doesn't have
    ;; said features:
    :ignore-invalid-entries |

    ;; include a configuration file or directory
    (:include PATHNAME-DESIGNATOR) |

    ;; enable global cache in ~/.common-lisp/cache/sbcl-1.0.45-linux-amd64/
    ;; or something.
    :enable-user-cache |
    ;; Disable global cache. Map / to /
    :disable-cache |

    ;; add a single directory to be scanned (no recursion)
    (DIRECTORY-DESIGNATOR DIRECTORY-DESIGNATOR)

    ;; use a function to return the translation of a directory designator
    (DIRECTORY-DESIGNATOR (:function TRANSLATION-FUNCTION))

DIRECTORY-DESIGNATOR :=
    NIL | ; As source: skip this entry. As destination: same as source
    T | ; as source matches anything, as destination
        ; maps pathname to itself.
    ABSOLUTE-COMPONENT-DESIGNATOR ; same as in the source-registry language

TRANSLATION-FUNCTION :=
    SYMBOL | ;; symbol naming a function that takes two arguments:
             ;; the pathname to be translated and the matching
             ;; DIRECTORY-DESIGNATOR
    LAMBDA   ;; A form which evaluates to a function taking two arguments:
             ;; the pathname to be translated and the matching
             ;; DIRECTORY-DESIGNATOR

Relative components better be either relative or subdirectories of the path before them, or bust.

The last component, if not a pathname, is notionally completed by /**/*.*. You can specify more fine-grained patterns by using a pathname object as the last component e.g. #p"some/path/**/foo*/bar-*.fasl"

You may use #+features to customize the configuration file.

The second designator of a mapping may be nil, indicating that files are not mapped to anything but themselves (same as if the second designator was the same as the first).

When the first designator is t, the mapping always matches. When the first designator starts with :root, the mapping matches any host and device. In either of these cases, if the second designator isn’t t and doesn’t start with :root, then strings indicating the host and pathname are somehow copied in the beginning of the directory component of the source pathname before it is translated.

When the second designator is t, the mapping is the identity. When the second designator starts with :root, the mapping preserves the host and device of the original pathname. Notably, this allows you to map files to a subdirectory of the whichever directory the file is in. Though the syntax is not quite as easy to use as we’d like, you can have an (source destination) mapping entry such as follows in your configuration file, or you may use enable-asdf-binary-locations-compatibility with :centralize-lisp-binaries nil which will do the same thing internally for you:

#.(let ((wild-subdir
          (make-pathname :directory '(:relative :wild-inferiors)))
        (wild-file
          (make-pathname :name :wild :version :wild :type :wild)))
   `((:root ,wild-subdir ,wild-file)
     (:root ,wild-subdir :implementation ,wild-file)))

Starting with ASDF 2.011.4, you can use the simpler: `(:root (:root :**/ :implementation :*.*.*))

:include statements cause the search to recurse with the path specifications from the file specified.

If the translate-pathname mechanism cannot achieve a desired translation, the user may provide a function which provides the required algorithm. Such a translation function is specified by supplying a list as the second directory-designator the first element of which is the keyword :function, and the second element of which is either a symbol which designates a function or a lambda expression. The function designated by the second argument must take two arguments, the first being the pathname of the source file, the second being the wildcard that was matched. When invoked, the function should return the translated pathname.

An :inherit-configuration statement causes the search to recurse with the path specifications from the next configuration in the bulleted list. See Configurations, above.


Next: Configuration Directories, Previous: Backward Compatibility, Up: Controlling where ASDF saves compiled files   [Contents][Index]