Skip to content
Snippets Groups Projects
Commit 204e1efd authored by Robert P. Goldman's avatar Robert P. Goldman
Browse files

Merge from Hugo Ishimaru with edits.

Merge commit '356c662f' into
hishimaru/asdf-man-fix2

Added index entries and minor copy editing.
parents 7875178f 356c662f
No related branches found
No related tags found
No related merge requests found
...@@ -1942,6 +1942,10 @@ of output from ASDF operations. ...@@ -1942,6 +1942,10 @@ of output from ASDF operations.
@node The package-inferred-system extension, , Other code in .asd files, Defining systems with defsystem @node The package-inferred-system extension, , Other code in .asd files, Defining systems with defsystem
@section The package-inferred-system extension @section The package-inferred-system extension
@codequoteundirected on
@cindex Package inferred systems
@cindex Packages, inferring dependencies from
@findex package-inferred-system
Starting with release 3.1.2, Starting with release 3.1.2,
ASDF supports a one-package-per-file style of programming, ASDF supports a one-package-per-file style of programming,
...@@ -2003,10 +2007,10 @@ packages used or provided by your system and its components ...@@ -2003,10 +2007,10 @@ packages used or provided by your system and its components
when the name of the system that provides the package when the name of the system that provides the package
is not the downcase of the package name. is not the downcase of the package name.
Then, the file @file{interface/order.lisp} under the @code{my-lib} Then, each file under the @code{my-lib} hierarchy will start with a
hierarchy will start with the following @code{define-package} form. package definition, dependencies being computed from the
ASDF will infer the file's dependencies from the @code{:use} and @code{:use} and @code{:mix} clauses. Take a file
@code{:mix} clauses of that form. @file{interface/order.lisp} as an example:
@example @example
(uiop:define-package :my-lib/interface/order (uiop:define-package :my-lib/interface/order
...@@ -2018,20 +2022,52 @@ ASDF will infer the file's dependencies from the @code{:use} and ...@@ -2018,20 +2022,52 @@ ASDF will infer the file's dependencies from the @code{:use} and
@end example @end example
ASDF can tell that this file depends on system @code{closer-mop} (registered above), ASDF can tell that this file depends on system @code{closer-mop} (registered above),
and files @code{my-lib/interface/definition}, @code{my-lib/interface/base}. @code{my-lib/interface/definition}, @code{my-lib/interface/base}
(package and system names match, and they will be looked up hierarchically). (package and system names match, and they will be looked up hierarchically).
How can ASDF find the file @file{interface/order.lisp} from the
toplevel system @code{my-lib}, however? In the example above,
@file{interface/all.lisp} (and other @code{all.lisp}) will reexport
all the symbols at once from the packages at the same or lower levels
of the hierarchy. This can be easily done with
@code{uiop:define-package}:
@example
(uiop:define-package :my-lib/interface/all
(:nicknames :my-lib-interface)
(:use :closer-common-lisp)
(:mix :fare-utils :uiop :alexandria)
(:use-reexport
:my-lib/interface/definition
:my-lib/interface/base
:my-lib/interface/order
:my-lib/interface/monad/continuation))
@end example
Thus you have only to refer to each @code{my-lib/.../all} system
in the toplevel system because ASDF detects
@file{interface/order.lisp} and all other dependencies from the
@code{:use-reexport} clause.
@findex define-package
@findex uiop:define-package
The form @code{uiop:define-package} is supported as well as
@code{defpackage}, and has many options that prove useful in this
context, such as @code{:use-reexport} and @code{:mix-reexport} that
allow for ``inheritance'' of symbols being exported.
ASDF also detects dependencies from @code{:import-from} clauses. ASDF also detects dependencies from @code{:import-from} clauses.
You may thus import a well-defined set of symbols from an existing You may thus import a well-defined set of symbols from an existing
package, and ASDF will know to load the system that provides that package, and ASDF will know to load the system that provides that
package. In the following example, ASDF will infer that the current package. In the following example, ASDF will infer that the current
system depends on @code{''foo/bar''} from the first @code{:import-from}. system depends on
@code{''foo/bar''} from the first @code{:import-from}.
If you prefer to use any such symbol fully qualified by a package prefix, If you prefer to use any such symbol fully qualified by a package prefix,
you may declare a dependency on such a package and its corresponding system you may declare a dependency on such a package and its corresponding system
via an @code{:import-from} clause with an empty list of symbols. For via an @code{:import-from} clause with an empty list of symbols. For
example, if we preferred to use the name `foo/quux:bletch`, the second, example, if we preferred to use the name `foo/quux:bletch`, the second,
empty, @code{:import-from} form would cause ASDF to load empty, @code{:import-from} form would cause ASDF to load
@code{"foo/quux''}. @code{''foo/quux''}.
@example @example
(defpackage :foo/bar (defpackage :foo/bar
...@@ -2076,6 +2112,7 @@ where the @file{.asd} file resides. ...@@ -2076,6 +2112,7 @@ where the @file{.asd} file resides.
@c See this blog post about it: @c See this blog post about it:
@c @url{http://davazp.net/2014/11/26/modern-library-with-asdf-and-package-inferred-system.html} @c @url{http://davazp.net/2014/11/26/modern-library-with-asdf-and-package-inferred-system.html}
@codequoteundirected off
@node The object model of ASDF, Controlling where ASDF searches for systems, Defining systems with defsystem, Top @node The object model of ASDF, Controlling where ASDF searches for systems, Defining systems with defsystem, Top
@comment node-name, next, previous, up @comment node-name, next, previous, up
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment