From 6f9f128d2d26197e65471cf34abafc32c8c9ba1f Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tunes@google.com>
Date: Sun, 20 Nov 2011 14:41:09 -0500
Subject: [PATCH] 1.104: add support for :around-compile

---
 asdf-classes.lisp          | 13 +++++++++++++
 asdf-dependency-grovel.asd | 36 ++++++++++++++++++++++--------------
 asdf-ops.lisp              |  1 -
 package.lisp               |  4 ++--
 4 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/asdf-classes.lisp b/asdf-classes.lisp
index cf42e76..d0e2fa4 100644
--- a/asdf-classes.lisp
+++ b/asdf-classes.lisp
@@ -26,10 +26,23 @@
   ()
   (:default-initargs :default-component-class 'instrumented-cl-source-file))
 
+(defun escaped-around-compile-hook (component)
+  (let ((around-compile (asdf::around-compile-hook component)))
+    (etypecase around-compile
+      ((or null string) around-compile)
+      (function (error "Can't convert around-compile hook ~S because it's a function object.~%Maybe you should use a lambda-expression instead?"
+                       around-compile))
+      ((or symbol cons)
+       (with-standard-io-syntax
+         (let ((*package* (find-package :cl)))
+           (write-to-string around-compile :readably t)))))))
+
 (defmethod additional-initargs :around ((comp instrumented-component))
   (flet ((slot-when-bound (slot-name initarg)
            (when (slot-boundp comp slot-name)
              `(,initarg ,(slot-value comp slot-name)))))
     `(,@(call-next-method)
+        ,@(when (asdf::around-compile-hook comp)
+            `(:around-compile (escaped-around-compile comp)))
         ,@(slot-when-bound 'translated-name :translated-name)
         ,@(slot-when-bound 'translated-pathname :translated-pathname-form))))
diff --git a/asdf-dependency-grovel.asd b/asdf-dependency-grovel.asd
index bc03b9d..bb451ff 100644
--- a/asdf-dependency-grovel.asd
+++ b/asdf-dependency-grovel.asd
@@ -2,7 +2,7 @@
 
 (cl:in-package :asdf)
 
-(unless (or #+asdf2 (asdf:version-satisfies (asdf:asdf-version) "2.014.8"))
+(unless (or #+asdf2 (version-satisfies (asdf-version) "2.014.8"))
   (error "Not only is your ASDF version is too old for ASDF-DEPENDENCY-GROVEL,
 	you must upgrade it *before* you try to load any system."))
 
@@ -10,18 +10,18 @@
      ((%components :accessor %handler-components)))
 
 (defun handler-input-file-list (pathname parent)
-  (map 'list
-       (lambda (f)
-         (make-instance 'cl-source-file
-            :name (pathname-name f)
-            :parent parent
-            :pathname f))
-       (sort (directory (make-pathname :defaults pathname
-                                       :name :wild
-                                       :type "lisp"
-                                       :version :newest))
-             #'string<
-             :key #'namestring)))
+  (mapcar
+   (lambda (f)
+     (make-instance 'cl-source-file
+                    :name (pathname-name f)
+                    :parent parent
+                    :pathname f))
+   (sort (directory (make-pathname :defaults pathname
+                                   :name :wild
+                                   :type "lisp"
+                                   :version :newest))
+         #'string<
+         :key #'namestring)))
 
 (defmethod module-components ((c grovel-handlers))
   (if (slot-boundp c '%components)
@@ -30,7 +30,15 @@
             (handler-input-file-list (component-pathname c) c))))
 
 (defsystem :asdf-dependency-grovel
-  :depends-on ((:version :asdf "2.017"))
+  :description "Analyse the dependencies in an ASDF system"
+  :long-description "ASDF-DEPENDENCY-GROVEL will analyse the actual dependencies in an ASDF system.
+Based on an analysis with file granularity ,
+it can output an optimized system definition,
+based on which compilation can be parallelized.
+Based on an analysis with form granularity,
+it can output a summary from which you can untangle
+the circularities in your build."
+  :depends-on ((:version :asdf "2.018.12")) ;; for full :around-compile support
   :components ((:file "package")
                (:file "variables" :depends-on ("package"))
                (:file "classes" :depends-on ("package" "variables"))
diff --git a/asdf-ops.lisp b/asdf-ops.lisp
index 27a4d11..6ab907b 100644
--- a/asdf-ops.lisp
+++ b/asdf-ops.lisp
@@ -12,7 +12,6 @@ to the base of the system."
                                               (pathname-directory system-base-dir)
                                               :test #'equal)
                                     (length (pathname-directory output-file))))))
-    
     (list
      (if (or *current-constituent*
              (and (boundp '*old-macroexpand-hook*) *old-macroexpand-hook*))
diff --git a/package.lisp b/package.lisp
index a697623..760af86 100644
--- a/package.lisp
+++ b/package.lisp
@@ -31,8 +31,8 @@
 
 (in-package #:asdf-dependency-grovel)
 
-(defparameter *asdf-dependency-grovel-version* "1.103")
-(defparameter *asdf-version-required-by-adg* "2.008")
+(defparameter *asdf-dependency-grovel-version* "1.104")
+(defparameter *asdf-version-required-by-adg* "2.018.12")
 
 #-asdf2
 (error "ASDF-DEPENDENCY-GROVEL requires ASDF2.")
-- 
GitLab