A component represents an individual source file or a group of source files,
and the things that get transformed into.
A system is a component at the top level of the component hierarchy,
that can be found via find-system.
A source-file is a component representing a single source-file
and the successive output files into which it is transformed.
A module is an intermediate component itself grouping several other components,
themselves source-files or further modules.
A system designator is a system itself, or a string or symbol that behaves just like any other component name (including with regard to the case conversion rules for component names).
A component designator, relative to a base component, is either a component itself, or a string or symbol, or a list of designators.
Given a system designator,
find-systemfinds and returns a system. If no system is found, an error of typemissing-componentis thrown, ornilis returned iferror-pis false.To find and update systems,
find-systemfuncalls each element in the*system-definition-search-functions*list, expecting a pathname to be returned, or a system object, from which a pathname may be extracted, and that will be registered. The resulting pathname (if any) is loaded if one of the following conditions is true:
- there is no system of that name in memory
- the pathname is different from that which was previously loaded
- the file's
last-modifiedtime exceeds thelast-modifiedtime of the system in memoryWhen system definitions are loaded from .asd files, they are implicitly loaded into the
ASDF-USERpackage, which usesASDF,UIOPandUIOP/COMMON-LISP1 Programmers who do anything non-trivial in a .asd file, such as defining new variables, functions or classes, should includedefpackageandin-packageforms in this file, so they will not overwrite each others' extensions. Such forms might also help the files behave identically if loaded manually withcl:loadfor development or debugging, though we recommend you use the functionasdf::load-asdinstead, which theslime-asdfcontrib knows about.The default value of
*system-definition-search-functions*is a list of three functions. The first function looks in each of the directories given by evaluating members of*central-registry*for a file whose name is the name of the system and whose type is asd; the first such file is returned, whether or not it turns out to actually define the appropriate system. The second function does something similar, for the directories specified in thesource-registry, but searches the filesystem only once and caches its results. The third function makes thepackage-inferred-systemextension work, see The package-inferred-system extension.Because of the way these search functions are defined, you should put the definition for a system foo in a file named foo.asd, in a directory that is in the central registry or which can be found using the source registry configuration.
It is often useful to define multiple systems in a same file, but ASDF can only locate a system's definition file based on the system name. For this reason, ASDF 3's system search algorithm has been extended to allow a file foo.asd to contain secondary systems named foo/bar, foo/baz, foo/quux, etc., in addition to the primary system named foo. The first component of a system name, separated by the slash character,
/, is called the primary name of a system. The primary name may be extracted by functionasdf::primary-system-name; when ASDF 3 is told to find a system whose name has a slash, it will first attempt to load the corresponding primary system, and will thus see any such definitions, and/or any definition of apackage-inferred-system.2 If your file foo.asd also defines systems that do not follow this convention, e.g., a system named foo-test, ASDF will not be able to automatically locate a definition for these systems, and will only see their definition if you explicitly find or load the primary system using e.g.(asdf:find-system "foo")before you try to use them. We strongly recommend against this practice, though it is currently supported for backward compatibility.
Internal (not exported) function,
asdf::primary-system-name. Returns the primary system name (the portion before the slash,/, in a secondary system name) from name.
This function should typically not be invoked directly. It is exported as part of the API only for programmers who wish to provide their own
*system-definition-search-functions*.Given a system name designator, try to locate where to load the system definition from. Returns five values: foundp, found-system, pathname, previous, and previous-time. foundp is true when a system was found, either a new as yet unregistered one, or a previously registered one. The found-system return value will be a
systemobject, if a system definition is found in your source registry. The system definition will not be loaded if it hasn't been loaded already. pathname when not null is a path from which to load the system, either associated with found-system, or with the previous system. If previous is not null, it will be a previously loadedsystemobject of the same name (note that the system definition is previously-loaded: the system itself may or may not be). previous-time when not null is the timestamp of the previous system definition file, at the time when the previous system definition was loaded.For example, if your current registry has foo.asd in /current/path/to/foo.asd, but system
foowas previously loaded from /previous/path/to/foo.asd then locate-system will return the following values:
- foundp will be
T,- found-system will be
NIL,- pathname will be
#p"/current/path/to/foo.asd",- previous will be an object of type
SYSTEMwithsystem-source-fileslot value of#p"/previous/path/to/foo.asd"- previous-time will be the timestamp of
#p"/previous/path/to/foo.asd"at the time it was loaded.
Given a base component (or designator for such), and a path, find the component designated by the path starting from the base.
If path is a component object, it designates itself, independently from the base.
If path is a string, or symbol denoting a string via
coerce-name, then base is resolved to a component object, which must be a system or module, and the designated component is the child named by the path.If path is a
conscell,find-componentwith the base and thecarof the path, and the resulting object is used as the base for a tail call tofind-componentwith thecarof the path.If base is a component object, it designates itself.
If base is null, then path is used as the base, with
nilas the path.If base is a string, or symbol denoting a string via
coerce-name, it designates a system as perfind-system.If base is a
conscell, it designates the component found byfind-componentwith itscaras base andcdras path.
[1]
Note that between releases 2.27 and 3.0.3, only UIOP/PACKAGE,
not all of UIOP, was used; if you want your code to work
with releases earlier than 3.1.2, you may have to explicitly define a package
that uses UIOP, or use proper package prefix to your symbols, as in
uiop:version<.
[2]
ASDF 2.26 and earlier versions
do not support this primary system name convention.
With these versions of ASDF
you must explicitly load foo.asd
before you can use system foo/bar defined therein,
e.g. using (asdf:find-system "foo").
We do not support ASDF 2, and recommend that you should upgrade to ASDF 3.