Published on

What does an .asd file do in a Common Lisp project?

Authors
  • avatar
    Name
    hwahyeon
    Twitter

An .asd file is a system definition file used by ASDF (Another System Definition Facility), the build and dependency management tool in Common Lisp. It defines a system, which is ASDF's term for a logical unit such as a project, library, or module, and includes its components, dependencies, and metadata. It serves a similar purpose to package.json in JavaScript or setup.py in Python.

The file is written in Lisp using the defsystem macro. It typically includes the system name, description, version, author, dependencies, and a list of source files to load. Here's an example:

(defsystem "sample-project"
  :description "A simple example project"
  :version "0.1.0"
  :author "John Doe"
  :depends-on ("cl-ppcre" "alexandria")
  :components ((:file "package")
               (:file "main")))

Once defined, the system can be loaded with a single command such as (ql:quickload :sample-project) when using Quicklisp, or (asdf:load-system :sample-project) with ASDF directly. ASDF automatically resolves dependencies and loads the files in the correct order.