Search code examples
common-lispasdf

Initializing ASDF Source Registry to Specific Locations


Currently, I initialize ASDF to a high-level directory:

(asdf:initialize-source-registry
  `(:source-registry
     (:tree "D:\\Users Data\\Dave\\SW Library\\AI\\")
     :inherit-configuration))

Can the recursive search time through subdirectories be reduced by explicitly listing the directories of the projects I'm currently working on? What is the :source-registry format for doing this? (I can't find it in the ASDF Manual. Would prefer not to simply add the directories to asdf:*central-registry* in the old style.)


Solution

  • One way to solve this problem is to let Quicklisp do it for you. If you install your systems under QL's local-projects directory then it will do the search, once, and then cache the results. It is quite smart about this:

    This works by keeping a cache of system file pathnames in <quicklisp>/local-projects/system-index.txt. Whenever the timestamp on the local projects directory is newer than the timestamp on the system index file, the entire tree is re-scanned and cached.

    (From a comment in local-projects.lisp.)

    Even better: if it decides it needs to redo the search it does it when you try to load the first system, not before. So image startup time is unaffected and you pay the cost when you expect to pay it. QL is ... quite well-written.

    In practice because I bury my systems fairly deep under the local-projects directory I explicitly touch the directory to force QL to search again.

    You can have multiple local projects directories (I have not tested this), and control where they are, by setting ql:*local-projects-directories*.

    Using this approach you can, as best I can tell, use either raw ASDF or Quicklisp to build & load systems. I never use raw ASDF, so I can't promise this works.

    Of course doing this requires having Quicklisp installed.