Next: , Previous: , Up: Issues with using and extending ASDF to define systems   [Contents][Index]


13.5.5 How do I create a system definition where all the source files have a .cl extension?

Starting with ASDF 2.014.14, you may just pass the builtin class cl-source-file.cl as the :default-component-class argument to defsystem:

(defsystem my-cl-system
  :default-component-class cl-source-file.cl
  ...)

Another builtin class cl-source-file.lsp is offered for files ending in .lsp.

If you want to use a different extension for which ASDF doesn’t provide builtin support, or want to support versions of ASDF earlier than 2.014.14 (but later than 2.000), you can define a class as follows:

;; Prologue: make sure we're using a sane package.
(defpackage :my-asdf-extension
   (:use :asdf :common-lisp)
   (:export #:cl-source-file.lis))
(in-package :my-asdf-extension)

(defclass cl-source-file.lis (cl-source-file)
  ((type :initform "lis")))

Then you can use it as follows:

(defsystem my-cl-system
  :default-component-class my-asdf-extension:cl-source-file.lis
  ...)

Of course, if you’re in the same package, e.g. in the same file, you won’t need to use the package qualifier before cl-source-file.lis. Actually, if all you’re doing is defining this class and using it in the same file without other fancy definitions, you might skip package complications:

(in-package :asdf)
(defclass cl-source-file.lis (cl-source-file)
   ((type :initform "lis")))
(defsystem my-cl-system
  :default-component-class cl-source-file.lis
  ...)

It is possible to achieve the same effect in a way that supports both ASDF 1 and ASDF 2, but really, friends don’t let friends use ASDF 1. Please upgrade to ASDF 3. In short, though: do same as above, but before you use the class in a defsystem, you also define the following method:

(defmethod source-file-type ((f cl-source-file.lis) (s system))
  (declare (ignorable f s))
  "lis")

Next: , Previous: , Up: Issues with using and extending ASDF to define systems   [Contents][Index]