[asdf-devel] Re: Mistake (?) in grammar of defsystem

Faré fare at tunes.org
Sat Feb 22 23:14:05 UTC 2014

Here's an improved diff, that keeps and properly documents the
(:feature <feature-expression> <dependency-def>) dependency-def, and
eliminates the (feature <feature-expression>) requirement (using names
from the grammar).

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
The secret of survival is: Always expect the unexpected. — Dr. Who
-------------- next part --------------
diff --git a/action.lisp b/action.lisp
index 431dc6c..59810e7 100644
--- a/action.lisp
+++ b/action.lisp
@@ -122,12 +122,6 @@ You can put together sentences using this phrase."))
         a component name or a component object.  Also note that, the degenerate
         case of (<operation>) is a no-op.]
-      or
-      (FEATURE <feature>), which means that the component depends
-        on the <feature> expression satisfying FEATUREP.
-        (This is DEPRECATED -- use :IF-FEATURE instead.)
     Methods specialized on subclasses of existing component types
     should usually append the results of CALL-NEXT-METHOD to the list."))
   (define-convenience-action-methods component-depends-on (operation component))
diff --git a/backward-internals.lisp b/backward-internals.lisp
index 17070e3..b907b54 100644
--- a/backward-internals.lisp
+++ b/backward-internals.lisp
@@ -9,7 +9,6 @@
   (:export ;; for internal use
    #:load-sysdef #:make-temporary-package
-   #:%resolve-if-component-dep-fails
    #:load-sysdef #:make-temporary-package))
 (in-package :asdf/backward-internals)
@@ -49,27 +48,6 @@
     (%remove-component-inline-methods component)
     (%define-component-inline-methods component rest)))
-;;;; PARTIAL SUPPORT ONLY for the :if-component-dep-fails component attribute
-;; and the companion asdf:feature pseudo-dependency.
-;; This won't recurse into dependencies to accumulate feature conditions.
-;; Therefore it will accept the SB-ROTATE-BYTE of an old SBCL
-;; (older than but won't suffice to load an old nibbles.
-(with-upgradability ()
-  (defun %resolve-if-component-dep-fails (if-component-dep-fails component)
-    (asdf-message "The system definition for ~S uses deprecated ~
-                  ASDF option :IF-COMPONENT-DEP-FAILS. ~
-                  Starting with ASDF 3, please use :IF-FEATURE instead"
-                  (coerce-name (component-system component)))
-    ;; This only supports the pattern of use of the "feature" seen in the wild
-    (check-type component parent-component)
-    (check-type if-component-dep-fails (member :fail :ignore :try-next))
-    (unless (eq if-component-dep-fails :fail)
-      (loop :with o = (make-operation 'compile-op)
-            :for c :in (component-children component) :do
-              (loop* :for (feature? feature) :in (component-depends-on o c)
-                     :when (eq feature? 'feature) :do
-                     (setf (component-if-feature c) feature))))))
 (when-upgrading (:when (fboundp 'make-sub-operation))
   (defun make-sub-operation (c o dep-c dep-o)
     (declare (ignore c o dep-c dep-o)) (asdf-upgrade-error)))
diff --git a/doc/asdf.texinfo b/doc/asdf.texinfo
index 0f66a0c..1ab37d9 100644
--- a/doc/asdf.texinfo
+++ b/doc/asdf.texinfo
@@ -999,14 +999,13 @@ other-component-type := symbol-by-name (@pxref{The defsystem grammar,,Component
 # This is used in :depends-on, as opposed to ``dependency,''
 # which is used in :in-order-to
 dependency-def := simple-component-name
-               | (feature @var{feature-name})
-               | ( :version simple-component-name version-specifier)
+               | ( :feature @var{feature-expression} dependency-def )
+               | ( :version simple-component-name version-specifier )
 # ``dependency'' is used in :in-order-to, as opposed to
 # ``dependency-def''
 dependency := (dependent-op @var{requirement}+)
 requirement := (required-op @var{required-component}+)
-             | (:feature @var{feature-name})
 dependent-op := operation-name
 required-op := operation-name
@@ -1352,6 +1351,13 @@ Its semantics was limited in purpose and dubious to explain,
 and its implementation was breaking a hole into the ASDF object model.
 Please use the @code{if-feature} option instead.
+ at subsection feature requirement
+This requirement was removed in ASDF 3.1.
+It used to ensure a chain of component dependencies will raise an error,
+which in conjunction with if-component-dep-fails would offer
+a roundabout way to express conditional compilation.
 @node Other code in .asd files, The package-system extension, The defsystem grammar, Defining systems with defsystem
 @section Other code in .asd files
diff --git a/operation.lisp b/operation.lisp
index 0c6dbb2..9521bcc 100644
--- a/operation.lisp
+++ b/operation.lisp
@@ -7,7 +7,8 @@
    #:operation-original-initargs #:original-initargs ;; backward-compatibility only. DO NOT USE.
-   #:*operations* #:make-operation #:find-operation #:feature))
+   #:*operations* #:make-operation #:find-operation
+   #:feature)) ;; TODO: stop exporting the deprecated FEATURE feature.
 (in-package :asdf/operation)
 ;;; Operation Classes
@@ -49,9 +50,7 @@
   (defmethod find-operation ((context t) (spec operation))
   (defmethod find-operation (context (spec symbol))
-    (unless (member spec '(nil feature))
-      ;; NIL designates itself, i.e. absence of operation
-      ;; FEATURE is the ASDF1 misfeature that comes with IF-COMPONENT-DEP-FAILS
+    (when spec ;; NIL designates itself, i.e. absence of operation
       (apply 'make-operation spec (operation-original-initargs context))))
   (defmethod operation-original-initargs ((context symbol))
     (declare (ignorable context))
diff --git a/parse-defsystem.lisp b/parse-defsystem.lisp
index 80c1141..a6f3d45 100644
--- a/parse-defsystem.lisp
+++ b/parse-defsystem.lisp
@@ -202,7 +202,10 @@
         (setf (component-sideway-dependencies component) depends-on)
         (%refresh-component-inline-methods component rest)
         (when if-component-dep-fails
-          (%resolve-if-component-dep-fails if-component-dep-fails component))
+          (error "The system definition for ~S uses deprecated ~
+            ASDF option :IF-COMPONENT-DEP-FAILS. ~
+            Starting with ASDF 3, please use :IF-FEATURE instead"
+           (coerce-name (component-system component))))
   (defun register-system-definition
diff --git a/test/test-asdf.asd b/test/test-asdf.asd
index fd99fc0..e07861d 100644
--- a/test/test-asdf.asd
+++ b/test/test-asdf.asd
@@ -45,11 +45,8 @@
      (:module "file3mod"
       :pathname ""
-      ((:file "file3"
-        :in-order-to ((compile-op (feature :common-lisp))))
-       (:file "does-not-exist"
-        :in-order-to ((compile-op (feature (:not :common-lisp))))))
-      :if-component-dep-fails :ignore)))))
+      ((:file "file3" :if-feature :common-lisp)
+       (:file "does-not-exist" :if-feature (:not :common-lisp))))))))
 (defsystem :test-asdf/test9-2

More information about the asdf-devel mailing list