@@ -298,7 +298,16 @@ guess you know what you're doing.")
298298 (install))
299299
300300
301- (defmethod load-system ((name string ) &key verbose silent force ref add)
301+ (defun grab-missing (name)
302+ ; ; TODO: this is so ugly, but I don't know any other way to access
303+ ; ; the condition inside the the restart function.
304+ (handler-case
305+ (asdf :load-system name)
306+ (asdf/find-component :missing-dependency (condition )
307+ (asdf/find-component :missing-requires condition ))))
308+
309+
310+ (defmethod load-system ((name string ) &key verbose silent force load-tests)
302311 " Load system with NAME.
303312
304313If VERBOSE is non-nil display verbose output."
@@ -310,20 +319,38 @@ If VERBOSE is non-nil display verbose output."
310319 (qprint " Loading ~A ." *standard-output* name))
311320 (handler-bind (#+ sbcl (sb-ext :compiler-note #' muffle-warning )
312321 (warning #' muffle-warning ))
313- (handler -case
322+ (restart -case
314323 (asdf :load-system name :verbose verbose :force force)
315- (asdf/find-component :missing-component ()
316- (install-system name :ref ref :add add)
317- (load-system name :force force :silent t :verbose verbose))))))
318-
319-
320- (defmethod load-system ((name symbol ) &key verbose silent force ref add)
324+ (add-dependency ()
325+ :test (lambda (c)
326+ (and (typep c ' asdf/find-component:missing-dependency)
327+ (clm :find-system (asdf/find-component :missing-requires c) nil )))
328+ :report (lambda (stream )
329+ (format stream " Add missing dependency to clmfile, run update and try again loading?" ))
330+ (let ((missing (grab-missing name)))
331+ (add-to-clmfile missing)
332+ (update)
333+ (load-system name
334+ :verbose verbose
335+ :silent silent
336+ :force force
337+ :load-tests load-tests))))
338+ (when load-tests
339+ (load-system (concatenate ' string name " /test" )
340+ :verbose verbose
341+ :silent silent
342+ :force force))))
343+ t )
344+
345+
346+ (defmethod load-system ((name symbol ) &key verbose silent force ref add load-tests)
321347 (load-system (string-downcase (string name))
322348 :verbose verbose
323349 :silent silent
324350 :force force
325351 :ref ref
326- :add add))
352+ :add add
353+ :load-tests load-tests))
327354
328355
329356(defun load-systems (systems &key verbose silent force)
0 commit comments