diff --git a/asdf-abcl.lisp b/asdf-abcl.lisp new file mode 100644 index 0000000..6bf8afc --- /dev/null +++ b/asdf-abcl.lisp @@ -0,0 +1,42 @@ +;;;; ABCL specific code for ASDF +#-abcl (error "This code is only intended to be run under Armed Bear Common Lisp") + +(in-package :asdf) + +(defun module-provide-asdf (name) + (handler-case + (let* ((*verbose-out* (make-broadcast-stream)) + (system (asdf:find-system name nil))) + (when system + (asdf:operate 'asdf:load-op name) + t)) + (missing-component (e) + (declare (ignore e)) + nil) + (t (e) + (format *error-output* "ASDF could not load ~A because ~A.~%" + name e)))) +(when + (find #'module-provide-asdf sys::*module-provider-functions*) + (setf sys::*module-provider-functions* + (remove #'module-provide-asdf sys::*module-provider-functions*))) + +(pushnew #'module-provide-asdf sys::*module-provider-functions*) + +(defun translate-jar-pathname (wildcard source) + (declare (ignore wildcard)) + (let ((root (apply-output-translations + (concatenate 'string + "/:jar:file/" + (namestring (first (pathname-device + source)))))) + (entry (make-pathname :directory (pathname-directory source) + :name (pathname-name source) + :type (pathname-type source)))) + (concatenate 'string (namestring root) (namestring entry)))) + +(initialize-output-translations + '(:output-translations + :ignore-inherited-configuration + (#p"jar:file:/**/*.jar!/**/*.*" :function translate-jar-pathname) + (#p"/:jar:file/**/*.*" (:user-cache #p"**/*.*")))) diff --git a/asdf.asd b/asdf.asd index 57f5cdf..8a3655b 100644 --- a/asdf.asd +++ b/asdf.asd @@ -15,4 +15,5 @@ :depends-on () :components ((:file "asdf") + #+abcl (:file "asdf-abcl" :depends-on ("asdf")) #+ecl (:file "asdf-ecl" :depends-on ("asdf")))) diff --git a/asdf.lisp b/asdf.lisp index 34eb0d0..6b3e169 100644 --- a/asdf.lisp +++ b/asdf.lisp @@ -2365,7 +2368,15 @@ with a different configuration, so the configuration would be re-read then." (and (location-designator-p (first directive)) (location-designator-p (second directive))))) (and (length=n-p directive 1) - (location-designator-p (first directive)))))) + (location-designator-p (first directive))) + (and (length=n-p directive 3) + (eq (second directive) + :function) + (location-designator-p (first directive)) + (or (symbolp (third directive)) + (and (consp (third directive)) + (eq (car (third directive)) + 'lambda))))))) (error "Invalid directive ~S~%" directive)) directive) @@ -2500,12 +2511,20 @@ with a different configuration, so the configuration would be re-read then." (if (eq src :include) (when dst (process-output-translations (pathname dst) :inherit nil :collect collect)) - (when src - (let* ((trusrc (truenamize (resolve-location src t))) - (trudst (if dst (resolve-location dst t) trusrc)) - (wilddst (make-pathname :name :wild :type :wild :defaults trudst))) - (funcall collect (list wilddst wilddst)) - (funcall collect (list trusrc trudst)))))))) + (if (eq dst :function) + (let* ((function (if (symbolp (third directive)) + (fdefinition (third directive)) + (eval (third directive)))) + (trusrc (truenamize (resolve-location src t))) + (wilddst (make-pathname :name :wild :type :wild + :defaults trusrc))) + (funcall collect (list trusrc function))) + (when src + (let* ((trusrc (truenamize (resolve-location src t))) + (trudst (if dst (resolve-location dst t) trusrc)) + (wilddst (make-pathname :name :wild :type :wild :defaults trudst))) + (funcall collect (list wilddst wilddst)) + (funcall collect (list trusrc trudst))))))))) (defun compute-output-translations (&optional parameter) "read the configuration, return it" @@ -2538,7 +2557,10 @@ return the configuration" (setf path (truenamize path)) (loop :for (source destination) :in (car *output-translations*) :when (pathname-match-p path source) - :return (translate-pathname path source destination) + :return + (if (functionp destination) + (funcall destination source path) + (translate-pathname path source destination)) :finally (return path))))) (defmethod output-files :around (operation component) diff --git a/asdf.texinfo b/asdf.texinfo index 4b1a11c..d41feb0 100644 --- a/asdf.texinfo +++ b/asdf.texinfo @@ -1967,6 +1967,8 @@ DIRECTIVE := ;; add a single directory to be scanned (no recursion) (DIRECTORY-DESIGNATOR DIRECTORY-DESIGNATOR) + ;; Use a function to return the translation + (DRIECTORY-DESIGNATOR :function TRANSLATION-FUNCTION) DIRECTORY-DESIGNATOR := ABSOLUTE-COMPONENT-DESIGNATOR | @@ -1989,6 +1991,13 @@ RELATIVE-COMPONENT-DESIGNATOR := :CURRENT-DIRECTORY | ;; all components of the current directory, without the :absolute :UID | ;; current UID -- not available on Windows :USER ;; current USER name -- NOT IMPLEMENTED(!) + +TRANSLATION-FUNCTION := + SYMBOL | ;; symbol of a function that takes two arguments, the matching DIRECTORY-DESIGNATOR + ;; and the pathname to be translated. + LAMBDA ;; A form which evals to a function taking two arguments, the matching + DIRECTORY-DESGINATOR and the pathname to be translated. + @end verbatim Relative components better be either relative @@ -2135,10 +2144,9 @@ The specified functions are exported from package ASDF. where to look for systems not yet defined. @end defun -@defun ensure-output-translations PARAMETER - checks whether output translations have been initialized. - If not, initialize them with the given @var{PARAMETER}. - This function will be called before any attempt to operate on a system. +@defun ensure-output-translations + checks whether output translations have been initialized. This + function will be called before any attempt to operate on a system. @end defun @defun apply-output-translations PATHNAME diff --git a/test/run-tests.sh b/test/run-tests.sh index 6313913..da2ba68 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -153,7 +153,7 @@ case "$lisp" in eval="-eval" ;; abcl) command="${ABCL:-abcl}" - flags="--noinit" + flags="--noinit --noinform" eval="--eval" ;; *) echo "Unsupported lisp: $1" >&2