From: Martin Ginkel
Subject: Asdf and sub-systems
Date: 
Message-ID: <cgi7jq$43j$1@gwdu112.gwdg.de>
Hi,

until recently I worked with mk:defsystem to define compilation of my 
packages. I like the fresh concepts of asdf and consider to switch.
But I want to have the following feature:

(make:defsystem :bla
     :components (
		 (:module test-env
			  :initially-do (mk::find-system 'test-suite :load "test:load-test.lisp")
			  :compile-form
			  (mk::operate-on-system 'test-suite 'compile)
			  :load-form
			  (mk::operate-on-system 'test-suite 'load))
...

This construct allows to load independent system-definitions into
a larger system and have them automatically compiled
(according to dependencies).
With asdf I could not figure out how to do this.
Even if I add the global system (asdf:find-system :test-suite) to the
components of bla, It does nothing on the sub-system.

Has anyone solved this already?

	Martin

-- 
+-[Martin Ginkel]-------------[mailto:mginkel(at)mpi-magdeburg.mpg.de]-+
| MPI Magdeburg, Zi S2.09    Sandtorstr. 1, D-39106 Magdeburg, Germany |
| C makes it easy to shoot yourself in the foot.  C++ makes it harder, |
| but when you do, it blows away your whole leg.              Bjarne   |
+-[tel/fax: +49 391 6110 482/529]----[http://www.mpi-magdeburg.mpg.de]-+

From: Steven E. Harris
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <jk4eklv9nsz.fsf@W003275.na.alarismed.com>
Martin Ginkel <·············@epost.de> writes:

> (make:defsystem :bla
>     :components (
> 		 (:module test-env
> 			  :initially-do (mk::find-system 'test-suite :load "test:load-test.lisp")
> 			  :compile-form
> 			  (mk::operate-on-system 'test-suite 'compile)
> 			  :load-form
> 			  (mk::operate-on-system 'test-suite 'load))
> ...
>
> This construct allows to load independent system-definitions into
> a larger system and have them automatically compiled
> (according to dependencies).

Have you tried :depends-on (test-suite)?

You can have system bla depend on system test-suite, but I'm pretty
sure that a module within system bla (here, test-env) cannot depend on
a separate system. A module can only depend on other modules, and
files can only depend on other files or modules defined at the same
"scope".

I'm having trouble finding these restrictions explained in the ASDF
documentation, though "Getting Started with ASDF"� offers some
amplification.


Footnotes: 
� http://lecture.pentaside.org/paper/asdf-starting-out-mommer.pdf

-- 
Steven E. Harris
From: Martin Ginkel
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <cgju0b$1273$1@gwdu112.gwdg.de>
Steven E. Harris wrote:
> Have you tried :depends-on (test-suite)?
> 

Yes, but apparently this does not recompile test-suite (if needed),
whenever I request compilation of blah.
(But perhaps I was just stupid, ... will double-check this)

On the other hand I very much like to have external systems as
siblings of modules, since only one module has to be recompiled,
when the external system changes.
(Not the other 90% in of the whole system)

	But thanks for the link to the doc
	Martin


-- 
+-[Martin Ginkel]-------------[mailto:mginkel(at)mpi-magdeburg.mpg.de]-+
| MPI Magdeburg, Zi S2.09    Sandtorstr. 1, D-39106 Magdeburg, Germany |
| C makes it easy to shoot yourself in the foot.  C++ makes it harder, |
| but when you do, it blows away your whole leg.              Bjarne   |
+-[tel/fax: +49 391 6110 482/529]----[http://www.mpi-magdeburg.mpg.de]-+
From: Steven E. Harris
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <jk465754wv3.fsf@W003275.na.alarismed.com>
Martin Ginkel <·············@epost.de> writes:

> On the other hand I very much like to have external systems as
> siblings of modules, since only one module has to be recompiled,
> when the external system changes.

That would be nice, and I'm not even sure that it's not possible
today. I do agree with the design principle that one should not be
able to reach /into/ a separate encapsulated module or system to
depend upon it, but it seems that one should be able to reach /out of/
a component or module as you desire to establish a dependency on
something else.

We need someone more knowledgeable in ASDF to help us here.

-- 
Steven E. Harris
From: Marco Antoniotti
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <qOHXc.61$D5.69973@typhoon.nyu.edu>
Steven E. Harris wrote:
> Martin Ginkel <·············@epost.de> writes:
> 
> 
>>On the other hand I very much like to have external systems as
>>siblings of modules, since only one module has to be recompiled,
>>when the external system changes.
> 
> 
> That would be nice, and I'm not even sure that it's not possible
> today. I do agree with the design principle that one should not be
> able to reach /into/ a separate encapsulated module or system to
> depend upon it, but it seems that one should be able to reach /out of/
> a component or module as you desire to establish a dependency on
> something else.
> 

MK:DEFSYSTEM already has this feature.

Cheers
--
Marco
From: Martin Ginkel
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <cgmujb$iv2$1@gwdu112.gwdg.de>
Steven E. Harris wrote:
> That would be nice, and I'm not even sure that it's not possible
> today. I do agree with the design principle that one should not be
> able to reach /into/ a separate encapsulated module or system to
> depend upon it, but it seems that one should be able to reach /out of/
> a component or module as you desire to establish a dependency on
> something else.
> 
> We need someone more knowledgeable in ASDF to help us here.

Here is at least a Hack, look for :external-system

	Martin

(defun parse-component-form (parent options)
   (destructuring-bind
	(type name &rest rest &key
	      ;; the following list of keywords is reproduced below
               ;; in the
	      ;; remove-keys form.  important to keep them in sync
	      ;; components pathname default-component-class
	      ;; perform explain output-files operation-done-p
	      ;; depends-on serial in-order-to
	      ;; list ends
	      &allow-other-keys) options
     (check-component-input type name depends-on components in-order-to)
     (let* ((other-args (remove-keys
			'(components pathname default-component-class
			  perform explain output-files operation-done-p
			  depends-on serial in-order-to)
			rest))
	   (class (class-for-type parent type))
	   (ret
	    (or (find-component parent name)
		(when (eq type :external-system)
		  (find-system name t))
		(make-instance class))))
       (when (eq type :external-system)
	(return-from parse-component-form ret))
       (when (boundp '*serial-depends-on*)
	(setf depends-on
	      (concatenate 'list *serial-depends-on* depends-on)))
       (apply #'reinitialize-instance
	     ret
	     :name (coerce-name name)
	     :pathname pathname
	     :parent parent
	     other-args)
       (when (typep ret 'module)
	(setf (module-default-component-class ret)
	      (or default-component-class
		  (and (typep parent 'module)
		       (module-default-component-class parent))))
	(let ((*serial-depends-on* nil))
	  (setf (module-components ret)
		(loop for c-form in components
		      for c = (parse-component-form ret c-form)
		      collect c
		      if serial
		      do (push (component-name c) *serial-depends-on*)))))

       (setf (slot-value ret 'in-order-to)
	    (union-of-dependencies
	     in-order-to
	     `((compile-op (compile-op ,@depends-on))
	       (load-op (load-op ,@depends-on))))
	    (slot-value ret 'do-first) `((compile-op (load-op ,@depends-on))))

       (loop for (n v) in `((perform ,perform) (explain ,explain)
			   (output-files ,output-files)
			   (operation-done-p ,operation-done-p))
	    do (map 'nil
		    ;; this is inefficient as most of the stored
		    ;; methods will not be for this particular gf n
		    ;; But this is hardly performance-critical
		    (lambda (m) (remove-method (symbol-function n) m))
		    (component-inline-methods ret))
	    when v
	  do (destructuring-bind (op qual (o c) &body body) v
	       #|
	       (when (and (listp qual)
			  (not (null qual)))
		 (destructuring-bind (op1 (o1 c1) &body body1) v
		   (setf op   op1
			 o    o1
			 c    c1
			 body body1)
		   )
		   )
		   |#
		 (pushnew
		  (eval `(defmethod ,n ,@(when qual `(,qual)) ((,o ,op) (,c (eql ,ret)))
			  ,@body))
		  (component-inline-methods ret))))
       ret)))


-- 
+-[Martin Ginkel]-------------[mailto:mginkel(at)mpi-magdeburg.mpg.de]-+
| MPI Magdeburg, Zi S2.09    Sandtorstr. 1, D-39106 Magdeburg, Germany |
| You shouldn't anthropomorphize computers; they don't like it.        |
|                                                                      |
+-[tel/fax: +49 391 6110 482/529]----[http://www.mpi-magdeburg.mpg.de]-+
From: Christophe Rhodes
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <sqhdqrxmx9.fsf@cam.ac.uk>
Martin Ginkel <·············@epost.de> writes:

> Even if I add the global system (asdf:find-system :test-suite) to the
> components of bla, It does nothing on the sub-system.
>
> Has anyone solved this already?

(defsystem bla
  :depends-on (test-suite))
?

Maybe I'm not understanding your question right.

Christophe
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)
From: Marco Antoniotti
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <g77Xc.54$D5.69562@typhoon.nyu.edu>
Martin Ginkel wrote:
> Hi,
> 
> until recently I worked with mk:defsystem to define compilation of my 
> packages. I like the fresh concepts of asdf and consider to switch.
> But I want to have the following feature:
> 
> (make:defsystem :bla
>     :components (
>          (:module test-env
>               :initially-do (mk::find-system 'test-suite :load 
> "test:load-test.lisp")
>               :compile-form
>               (mk::operate-on-system 'test-suite 'compile)
>               :load-form
>               (mk::operate-on-system 'test-suite 'load))
> ...
> 
> This construct allows to load independent system-definitions into
> a larger system and have them automatically compiled
> (according to dependencies).

Note that the latest MK:DEFSYSTEM allows you to do the following

(mk:defsystem :bla
       :components ((:system 'test-suite)))

that achieves exactly what you were doing in a more convoluted way.  In 
particular now you can write things like

(mk:defsystem "mathematics"
   :components ("mathematics-package"
                "common-math"
                (:system "polynomials" :depends-on "common-math"))
   )

where the "polynomials" system def is in a file 
"polynomials/polynomials.system" (it could also be in any path 
registered with MK:ADD-REGISTRY-LOCATION.)

Doing

	(mk:compile-system "mathemathics")
or
	(mk:load-system "mathematics")

will do the expected thing.

Cheers
--
Marco
From: Marco Antoniotti
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <P97Xc.55$D5.69562@typhoon.nyu.edu>
Marco Antoniotti wrote:

> Martin Ginkel wrote:
> 
>> Hi,
>>
>> until recently I worked with mk:defsystem to define compilation of my 
>> packages. I like the fresh concepts of asdf and consider to switch.
>> But I want to have the following feature:
>>
>> (make:defsystem :bla
>>     :components (
>>          (:module test-env
>>               :initially-do (mk::find-system 'test-suite :load 
>> "test:load-test.lisp")
>>               :compile-form
>>               (mk::operate-on-system 'test-suite 'compile)
>>               :load-form
>>               (mk::operate-on-system 'test-suite 'load))
>> ...
>>
>> This construct allows to load independent system-definitions into
>> a larger system and have them automatically compiled
>> (according to dependencies).
> 
> 
> Note that the latest MK:DEFSYSTEM allows you to do the following
> 
> (mk:defsystem :bla
>       :components ((:system 'test-suite)))
> 
> that achieves exactly what you were doing in a more convoluted way.  In 
> particular now you can write things like
> 
> (mk:defsystem "mathematics"
>   :components ("mathematics-package"
>                "common-math"
>                (:system "polynomials" :depends-on "common-math"))
>   )
> 

Note also that this is in addition to the previous behavior where you 
could write

	(mk:defsystem :blah
               :depends-on (test-suite))

Cheers
--
Marco
From: Marco Antoniotti
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <Zb7Xc.57$D5.69562@typhoon.nyu.edu>
Martin Ginkel wrote:

> Hi,
> 
> until recently I worked with mk:defsystem to define compilation of my 
> packages. I like the fresh concepts of asdf and consider to switch.
> But I want to have the following feature:
> 
> (make:defsystem :bla
>     :components (
>          (:module test-env
>               :initially-do (mk::find-system 'test-suite :load 
> "test:load-test.lisp")
>               :compile-form
>               (mk::operate-on-system 'test-suite 'compile)
>               :load-form
>               (mk::operate-on-system 'test-suite 'load))
> ...
> 
> This construct allows to load independent system-definitions into
> a larger system and have them automatically compiled
> (according to dependencies).


Note that the latest MK:DEFSYSTEM allows you to do the following

(mk:defsystem :bla
       :components ((:system 'test-suite)))

that achieves exactly what you were doing in a more convoluted way.  In 
particular now you can write things like

(mk:defsystem "mathematics"
   :components ("mathematics-package"
                "common-math"
                (:system "polynomials" :depends-on ("common-math")))
   )

where the "polynomials" system def is in a file 
"polynomials/polynomials.system" (it could also be in any path 
registered with MK:ADD-REGISTRY-LOCATION.)

Doing

     (mk:compile-system "mathemathics")
or
     (mk:load-system "mathematics")

will do the expected thing.

Cheers
-- 
Marco
From: Marco Antoniotti
Subject: Re: Asdf and sub-systems
Date: 
Message-ID: <Wc7Xc.59$D5.69562@typhoon.nyu.edu>
Marco Antoniotti wrote:

> 
> 
> Martin Ginkel wrote:
> 
>> Hi,
>>
>> until recently I worked with mk:defsystem to define compilation of my 
>> packages. I like the fresh concepts of asdf and consider to switch.
>> But I want to have the following feature:
>>
>> (make:defsystem :bla
>>     :components (
>>          (:module test-env
>>               :initially-do (mk::find-system 'test-suite :load 
>> "test:load-test.lisp")
>>               :compile-form
>>               (mk::operate-on-system 'test-suite 'compile)
>>               :load-form
>>               (mk::operate-on-system 'test-suite 'load))
>> ...
>>
>> This construct allows to load independent system-definitions into
>> a larger system and have them automatically compiled
>> (according to dependencies).
> 
> 
> 
> Note that the latest MK:DEFSYSTEM allows you to do the following
> 
> (mk:defsystem :bla
>       :components ((:system 'test-suite)))
> 
> that achieves exactly what you were doing in a more convoluted way.  In 
> particular now you can write things like
> 
> (mk:defsystem "mathematics"
>   :components ("mathematics-package"
>                "common-math"
>                (:system "polynomials" :depends-on ("common-math")))
>   )
> 

Note also that this is in addition to the previous behavior where you 
could write

     (mk:defsystem :blah
               :depends-on (test-suite))

Cheers
-- 
Marco