diff --git a/asdf.asd b/asdf.asd index 2eb39f4887d2811fc01ba92874f94871d453bef6..2411d6884a5314705b9dde55ec221f02b11c162f 100644 --- a/asdf.asd +++ b/asdf.asd @@ -12,7 +12,7 @@ :licence "MIT" :description "Another System Definition Facility" :long-description "ASDF builds Common Lisp software organized into defined systems." - :version "2.014.13" ;; to be automatically updated by bin/bump-revision + :version "2.014.14" ;; to be automatically updated by bin/bump-revision :depends-on () :components ((:file "asdf") diff --git a/asdf.lisp b/asdf.lisp index 5a86c1b16a52fba5662be9867b7c01557e428e3f..7502a74c91f26b5f896e49f06a2a388daabeb07f 100755 --- a/asdf.lisp +++ b/asdf.lisp @@ -1,5 +1,5 @@ ;; -*- mode: common-lisp; Base: 10 ; Syntax: ANSI-Common-Lisp -*- -;;; This is ASDF 2.014.13: Another System Definition Facility. +;;; This is ASDF 2.014.14: Another System Definition Facility. ;;; ;;; Feedback, bug reports, and patches are all welcome: ;;; please mail to <asdf-devel@common-lisp.net>. @@ -68,26 +68,27 @@ (in-package :asdf) -;;; Strip out formating that is not supported on Genera. -(defmacro compatfmt (format) - #-genera format - #+genera - (let ((r '(("~@<" . "") - ("; ~@;" . "; ") - ("~3i~_" . "") - ("~@:>" . "") - ("~:>" . "")))) - (dolist (i r) - (loop :for found = (search (car i) format) :while found :do - (setf format (concatenate 'simple-string (subseq format 0 found) - (cdr i) - (subseq format (+ found (length (car i)))))))) - format)) - ;;;; Create packages in a way that is compatible with hot-upgrade. ;;;; See https://bugs.launchpad.net/asdf/+bug/485687 ;;;; See more near the end of the file. +;;; Strip out formatting that is not supported on Genera. +(defmacro compatfmt (format) + #-genera format + #+genera + (loop :for (unsupported . replacement) :in + '(("~@<" . "") + ("; ~@;" . "; ") + ("~3i~_" . "") + ("~@:>" . "") + ("~:>" . "")) :do + (loop :for found = (search unsupported format) :while found :do + (setf format + (concatenate 'simple-string + (subseq format 0 found) replacement + (subseq format (+ found (length unsupported))))))) + format) + (eval-when (:load-toplevel :compile-toplevel :execute) (defvar *asdf-version* nil) (defvar *upgraded-p* nil) @@ -100,7 +101,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.014.13") + (asdf-version "2.014.14") (existing-asdf (fboundp 'find-system)) (existing-version *asdf-version*) (already-there (equal asdf-version existing-version))) @@ -236,12 +237,14 @@ #:version ; metaphorically sort-of an operation #:version-satisfies #:upgrade-asdf + #:implementation-identifier #:implementation-type #:input-files #:output-files #:output-file #:perform ; operation methods #:operation-done-p #:explain #:component #:source-file #:c-source-file #:cl-source-file #:java-source-file + #:cl-source-file.cl #:cl-source-file.lisp #:static-file #:doc-file #:html-file @@ -1568,6 +1571,10 @@ Going forward, we recommend new users should be using the source-registry. (defclass cl-source-file (source-file) ((type :initform "lisp"))) +(defclass cl-source-file.cl (cl-source-file) + ((type :initform "cl"))) +(defclass cl-source-file.lsp (cl-source-file) + ((type :initform "lsp"))) (defclass c-source-file (source-file) ((type :initform "c"))) (defclass java-source-file (source-file) @@ -2338,8 +2345,8 @@ recursive calls to traverse.") (error 'missing-component-of-version :requires system :version version)) (let ((steps (traverse op system))) (when (and (not (equal '("asdf") (component-find-path system))) - (find-if (lambda (x) (equal '("asdf") - (component-find-path (cdr x)))) + (find-if #'(lambda (x) (equal '("asdf") + (component-find-path (cdr x)))) steps) (upgrade-asdf)) ;; If we needed to upgrade ASDF to achieve our goal, diff --git a/doc/asdf.texinfo b/doc/asdf.texinfo index 49691f46d86805b127ea9a0ab099a0f69b89e802..ff7636d6e0d7bbee0d1ce3e430407a154594712a 100644 --- a/doc/asdf.texinfo +++ b/doc/asdf.texinfo @@ -171,9 +171,15 @@ the ASDF internals and how to extend ASDF. @emph{Nota Bene}: We have released ASDF 2.000 on May 31st 2010. -It hopefully will have been it included -in all CL maintained implementations shortly afterwards. +Subsequent releases of ASDF 2 have since then been included +in all actively maintained CL implementations that bundle ASDF, +and made to work with all actively used CL implementations and a few more. @xref{FAQ,,``What has changed between ASDF 1 and ASDF 2?''}. +Furthermore, it is possible to upgrade from ASDF 1 to ASDF 2 on the fly. +For this reason, we have stopped supporting ASDF 1; +if you are using ASDF 1 and are experiencing any kind of issues or limitations, +we recommend you upgrade to ASDF 2 +--- and we explain how to do it. @xref{Loading ASDF}. @node Loading ASDF, Configuring ASDF, Introduction, Top @@ -311,7 +317,7 @@ that depends on a more recent version of ASDF, since the new one might shadow the old one while the old one is running, and the running old one will be confused when extensions are loaded into the new one. -We recommend that your systems should @emph{not} specify +In the meantime, we recommend that your systems should @emph{not} specify @code{:depends-on (:asdf)}, or @code{:depends-on ((:version :asdf "2.010"))}, but instead that they check that a recent enough ASDF is installed, with such code as: @@ -1721,18 +1727,16 @@ We create a subclass of ()) @end lisp -A hypothetical function @code{system-dependent-dirname} +Function @code{asdf:implementation-type} (exported since 2.014.14) gives us the name of the subdirectory. All that's left is to define how to calculate the pathname of an @code{unportable-cl-source-file}. @lisp (defmethod component-pathname ((component unportable-cl-source-file)) - (let ((pathname (call-next-method)) - (name (string-downcase (system-dependent-dirname)))) - (merge-pathnames* - (make-pathname :directory (list :relative name)) - pathname))) + (merge-pathnames* + (coerce-pathname (format nil "~(~A~)/" (asdf:implementation-type))) + (call-next-method))) @end lisp The new component type is used in a @code{defsystem} form in this way: @@ -2740,7 +2744,8 @@ useful for system definition and development. These include: @defun coerce-pathname name @&key type defaults -This function takes an argument, and portably interprets it as a pathname. +This function (available starting with ASDF 2.012.11) +takes an argument, and portably interprets it as a pathname. If the argument @var{name} is a pathname or @code{nil}, it is passed through; if it's a symbol, it's interpreted as a string by downcasing it; if it's a string, it is first separated using @code{/} into substrings; @@ -3159,8 +3164,8 @@ and you would @code{(defmethod source-file-type ((component cl-source-file) (system (eql (find-system 'foo)))) (declare (ignorable component system)) "cl")}. Now, the pathname for a component is eagerly computed when defining the system, -and instead you will @code{(defclass my-cl-source-file (cl-source-file) ((type :initform "cl")))} -and use @code{:default-component-class my-cl-source-file} as argument to @code{defsystem}, +and instead you will @code{(defclass cl-source-file.lis (cl-source-file) ((type :initform "lis")))} +and use @code{:default-component-class cl-source-file.lis} as argument to @code{defsystem}, as detailed in a @pxref{FAQ,How do I create a system definition where all the source files have a .cl extension?} below. @findex source-file-type @@ -3435,35 +3440,71 @@ or as a name component plus optional dot-separated type component @subsection How do I create a system definition where all the source files have a .cl extension? -First, create a new @code{cl-source-file} subclass that provides an -initform for the @code{type} slot: +Starting with ASDF 2.014.14, you may just pass +the builtin class @code{cl-source-file.cl} as +the @code{:default-component-class} argument to @code{defsystem}: @lisp -(defclass my-cl-source-file (cl-source-file) - ((type :initform "cl"))) +(defsystem my-cl-system + :default-component-class cl-source-file.cl + ...) @end lisp -To support both ASDF 1 and ASDF 2, -you may omit the above @code{type} slot definition and instead define: +Another builtin class @code{cl-source-file.lsp} is offered +for files ending in @file{.lsp}. + +If you want to use a different extension +for which ASDF doesn't provide builtin support, +or want to support versions of ASDF +earlier than 2.014.14 (but later than 2.000), +you can define a class as follows: @lisp -(defmethod source-file-type ((f my-cl-source-file) (m module)) - (declare (ignorable f m)) - "cl") +;; Prologue: make sure we're using a sane package. +(defpackage :my-asdf-extension + (:use :asdf :common-lisp) + (:export #:cl-source-file.lis)) +(in-package :my-asdf-extension) + +(defclass cl-source-file.lis (cl-source-file) + ((type :initform "lis"))) +@end lisp + +Then you can use it as follows: +@lisp +(defsystem my-cl-system + :default-component-class my-asdf-extension:cl-source-file.lis + ...) @end lisp -Then make your system use this subclass in preference to the standard one: +Of course, if you're in the same package, e.g. in the same file, +you won't need to use the package qualifier before @code{cl-source-file.lis}. +Actually, if all you're doing is defining this class +and using it in the same file without other fancy definitions, +you might skip package complications: @lisp +(in-package :asdf) +(defclass cl-source-file.lis (cl-source-file) + ((type :initform "lis"))) (defsystem my-cl-system - :default-component-class my-cl-source-file - .... -) + :default-component-class cl-source-file.lis + ...) @end lisp -We assume that these definitions are loaded into a package that uses -@code{ASDF} --- which will be the case by default -if your @file{.asd} file doesn't specify an @code{in-package} statement. +It is possible to achieve the same effect +in a way that supports both ASDF 1 and ASDF 2, +but really, friends don't let friends use ASDF 1. +Please upgrade to ASDF 2. +In short, though: do same as above, but +@emph{before} you use the class in a @code{defsystem}, +you also define the following method: + +@lisp +(defmethod source-file-type ((f cl-source-file.lis) (m module)) + (declare (ignorable f m)) + "lis") +@end lisp @node TODO list, Inspiration, FAQ, Top