Skip to content

Commit cfd745a

Browse files
committed
Add docstrings and minor fixups to local-projects.lisp.
1 parent 3c65441 commit cfd745a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

local-projects.lisp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,24 @@
3232
(in-package #:quicklisp-client)
3333

3434
(defparameter *local-projects-directory*
35-
(qmerge "local-projects/"))
35+
(qmerge "local-projects/")
36+
"The default local projects directory.")
3637

3738
(defun system-index-file (pathname)
39+
"Return the system index file for the directory PATHNAME."
3840
(merge-pathnames "system-index.txt" pathname))
3941

4042
(defun local-project-system-files (pathname)
43+
"Return a list of system files under PATHNAME."
4144
(let ((wild (merge-pathnames "**/*.asd" pathname)))
4245
(sort (directory wild)
4346
#'<
4447
:key (lambda (file)
4548
(length (namestring file))))))
4649

4750
(defun make-system-index (pathname)
51+
"Create a system index file for all system files under
52+
PATHNAME. Current format is one native namestring per line."
4853
(with-open-file (stream (system-index-file pathname)
4954
:direction :output
5055
:if-exists :rename-and-delete)
@@ -53,25 +58,32 @@
5358
(probe-file stream)))
5459

5560
(defun find-valid-system-index (pathname)
61+
"Find a valid system index file for PATHNAME; one that both exists
62+
and has a newer timestamp than PATHNAME."
5663
(let* ((file (system-index-file pathname))
5764
(probed (probe-file file)))
5865
(when (and probed
5966
(<= (directory-write-date pathname)
60-
(directory-write-date probed)))
67+
(file-write-date probed)))
6168
probed)))
6269

6370
(defun ensure-system-index (pathname)
71+
"Find or create a system index file for PATHNAME."
6472
(or (find-valid-system-index pathname)
6573
(make-system-index pathname)))
6674

6775
(defun find-system-in-index (system index-file)
76+
"If any system pathname in INDEX-FILE has a pathname-name matching
77+
SYSTEM, return its full pathname."
6878
(with-open-file (stream index-file)
6979
(loop for namestring = (read-line stream nil)
7080
while namestring
7181
when (string= system (pathname-name namestring))
7282
return (truename namestring))))
7383

7484
(defun local-projects-searcher (system-name)
85+
"This function is added to ASDF:*SYSTEM-DEFINITION-SEARCH-FUNCTIONS*
86+
to use the local project directory and cache to find systems."
7587
(when (probe-directory *local-projects-directory*)
7688
(let ((system-index (ensure-system-index *local-projects-directory*)))
7789
(when system-index

0 commit comments

Comments
 (0)