Answering my own question, I was able to get it to work thanks to the hint from Rainer J.
asdf:defsystem
is a macro which constructs a doodad of type ASDF/SYSTEM:SYSTEM. Then asdf:operate
will take that as its argument instead of a string which names the system.
Here is a trivial example. I am working with SBCL 2.1.6 on an ancient Ubuntu system. The ASDF version is 3.3.something to judge by *FEATURES*
.
In the current working directory, there is a file named bar.lisp
which contains just
(defparameter baz 1234)
(format t "HELLO FROM BAR; BAZ = ~d~%" baz)
Now in the SBCL session I say:
* (require 'asdf)
NIL
* (asdf:defsystem "foo" :pathname #.*default-pathname-defaults* :components ((:file "bar")))
#<ASDF/SYSTEM:SYSTEM "foo">
to construct the system foo
. To tell ASDF to look in the current working directory, the sharp-dot is necessary because otherwise *DEFAULT-PATHNAME-DEFAULTS*
isn't evaluated (since ASDF:DEFSYSTEM is a macro). There are other ways to wedge the value in there (aside from just a string or pathname -- a pathname is maybe not supposed to work but I find it does), but anyway sharp-dot works.
With that system instance in hand, I can load it:
* (asdf:operate 'asdf:load-op *)
; compiling file "/home/robert/tmp/bar.lisp" (written 27 DEC 2022 10:10:04 AM):
; processing (DEFPARAMETER BAZ ...)
; processing (FORMAT T ...)
; wrote /home/robert/.cache/common-lisp/sbcl-2.1.6-linux-x86/home/robert/tmp/bar-tmp7LQ0A0VI.fasl
; compilation finished in 0:00:00.004
HELLO FROM BAR; BAZ = 1234
#<ASDF/LISP-ACTION:LOAD-OP >
#<ASDF/PLAN:SEQUENTIAL-PLAN {9A633C49}>
and verify the variable BAZ is there:
* baz
1234
Ta-da!!