mvm@FRLRI61.BITNET (11/29/89)
(defsystem main-system (:component-systems system.1 system.2 ... system.n-1 system.n)) I would like to have some dependencies between my component systems. That is, I would like to have system.1 compiled and loaded before system.2 gets compiled etc. when doing a (make-system 'main-system :compile) and system.1 loaded before system.2 etc when doing a (make-system 'main-system). I have spent the morning trying to achieve this and failed to find a simple answer for the following reasons: - Switching the order of the component systems does not work because (make-system main-system :compile) and (make-system main-system) seem to compile and load the files of the component systems in a different order. The compilation is first done on systemn when executing (make-system 'main-system :compile) while the loading is first done on system1 when executing (make-system 'main-system). - Using a (require system.n-1) in the defsystem of system.n does not work because when doing a (make-system 'main-system :compile), system.n-1 is simply loaded and not compiled and loaded when the require is executed. - Trying to place make-system in the individual defsystems does not achieve good results because all the variables documented in the lisp reference manual in section 23.8 are always nil (i.e. sys:*top-level-transformations* is nil while it should be, according to the documentation, bound to the list of transformation type that are to be processed. Note that I even tried to bind my own system-special-variable using sys:define-make-system-variable but unfortunately failed to access the value of the &rest argument keywords to make-system. I supposed it was compiled away and even trying to recuparate its value with (eh:rest-arg-value current-stack-group (eh:sg-inhermost-frame current-stack-group)) to set the value of this special variable failed. The only way I managed to achieve this behavior was to define depencies such as : (defsystem system.n (:module main) (:compile-load-init main ((system.n-1 module1) (system.n-1 module2) .... (system.1 module1) (system.1 module2) ...)) (:fasload (system.n-1 module1) (system.n-1 module2) etc.... Note that is a real pain, because you have to list all the submodules of the all the individual systems and maintain that list updated when adding new modules to the individual subsystems. Thus it would be nice if either: - defsystem would execute (and finish executing) transformations on the component systems in a consistent order (may I suggest left to right?...) - the (require system.x) function would perform the same transformation as the main call to make-system when system.x is not in *modules* - the system maintained variables documented in section 23.6 would be bound to what they should (bug fix) - one could specify the name of a system as a dependency which would result in having the system made with the same transformations as the current call to make-system constraints : I want this to work under release 5. Does anyone have a suggestion (did I miss something in the doc?) or a patch?
saraiya@SUMEX-AIM.STANFORD.EDU (Nakul P. Saraiya) (11/30/89)
I hacked up something similar for Symbolics Release 6 a long while back. This version does not compile subsystems---just loads them---but it should be easy to change do-system-dependencies to use the value of *make-system-keywords* to also compile the subsystems if need be. You may also want to common-lispify the code... nakul ;;; -*- Syntax: Zetalisp; Base: 10; Mode: LISP; Package: SYSTEM-INTERNALS -*- ;;; Modifications to DEFSYSTEM/MAKE-SYSTEM to allow for other systems ;;; that a given system expects to have loaded into the world band ;;; before being loaded or compiled. ;;; Usage: (defsystem foo ... (:depends-on bar baz bax) ...) (defmacro (:depends-on defsystem-macro) (&rest systems) (let ((system-names (loop for system in systems collect (string system))) (*add-transformation-to-system* T)) (putprop (locf (system-plist *system-being-defined*)) system-names :depends-on) (parse-transformation :depends-on nil nil 'true)) nil) (defmacro system-depends-on (system) `(get (locf (system-plist ,system)) ':depends-on)) (add-simple-transformation ':depends-on 'Do-System-Dependencies nil nil '("Make support systems" "Making support systems" "support systems made") T T) (defun do-system-dependencies () (loop for name in (system-depends-on *system-being-made*) do ;; or (apply #'make-system name *make-system-keywords*) (make-system name :silent :nowarn :noconfirm)))