All the operations described in this section are in the asdf package.
They are invoked via the operate generic function.
(asdf:operate 'asdf:operation-name :system-name {operation-options ...})
compile-opThis operation compiles the specified component. A
cl-source-filewill becompile-file'd. All the children and dependencies of a system or module will be recursively compiled bycompile-op.
compile-opdepends onprepare-opwhich itself depends on aload-opof all of a component's dependencies, as well as of its parent's dependencies. Whenoperateis called oncompile-op, all these dependencies will be loaded as well as compiled; yet, some parts of the system main remain unloaded, because nothing depends on them. Useload-opto load a system.
load-opThis operation loads the compiled code for a specified component. A
cl-source-filewill have its compiled faslloaded, which fasl is the output ofcompile-opthatload-opdepends on.
load-opwill recursively load all the children of a system or module.
load-opalso depends onprepare-opwhich itself depends on aload-opof all of a component's dependencies, as well as of its parent's dependencies.
prepare-opThis operation ensures that the dependencies of a component and its recursive parents are loaded (as per
load-op), as a prerequisite beforecompile-opandload-opoperations may be performed on a given component.
load-source-op, prepare-source-op
load-source-opwill load the source for the files in a module rather than the compiled fasl output. It has aprepare-source-opanalog toprepare-op, that ensures the dependencies are themselves loaded viaload-source-op.
test-opThis operation will perform some tests on the module. The default method will do nothing. The default dependency is to require
load-opto be performed on the module first. Its defaultoperation-done-pmethod returnsnil, which means that the operation is never done – we assume that if you invoke thetest-op, you want to test the system, even if you have already done so.The results of this operation are not defined by ASDF. It has proven difficult to define how the test operation should signal its results to the user in a way that is compatible with all of the various test libraries and test techniques in use in the community, and given the fact that ASDF operations do not return a value indicating success or failure. For those willing to go to the effort, we suggest defining conditions to signal when a
test-opfails, and storing in those conditions information that describes which tests fail.People typically define a separate test system to hold the tests. Doing this avoids unnecessarily adding a test framework as a dependency on a library. For example, one might have
(defsystem "foo" :in-order-to ((test-op (test-op "foo/test"))) ...) (defsystem "foo/test" :depends-on ("foo" "fiveam") ; fiveam is a test framework library ...)Then one defines
performmethods ontest-opsuch as the following:(defsystem "foo/test" :depends-on ("foo" "fiveam") ; fiveam is a test framework library :perform (test-op (o s) (uiop:symbol-call :fiveam '#:run! (uiop:find-symbol* '#:foo-test-suite :foo-tests))) ...)
compile-bundle-op, monolithic-compile-bundle-op, load-bundle-op, monolithic-load-bundle-op, deliver-asd-op, monolithic-deliver-asd-op, lib-op, monolithic-lib-op, dll-op, monolithic-dll-op, image-op, program-opThese are “bundle” operations, that can create a single-file “bundle” for all the contents of each system in an application, or for the entire application.
compile-bundle-opwill create a single fasl file for each of the systems needed, grouping all its many fasls in one, so you can deliver each system as a single faslmonolithic-compile-bundle-opwill create a single fasl file for the target system and all its dependencies, so you can deliver your entire application as a single fasl.load-bundle-opwill load the output ofcompile-bundle-op. Note that if it the output is not up-to-date,compile-bundle-opmay load the intermediate fasls as a side-effect. Bundling fasls together matters a lot on ECL, where the dynamic linking involved in loading tens of individual fasls can be noticeably more expensive than loading a single one.NB:
compile-bundle-op,monolithic-compile-bundle-op,load-bundle-op,monolithic-load-bundle-op,deliver-asd-op,monolithic-deliver-asd-opwere respectively calledfasl-op,monolithic-fasl-op,load-fasl-op,monolithic-load-fasl-op,binary-op,monolithic-binary-opbefore ASDF 3.1. The old names still exist for backward compatibility, though they poorly label what is going on.Once you have created a fasl with
compile-bundle-op, you can useprecompiled-systemto deliver it in a way that is compatible with clients having dependencies on your system, whether it is distributed as source or as a single binary; the .asd file to be delivered with the fasl will look like this:(defsystem :mysystem :class :precompiled-system :fasl (some expression that will evaluate to a pathname))Or you can use
deliver-asd-opto let ASDF create such a system for you as well as thecompile-bundle-opoutput, ormonolithic-deliver-asd-op. This allows you to deliver code for your systems or applications as a single file. Of course, if you want to test the result in the current image, before you try to use any newly created .asd files, you should not forget to(asdf:clear-configuration)or at least(asdf:clear-source-registry), so it re-populates the source-registry from the filesystem.The
program-opoperation will create an executable program from the specified system and its dependencies. You can use UIOP for its pre-image-dump hooks, its post-image-restore hooks, and its access to command-line arguments. And you can specify an entry pointmy-app:mainby specifying in yourdefsystemthe option:entry-point "my-app:main". Depending on your implementation, running(asdf:operate 'asdf:program-op :my-app)may quit the current Lisp image upon completion. See the example in test/hello-world-example.asd and test/hello.lisp, as built and tested by test/test-program.script and test/make-hello-world.lisp.image-opwill dump an image that may not be standalone and does not start its own function, but follows the usual execution convention of the underlying Lisp, just with more code pre-loaded, for use as an intermediate build result or with a wrapper invocation script.There is also
lib-opfor building a linkable .a file (Windows: .lib) from all linkable object dependencies (FFI files, and on ECL, Lisp files too), and its monolithic equivalentmonolithic-lib-op. And there is alsodll-op(respectively its monolithic equivalentmonolithic-lib-op) for building a linkable .so file (Windows: .dll, MacOS X: .dynlib) to create a single dynamic library for all the extra FFI code to be linked into each of your systems (respectively your entire application).All these “bundle” operations are available since ASDF 3 on all actively supported Lisp implementations, but may be unavailable on unmaintained legacy implementations. This functionality was previously available for select implementations, as part of a separate system
asdf-bundle, itself descended from the ECL-onlyasdf-ecl.The pathname of the output of bundle operations is subject to output-translation as usual, unless the operation is equal to the
:build-operationargument todefsystem. This behaviour is not very satisfactory and may change in the future. Maybe you have suggestions on how to better configure it?
concatenate-source-op, monolithic-concatenate-source-op, load-concatenated-source-op, compile-concatenated-source-op, load-compiled-concatenated-source-op, monolithic-load-concatenated-source-op, monolithic-compile-concatenated-source-op, monolithic-load-compiled-concatenated-source-opThese operations, as their respective names indicate, will concatenate all the
cl-source-filesource files in a system (or in a system and all its dependencies, if monolithic), in the order defined by dependencies, then load the result, or compile and then load the result.These operations are useful to deliver a system or application as a single source file, and for testing that said file loads properly, or compiles and then loads properly.
ASDF itself is delivered as a single source file this way, using
monolithic-concatenate-source-op, prepending a prelude and theuioplibrary before theasdf/defsystemsystem itself.