3

Is there a way I can make asdf load all files (*.lisp) in a directory without naming them all in my .asd file? Using wildcards in both directory or filename spec doesn't work. Can someone please help?

Sunder
  • 63
  • 4

3 Answers3

3

See DIRECTORY:

 CL-USER> (directory "*.lisp")
 => ("a.lisp"
     "b.lisp"
     ...)

Then, call LOAD for each file.

But then, you could also do:

CL-USER> (loop for f in * collect `(:file ,(pathname-name f)))
((:file "a") (:file "b"))

Then, you can copy that in your .asd file, so that your dependencies are a little more explicit.

coredump
  • 37,664
  • 5
  • 43
  • 77
3

You could use the “package inferred system” extension of ASDF: https://common-lisp.net/project/asdf/asdf/The-package_002dinferred_002dsystem-extension.html#The-package_002dinferred_002dsystem-extension. You will have to adhere to a directory and file naming convention for this, but it is (superficially) a bit closer to how such things are organized in other languages.

I have to admit that I prefer the explicit layout in the asd file, though, because it keeps the concepts of systems, packages, and files clearly apart.

Svante
  • 50,694
  • 11
  • 78
  • 122
1

The asdf repository comes with a asdf/contrib/wild-modules.lisp extension that does what you say. I'd still use package-inferred-system instead.

Faré
  • 952
  • 5
  • 4