Easily traverse and collect ASDF dependencies recursively.
  • Common Lisp 100%
Find a file
2025-09-19 12:43:17 +02:00
.gitignore Initial commit 2025-09-19 12:28:05 +02:00
asdf-dependency-traverser.asd Initial commit 2025-09-19 12:28:05 +02:00
asdf-dependency-traverser.lisp Initial commit 2025-09-19 12:28:05 +02:00
README.md Add note regarding example code 2025-09-19 12:43:17 +02:00

ASDF Dependency Traverser

Provides functions for traversing the dependency tree of an ASDF system. Unlike previous quick scripts of mine, it properly handles conditional :FEATURE dependencies, accepts :VERSION dependencies, and ignores :REQUIRE dependencies (though that could one be fixed in the future).

Example usage

;;; Finding all the licenses that our big program must comply with.

(remove-duplicates
  (mapcar #'asdf:system-license
          (asdf-dependency-traverser:traverse-dependencies "my-big-program"))
  :test #'equalp)

;;; ("MIT/X11" "MIT Style license " "LLGPL" "BSD-2-Clause" "MIT-style license"
;;;  "BSD" "Public Domain"
;;;  "BSD-style (http://opensource.org/licenses/BSD-3-Clause)" "zlib"
;;;  "Public Domain / 0-clause MIT" "MIT" "BSD-2" NIL)

;;; Look, there's a NIL there. Some systems must have forgotten to specify
;;; their licenses.

(asdf-dependency-traverser:traverse-dependencies
  "my-big-program"
  (lambda (system)
    (when (null (asdf:system-license system))
      (warn "System ~A has no declared license." system))))

;;; WARNING: System #<SYSTEM "uiop"> has no declared license.
;;; WARNING: System #<REQUIRE-SYSTEM "sb-rotate-byte"> has no declared license.
;;; [... return value omitted]

;;; Those are fine, one is part of SBCL and the other is part of ASDF, and we
;;; can easily find the licenses for both of those. Do note that any
;;; dependencies that were conditionally skipped due to *FEATURES* won't have
;;; their licenses included here, so this isn't a 100% perfect way of doing it.

License

Zlib license is used, see source code file for license text and copyright notice.