From c4d7d475edf3e95256eafcf67909f26e0678ed03 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau <tunes@google.com> Date: Fri, 18 Nov 2011 03:00:25 -0500 Subject: [PATCH] 2.018.11: allow :around-compile to be a string, to be read just before use. --- asdf.asd | 2 +- asdf.lisp | 13 ++++++++++--- doc/asdf.texinfo | 23 ++++++++++++++--------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/asdf.asd b/asdf.asd index ef383bd5..9d7c0bc4 100644 --- a/asdf.asd +++ b/asdf.asd @@ -14,7 +14,7 @@ :licence "MIT" :description "Another System Definition Facility" :long-description "ASDF builds Common Lisp software organized into defined systems." - :version "2.018.10" ;; to be automatically updated by bin/bump-revision + :version "2.018.11" ;; to be automatically updated by bin/bump-revision :depends-on () :components ((:file "asdf") diff --git a/asdf.lisp b/asdf.lisp index 89dc4d5b..f38c2efd 100644 --- a/asdf.lisp +++ b/asdf.lisp @@ -1,5 +1,5 @@ ;;; -*- mode: Common-Lisp; Base: 10 ; Syntax: ANSI-Common-Lisp -*- -;;; This is ASDF 2.018.10: Another System Definition Facility. +;;; This is ASDF 2.018.11: Another System Definition Facility. ;;; ;;; Feedback, bug reports, and patches are all welcome: ;;; please mail to <asdf-devel@common-lisp.net>. @@ -107,7 +107,7 @@ ;; "2.345.6" would be a development version in the official upstream ;; "2.345.0.7" would be your seventh local modification of official release 2.345 ;; "2.345.6.7" would be your seventh local modification of development version 2.345.6 - (asdf-version "2.018.10") + (asdf-version "2.018.11") (existing-asdf (find-class 'component nil)) (existing-version *asdf-version*) (already-there (equal asdf-version existing-version))) @@ -2374,10 +2374,17 @@ recursive calls to traverse.") ((component-parent c) (around-compile-hook (component-parent c))))) +(defun ensure-function (fun &key (package :asdf)) + (etypecase fun + ((or symbol function) fun) + (string (eval `(function ,(with-standard-io-syntax + (let ((*package* (find-package package))) + (read-from-string fun)))))))) + (defmethod call-with-around-compile-hook ((c component) thunk) (let ((hook (around-compile-hook c))) (if hook - (funcall hook thunk) + (funcall (ensure-function hook) thunk) (funcall thunk)))) (defvar *compile-op-compile-file-function* 'compile-file* diff --git a/doc/asdf.texinfo b/doc/asdf.texinfo index 15cec1d3..c1a4f594 100644 --- a/doc/asdf.texinfo +++ b/doc/asdf.texinfo @@ -2830,16 +2830,21 @@ useful for system definition and development. @section Controlling file compilation When declaring a component (system, module, file), -you can specify a keyword argument @code{:around-compile some-symbol}. -If left unspecified, the value will be inherited from the parent component if any, -or with a default of @code{nil} if no value is specified in any transitive parent. - -The argument must be a either fbound symbol or @code{nil}. +you can specify a keyword argument @code{:around-compile function}. +If left unspecified, +the value will be inherited from the parent component if any, +or with a default of @code{nil} +if no value is specified in any transitive parent. + +The argument must be a either @code{nil}, a function, a fbound symbol, +or a string that when read yields a symbol or a lambda-expression. @code{nil} means the normal compile-file function will be called. -A symbol means the function fbound to it will be called with a single argument, -a thunk that calls the compile-file function; -the function you specify must then funcall that thunk -inside whatever wrapping you want. +A non-nil value designates a function of one argument +that will be called with a thunk for calling +the compile-file function with proper arguments. +Note that by using a string, you may reference a symbol and/or package +that will only be created later during the build, but +isn't present at the time the defsystem form is evaluated. Using this hook, you may achieve such effects as: locally renaming packages, -- GitLab