1
0
Fork 0
cl-sites/asdf.common-lisp.dev/asdf/The-object-model-of-ASDF.html
2023-11-12 11:34:18 +01:00

163 lines
8.2 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual describes ASDF, a system definition facility
for Common Lisp programs and libraries.
You can find the latest version of this manual at
https://common-lisp.net/project/asdf/asdf.html.
ASDF Copyright (C) 2001-2019 Daniel Barlow and contributors.
This manual Copyright (C) 2001-2019 Daniel Barlow and contributors.
This manual revised (C) 2009-2019 Robert P. Goldman and Francois-Rene Rideau.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<title>The object model of ASDF (ASDF Manual)</title>
<meta name="description" content="The object model of ASDF (ASDF Manual)">
<meta name="keywords" content="The object model of ASDF (ASDF Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html" rel="up" title="Top">
<link href="Controlling-where-ASDF-searches-for-systems.html" rel="next" title="Controlling where ASDF searches for systems">
<link href="Defining-systems-with-defsystem.html" rel="prev" title="Defining systems with defsystem">
<style type="text/css">
<!--
a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
span:hover a.copiable-anchor {visibility: visible}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<div class="chapter" id="The-object-model-of-ASDF">
<div class="header">
<p>
Next: <a href="Controlling-where-ASDF-searches-for-systems.html" accesskey="n" rel="next">Controlling where ASDF searches for systems</a>, Previous: <a href="Defining-systems-with-defsystem.html" accesskey="p" rel="prev">Defining systems with defsystem</a>, Up: <a href="index.html" accesskey="u" rel="up">ASDF: Another System Definition Facility</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="The-Object-model-of-ASDF"></span><h2 class="chapter">7 The Object model of ASDF</h2>
<span id="index-component-1"></span>
<span id="index-operation-1"></span>
<p>ASDF is designed in an object-oriented way from the ground up.
Both a system&rsquo;s structure and the operations that can be performed on systems
follow an extensible protocol, allowing programmers to add new behaviours to ASDF.
For example, <code>cffi</code> adds support for special FFI description files
that interface with C libraries and for wrapper files that embed C code in Lisp.
<code>asdf-jar</code> supports creating Java JAR archives in ABCL.
<code>poiu</code> supports compiling code in parallel using background processes.
</p>
<p>The key classes in ASDF are <code>component</code> and <code>operation</code>.
A <code>component</code> represents an individual source file or a group of source files,
and the products (e.g., fasl files) produced from it.
An <code>operation</code> represents a transformation that can be performed on a component,
turning them from source files to intermediate results to final outputs.
Components are related by <em>dependencies</em>, specified in system
definitions.
</p>
<p>When ordered to <code>operate</code> with some operation on a component (usually a system),
ASDF will first compute a <em>plan</em>
by traversing the dependency graph using function <code>make-plan</code>.<a id="DOCF10" href="The-object-model-of-ASDF.html#FOOT10"><sup>10</sup></a>
The resulting plan object contains an ordered list of <em>actions</em>.
An action is a pair of an <code>operation</code> and a <code>component</code>,
representing a particular build step to be <code>perform</code>ed.
The ordering of the plan ensures that no action is performed before
all its dependencies have been fulfilled.<a id="DOCF11" href="The-object-model-of-ASDF.html#FOOT11"><sup>11</sup></a>
</p>
<p>In this chapter, we describe ASDF&rsquo;s object-oriented protocol,
the classes that make it up, and the generic functions on those classes.
These generic functions often take
both an operation and a component as arguments:
much of the power and configurability of ASDF is provided by
this use of CLOS&rsquo;s multiple dispatch.
We will describe the built-in component and operation classes, and
explain how to extend the ASDF protocol by defining new classes and
methods for ASDF&rsquo;s generic functions.
We will also describe the many <em>hooks</em> that can be configured to
customize the behaviour of existing <em>functions</em>.
</p>
<ul class="section-toc">
<li><a href="Operations.html" accesskey="1">Operations</a></li>
<li><a href="Components.html" accesskey="2">Components</a></li>
<li><a href="Dependencies.html" accesskey="3">Dependencies</a></li>
<li><a href="Functions.html" accesskey="4">Functions</a></li>
<li><a href="Parsing-system-definitions.html" accesskey="5">Parsing system definitions</a></li>
</ul>
</div>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h5><a id="FOOT10" href="The-object-model-of-ASDF.html#DOCF10">(10)</a></h5>
<p>Historically, the function that built a plan was
called <code>traverse</code>, and returned a list of actions;
it was deprecated in favor of <code>make-plan</code> (that returns a plan object)
when the <code>plan</code> objects were introduced with ASDF 3;
the old function is kept for backward compatibility and debugging purposes only,
and may be removed in the near future.
</p>
<h5><a id="FOOT11" href="The-object-model-of-ASDF.html#DOCF11">(11)</a></h5>
<p>The term <em>action</em>
was used by Kent Pitman in his article, &ldquo;The Description of Large Systems,&rdquo;
(see <a href="Bibliography.html">Bibliography</a>),
and we suspect might be traced to <code>make</code>.
Although the term was only used by ASDF hackers starting with ASDF 2,
the concept was there since the very beginning of ASDF 1,
just not clearly articulated.
</p>
</div>
<hr>
<div class="header">
<p>
Next: <a href="Controlling-where-ASDF-searches-for-systems.html">Controlling where ASDF searches for systems</a>, Previous: <a href="Defining-systems-with-defsystem.html">Defining systems with defsystem</a>, Up: <a href="index.html">ASDF: Another System Definition Facility</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>