-
-
Save bhyde/526c5acb38f341d60dba to your computer and use it in GitHub Desktop.
Proof of concept: disk-cache the asdf source-registry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defparameter *quickasdf-file* (merge-pathnames ".quickasdf.lisp" (user-homedir-pathname))) ;; BAH | |
(defun initialize-source-registry (&optional (parameter *source-registry-parameter*)) | |
;; Record the parameter used to configure the registry | |
(setf *source-registry-parameter* parameter) | |
;; Clear the previous registry database: | |
(setf *source-registry* (make-hash-table :test 'equal)) | |
;; Do it! | |
(if (probe-file *quickasdf-file*) ;; BAH | |
(progn (print :yeah) (load *quickasdf-file*)) | |
(compute-source-registry parameter))) | |
(defun reset-quickasdf () ;; BAH | |
(uiop:delete-file-if-exists *quickasdf-file*) | |
(initialize-source-registry) | |
(let ((*package* (find-package '#:asdf/source-registry)) | |
(asd-pathnames | |
(loop | |
for pathname being each hash-value of *source-registry* | |
collect pathname))) | |
(with-open-file (*standard-output* *quickasdf-file* | |
:direction :output | |
:if-exists :rename-and-delete) | |
(print '(defpackage #:asdf/source-registry (:use #:common-lisp))) | |
(print '(in-package #:asdf/source-registry)) | |
(print '(defvar *source-registry*)) | |
(print '(setf *source-registry* (make-hash-table :test 'equal))) | |
(pprint `(map nil | |
#'(lambda (p) (setf (gethash (pathname-name p) *source-registry*) p)) | |
',asd-pathnames))) | |
(length asd-pathnames))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment