ASDF3 on Clozure CL does not search ASD files under the symbolic links

目次

I put all my lisp projects under the directory git-repos and set symbolic links to each projects from ~/common-lisp. ASDF3 on SBCL loads ASD files under the symbolic links recursively while that on Clozure CL doesn’t. If you add those links to source-registry they get loaded on CCL too. Here is the snipped for CCL to add all the links and directories under ~/common-lisp.

CCL loads ~/ccl-init.lisp or ~/.ccl-init.lisp (post 1.2 versions only) upon startup (see CCL manual). So by putting the following snippet in either of those files ASDF3 on CCL can load the ASD files under the projects with symbolic links.

(defun update-search-path ()
  (let* ((dirs (set-difference (uiop:directory* "~/common-lisp/*")
                               (uiop:directory* "~/common-lisp/.*")
                               :test #'uiop::pathname-equal)))
    (asdf:initialize-source-registry
      `(:source-registry
        ,@(loop for p in dirs
             collect
               (list :tree (namestring p)))
        :inherit-configuration))))

(update-search-path)

You can simply invoke (update-search-path) from REPL when you add more projects under ~/common-isp.

For Roswell user, place the script as ~/.roswell/init.lisp with feature as follows.

Listing 1. .roswell/init.lisp for Roswell
(require :asdf)

#+ccl (in-package :cl-user)

#+ccl (defpackage wshito
        (:use :cl :asdf)
        (:export :update-search-path))

#+ccl (in-package :wshito)

;;;;
;;;; Since ASDF3 on CCL does not recursively search the symbolic links.
;;;; The following snippet adds symlinks under ~/common-lisp
;;;; to the search path manually to be recognized by ASDF3 on CCL.
;;;;
#+ccl
(defun update-search-path ()
  (let* ((dirs (set-difference (uiop:directory* "~/common-lisp/*")
                               (uiop:directory* "~/common-lisp/.*")
                               :test #'uiop::pathname-equal)))
    (asdf:initialize-source-registry
     `(:source-registry
       ,@(loop for p in dirs
            collect
              (list :tree (namestring p)))
       :inherit-configuration))))

#+ccl (update-search-path)

wshito

Read more posts by this author.

Itoshima, Japan http://diary.wshito.com