On Wed, Mar 12, 2014 at 2:52 PM, Robert P. Goldman <rpgold...@sift.info> wrote:
> Faré wrote:
>> While we are bikeshedding, I feel that asdf:load-system is (1) still
>> too long a name, and (2) not generic enough, in case I want to use
>> ASDF for stuff that isn't loading code into the current image.
>> Therefore I propose there be
>>
>> (asdf:build 'foo)
>>
>> as the shorthand for the new (as of ASDF3) operation build-op:
>>
>> (defun build (system)
>>   (operate 'build-op system))
>>
>> Shorter to type, more generic, and if we commit that before 3.1.1,
>> available under the #+asdf3.1 feature.
>>
>> —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• 
>> http://fare.tunes.org
>> Your conscience never stops you from doing anything.  It just stops you
>> from enjoying it.
>>
>
> I'm OK with doing this, but
>
> (1) BUILD-OP needs a docstring explaining its semantics.  I thought it
> was just a wrapper around whatever the system definer chooses as the
> default action.
>
> and
>
> (2) It needs to appear in the manual.
>
> I'm willing to support these -- even take responsibility for (2) -- if
> you will do (1).
>
OK. Please apply patch attached.

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Historically, applied communism is feudalism without honor.
From 7d12d0858bfa9cd9f93b81e2a9c6e31d204e528a Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tu...@google.com>
Date: Wed, 12 Mar 2014 15:22:08 -0400
Subject: [PATCH] Document the BUILD-OP operation as the new default, push
 (ASDF:BUILD :FOO) as the new recommended way to interact with ASDF 3.1.

---
 action.lisp    | 15 +--------------
 interface.lisp |  2 +-
 operate.lisp   | 28 +++++++++++++++++++++++-----
 3 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/action.lisp b/action.lisp
index 59810e7..93da2ee 100644
--- a/action.lisp
+++ b/action.lisp
@@ -18,7 +18,6 @@
    #:traverse-actions #:traverse-sub-actions #:required-components ;; in plan
    #:action-path #:find-action #:stamp #:done-p
    #:operation-definition-warning #:operation-definition-error ;; condition
-   #:build-op ;; THE generic operation
    ))
 (in-package :asdf/action)
 
@@ -57,6 +56,7 @@
            (component 'component)
            (opix (position operation formals))
            (coix (position component formals))
+
            (prefix (subseq formals 0 opix))
            (suffix (subseq formals (1+ coix) len))
            (more-args (when keyp `(&rest ,rest &key &allow-other-keys))))
@@ -222,7 +222,6 @@ dependencies.")))
     (:documentation "Error condition related to definition of incorrect OPERATION objects."))
 
   (defmethod initialize-instance :before ((o operation) &key)
-    ;; build-op is a special case.
     (unless (typep o '(or downward-operation upward-operation sideway-operation
                           selfward-operation non-propagating-operation))
       (warn 'operation-definition-warning
@@ -399,15 +398,3 @@ in some previous image, or T if it needs to be done.")
                     (action-description operation component)))
           (mark-operation-done operation component)
           (return))))))
-
-;;; Generic build operation
-(with-upgradability ()
-  ;; BUILD-OP was intended to be the default "master" operation to invoke on a system in ASDF3
-  ;; (LOAD-OP typically serves that function now).
-  ;; This feature has not yet been fully implemented yet, and is not used by anyone yet.
-  ;; This is a path forward, and its default below is to backward compatibly depend on LOAD-OP.
-  ;; [2014/01/26:rpg]
-  (defclass build-op (non-propagating-operation) ())
-  (defmethod component-depends-on ((o build-op) (c component))
-    `((,(or (component-build-operation c) 'load-op) ,c))))
-
diff --git a/interface.lisp b/interface.lisp
index 70b9eeb..98078a6 100644
--- a/interface.lisp
+++ b/interface.lisp
@@ -27,7 +27,7 @@
    #:operation #:make-operation #:find-operation
    #:upward-operation #:downward-operation #:sideway-operation #:selfward-operation
                       #:non-propagating-operation
-   #:build-system #:build-op
+   #:build-op #:build #:build-system
    #:load-op #:prepare-op #:compile-op
    #:prepare-source-op #:load-source-op #:test-op
    #:feature #:version #:version-satisfies #:upgrade-asdf
diff --git a/operate.lisp b/operate.lisp
index 79ac3f8..1fc00a5 100644
--- a/operate.lisp
+++ b/operate.lisp
@@ -9,7 +9,7 @@
   (:export
    #:operate #:oos
    #:*systems-being-operated*
-   #:build-system
+   #:build-op #:build #:build-system
    #:load-system #:load-systems #:load-systems*
    #:compile-system #:test-system #:require-system
    #:*load-system-operation* #:module-provide-asdf
@@ -106,17 +106,35 @@ The :FORCE or :FORCE-NOT argument to OPERATE can be:
 (with-upgradability ()
   (defvar *load-system-operation* 'load-op
     "Operation used by ASDF:LOAD-SYSTEM. By default, ASDF:LOAD-OP.
-You may override it with e.g. ASDF:LOAD-FASL-OP from asdf-bundle,
+You may override it with e.g. ASDF:LOAD-FASL-OP from asdf-bundle (recommended on ECL?)
 or ASDF:LOAD-SOURCE-OP if your fasl loading is somehow broken.
 
-This may change in the future as we will implement component-based strategy
+This may change in the future if we implement component-directed strategy
 for how to load or compile stuff")
 
-  (defun build-system (system &rest keys)
-    "Shorthand for `(operate 'asdf:build-op system)`."
+  (defclass build-op (non-propagating-operation) ()
+    (:documentation "Since ASDF3, BUILD-OP is the recommended 'master' operation,
+to operate by default on a system or component.
+Its meaning is configurable via the :BUILD-OPERATION option of a component,
+which is typically the name of a specific operation to which to delegate the build,
+and may be NIL, which designates the *LOAD-SYSTEM-OPERATION*
+that will load the system in the current image, and its typically LOAD-OP."))
+  (defmethod component-depends-on ((o build-op) (c component))
+    `((,(or (component-build-operation c) *load-system-operation*) ,c)))
+
+
+  (defun build (system &rest keys)
+    "The recommended way to interact with ASDF3.1 is via (ASDF:BUILD :FOO).
+It will build system FOO using the operation BUILD-OP,
+the meaning of which is configurable by the system, and
+defaults to *LOAD-SYSTEM-OPERATION*, usually LOAD-OP, to load it in current image."
     (apply 'operate 'build-op system keys)
     t)
 
+  (defun build-system (system &rest keys)
+    "Alias for function BUILD"
+    (apply 'build system keys))
+
   (defun load-system (system &rest keys &key force force-not verbose version &allow-other-keys)
     "Shorthand for `(operate 'asdf:load-op system)`. See OPERATE for details."
     (declare (ignore force force-not verbose version))
-- 
1.9.0.279.gdc9e3eb

Reply via email to