asdf-ext - Extensions to the asdf primary distribution
Overview
The asdf-ext package will ultimately contain a number of useful extensions to the core
asdf distribution available on the asdf cliki page. The current
release of asdf-ext includes the asdf-installable file asdf-config which simplifies exporting parameters
and startup initialization routines for a user. Future extensions intended include
asdf-net (an updated version of asdf-install) and other methodologies for managing
the relationship between static images, source files, source control and the dynamic
state of a running lisp.
These releases should run on all ANSI compliant Common Lisp distributions.
This extension to asdf was developed to simplify exporting a module or package
to a user when that module depends on external resources that are user or machine
specific and want to be setup external to the system source code. If the system
depends on certain data files being loaded or network systems being tested, a
single top-level initialization function can be called after the system is configured.
This package is complementary to other lisp abstractions in hiding system code from
machine or user specific configuration:
- default defparameter and defvar values (user can accept or override)
- Machine-specific paths can also be managed using logical pathnames as defaults and
requesting the user define the root directory for a logical filesystem.
asdf-config adds two new operations to the asdf interface:
(asdf:oos 'asdf-config:configure-op ...)
and
(asdf:oos 'asdf-config:initialize-op ...)
and modifies the behavior of the load operation.
Operation behaviors:
- configure
- apply system-specific parameter settings, verify the existence
of any data files and the home package for the system being configured.
- initialize
- Ensure that the system is loaded and configured then call a registered
load function for module
- load
- overload load for persistant-components
asdf-config also adds some components to supply data for the new operations:
- system-config
- Extends the basic system with new fields that provide a list of settable
configuration parameters and an initialization statement to be called
via initialize-op
System flow:
- System Developer extends the asdf-based system description using defsystem-config
- Provides a set of parameter names to export to the user and defparams or defvars
to set within the system after it is loaded. The user parameter names can be
set to specific values prior to the loading of a system.
- Provide an initialization function to call (optionally) that uses the parameter
setting to load files, test for network resources, etc.
- User loads asdf-config after asdf.lisp
- User then sets parameters in their personal or machine initialization files that
customize the system to their preferences using 'asdf-config:set-parameters
or individual calls to asdf-config:set-parameter with entries being a quoted
list of triples containing (:system :parameter-name value-expression)
The value is a lisp value and cannot depend on names or values from within the
system being configured (the package will have to convert strings or symbols
internally if necessary)
A good example of asdf-config use is the downloadable system 'langutils' at:
~eslick/langutils
The following entries are from the author's init file and langutils.asd
langutils.asd
(defsystem-config :langutils
:description "Natural Language Toolkit"
:version "1.0"
...
:parameters ((:token-map "langutils::*default-token-map-file*")
(:lexicon "langutils::*default-lexicon-file*")
(:stems "langutils::*default-stems-file*")
(:lexical-rules "langutils::*default-lexical-rule-file*")
(:contextual-rules "langutils::*default-contextual-rule-file*")
(:stopwords "langutils::*default-stopwords-file*")
(:concise-stopwords "langutils::*default-concise-stopwords-file*"))
:initialization "langutils::init-langutils")
clinit.cl
(asdf-config:set-parameters
'((:langutils :token-map "c:/Work/lisp/my-data/langutils-token-map.sexp")
(:langutils :stopwords "c:/Work/lisp/my-data/langutils-custom-stopwords.txt")))
Parameter entries have the form:
(:parameter-name :my-param :default nil :required t :parameter *my-param*)
Initialization command is a string which is resolved into a function name AFTER
the system has been loaded and the package and name are valid.
Utility functions:
- describe-parameters ( system-name )
- describes the parameters available in a loaded system
- get-lisp-source-filenames ( system-name )
- provides a list of paths for source
files for the system. Can be slow as forces a parse of all dependencies and provides
not just those for the package, but everything that system depends on.
- get-all-sources ( system-name &key (reset-visited t))
- Get all the source files for the
package for all its dependencies. reset-visited means that you force the dependency
tracker to revisit all systems. Returns asdf source file objects.
Features left to implement:
- Validate the existence of logical filesystems during configuration setting
(systematic vs. per-system ad-hoc approach currently allowed via init routine)
- Validate the existence of external resources during initialization
(systematic vs. per-system ad-hoc approach currently allowed via init routine)
- More native support for logical filesystems