diff --git a/component.lisp b/component.lisp index 33578ab2e2b66494e7f0430074b56dd5e4a84f48..b2588433c905454d6c44c00b713ef5a78602aa49 100644 --- a/component.lisp +++ b/component.lisp @@ -36,7 +36,7 @@ #:name #:version #:description #:long-description #:author #:maintainer #:licence #:components-by-name #:components #:children #:children-by-name #:default-component-class - #:author #:maintainer #:licence #:source-file #:defsystem-depends-on + #:author #:maintainer #:licence #:source-file #:sideway-dependencies #:if-feature #:in-order-to #:inline-methods #:relative-pathname #:absolute-pathname #:operation-times #:around-compile #:%encoding #:properties #:component-properties #:parent)) diff --git a/interface.lisp b/interface.lisp index b92a120260d5ff824e2f78513c006e22ba8c1f02..2468aabf1efc626f01afb14e93e610172e2ab098 100644 --- a/interface.lisp +++ b/interface.lisp @@ -94,6 +94,9 @@ #:system-long-name #:system-source-control #:map-systems + #:system-defsystem-depends-on + #:system-depends-on + #:system-weakly-depends-on #:*system-definition-search-functions* ; variables #:*central-registry* diff --git a/parse-defsystem.lisp b/parse-defsystem.lisp index 129bc55859df22440980626e5d7eb0fafbc6e0ea..403067156d3ac2763b7507d1456f8527fc26fc22 100644 --- a/parse-defsystem.lisp +++ b/parse-defsystem.lisp @@ -8,6 +8,7 @@ :asdf/component :asdf/system :asdf/cache :asdf/find-system :asdf/find-component :asdf/lisp-action :asdf/operate :asdf/backward-internals) + (:import-from :asdf/system #:depends-on #:weakly-depends-on) (:export #:defsystem #:register-system-definition #:class-for-type #:*default-component-class* @@ -169,6 +170,10 @@ (apply 'reinitialize-instance component args) (setf component (apply 'make-instance class args))) (component-pathname component) ; eagerly compute the absolute pathname + ;; cache information for introspection + (when (typep component 'system) + (setf (slot-value component 'depends-on) depends-on + (slot-value component 'weakly-depends-on) weakly-depends-on)) (let ((sysfile (system-source-file (component-system component)))) ;; requires the previous (when (and (typep component 'system) (not bspp)) (setf (builtin-system-p component) (lisp-implementation-pathname-p sysfile))) diff --git a/system.lisp b/system.lisp index 02eab6bbbe45f28e67fe10d292cfe710c344f17c..5e9931e116b94fb4cba41f45007370449b856ecc 100644 --- a/system.lisp +++ b/system.lisp @@ -2,7 +2,7 @@ ;;;; Systems (uiop/package:define-package :asdf/system - (:recycle :asdf :asdf/system) + (:recycle :asdf :asdf/system :asdf/component) (:use :uiop/common-lisp :uiop :asdf/upgrade :asdf/component) (:export #:system #:proto-system @@ -10,7 +10,7 @@ #:reset-system #:system-description #:system-long-description #:system-author #:system-maintainer #:system-licence #:system-license - #:system-defsystem-depends-on + #:system-defsystem-depends-on #:system-depends-on #:system-weakly-depends-on #:component-build-pathname #:build-pathname #:component-entry-point #:entry-point #:homepage #:system-homepage @@ -62,7 +62,11 @@ (entry-point :initform nil :initarg :entry-point :accessor component-entry-point) (source-file :initform nil :initarg :source-file :accessor system-source-file) - (defsystem-depends-on :reader system-defsystem-depends-on :initarg :defsystem-depends-on))) + (defsystem-depends-on :reader system-defsystem-depends-on :initarg :defsystem-depends-on + :initform nil) + (depends-on :reader system-depends-on :initform nil) + (weakly-depends-on :reader system-weakly-depends-on :initform nil) + )) (defun reset-system (system &rest keys &key &allow-other-keys) (change-class (change-class system 'proto-system) 'system) diff --git a/test/test-cache-for-introspection.script b/test/test-cache-for-introspection.script new file mode 100644 index 0000000000000000000000000000000000000000..54bcc66506f6be10efd21444134c9ee640da96e9 --- /dev/null +++ b/test/test-cache-for-introspection.script @@ -0,0 +1,39 @@ +;;; -*- Lisp -*- + +;;;--------------------------------------------------------------------------- +;;; Test to see that we are correctly caching information about system +;;; definitions +;;;--------------------------------------------------------------------------- +(def-test-system test-weakly-depends-on + :weakly-depends-on (file3-only) + :components ((:file "file1"))) + +(def-test-system test-no-weakly-depends-on + :components ((:file "file1"))) + +(def-test-system :versioned-system-3 + :defsystem-depends-on ((:version :test-asdf/2 "2.1")) + :pathname #.*test-directory* + :version "1.2") + +(def-test-system :test-concatenate-source + :depends-on (:file3-only) + :components + ((:file "file2" :depends-on ("foo")) + (:module "foo" :pathname "" + :components ((:file "file1") + (:file "file4" :if-feature (:not :common-lisp)))))) + + + +(DBG "The weakly-depends-on information is properly cached") +(assert (equal '(file3-only) (system-weakly-depends-on (find-system "test-weakly-depends-on")))) +(assert (null (system-weakly-depends-on (find-system "test-no-weakly-depends-on")))) + +(DBG "The depends-on information is properly cached") +(assert (null (system-depends-on (find-system "test-no-weakly-depends-on")))) +(assert (equalp '(:file3-only) (system-depends-on (find-system "test-concatenate-source")))) + +(DBG "The defsystem-depends-on information is properly cached") +(assert (null (system-defsystem-depends-on (find-system "test-no-weakly-depends-on")))) +(assert (equalp '((:version :test-asdf/2 "2.1")) (system-defsystem-depends-on (find-system :versioned-system-3)))) \ No newline at end of file diff --git a/test/test-utilities.script b/test/test-utilities.script index 79115d3712fbb6df9915da6fac5d6fbeeb643241..b46145fbef18909f77d5b2ecc5cb9d8e39d0ad5d 100644 --- a/test/test-utilities.script +++ b/test/test-utilities.script @@ -93,7 +93,6 @@ asdf/component:components asdf/component:components-by-name asdf/component:default-component-class - asdf/component:defsystem-depends-on asdf/component:description asdf/component:%encoding asdf/component:if-feature @@ -124,6 +123,9 @@ asdf/plan:visiting-action-list asdf/system:bug-tracker asdf/system:build-pathname + asdf/system:system-defsystem-depends-on + asdf/system:system-depends-on + asdf/system:system-weakly-depends-on asdf/system:entry-point asdf/system:homepage asdf/system:long-name