-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem.lisp
40 lines (38 loc) · 1.44 KB
/
system.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(defpackage :kiln/system
(:use :cl :alexandria :serapeum :kiln/flags)
(:export :load-system))
(in-package :kiln/system)
(defun get-system-load-function (&key silent)
(assure function
(if-let (ql (find-package :ql))
(let ((fn
(assure function
(symbol-function
(find-external-symbol (string 'quickload)
ql)))))
(lambda (system &rest args)
(apply fn system :silent silent args)))
(if (not silent)
(lambda (system &rest args)
(multiple-value-call #'asdf:load-system
system
(values-list args)
:verbose t))
(lambda (system &rest args)
(let ((*standard-output* (make-broadcast-stream))
(*error-output* (make-broadcast-stream)))
(apply #'asdf:load-system system args)))))))
(defun load-system (system/s &rest args &key (silent (not (dbg?))) tolerant
&allow-other-keys)
(let ((fn (get-system-load-function :silent silent)))
(dolist (system (ensure-list system/s))
(block nil
(handler-bind ((error
(lambda (e)
(when tolerant
(dbg "Skipping ~a because: ~a" system e)
(return)))))
(apply fn
system
:allow-other-keys t
args))))))