Lisp HUG Maillist Archive

how to use defsys "correctly"

I'm reorganizing a project and am trying to use defsys and the System Browser.

I keep running into problems, so it's obvious that I'm doing something wrong 
and I'm not following the path of least resistance.

The project has a bunch of sub-directories, each with its own defsys.lisp.

I open lispworks in the parent directory.

I'd like to caused all the defsys.lisp's to be loaded, then compile & load the 
system.  Out of habit, I don't want to use absolute pathnames anywhere - so 
that some time in the future, I could just lift the whole directory structure 
and plant it somewhere else and still have the thing load and compile.

I wrote a script (in the parent directory) to load the defsys.lisp's being 
careful to change-directory to the subdirectories and using 
(current-pathnames) in the defsys.lisp's default-directory.

This still fails - it's getting the pathnames wrong.

I'm beginning to think that I'm missing the "obvious" way to use the system 
browser to load a multi-directory project.

Any advice would be appreciated.

thanx
pt


Re: how to use defsys "correctly"

At 26/07/2005 20:45, tarvydas wrote:
>I'm reorganizing a project and am trying to use defsys and the System Browser.

Here is an excerpt of what I have currently, a bit simplified. 
Notice, the paths of all the systems are defined relatively to 2 
main variables (*application-libs-directory* and subdirectories 
to contain code that I normaly don't touch, 
*application-startup-directory* to contain my code).

To load and compile the whole application, just load and compile the :root system:
(compile-system :root)
(load-system :root)

CL-USER 1 > *application-libs-directory*
#P"g:/pe-libs/"

CL-USER 2 > *application-startup-directory*
#P"g:/pe/"


(defsystem :foil
   (:default-pathname
    (merge-pathnames (make-pathname :directory (cons :relative '("foil")))
                     *application-libs-directory*))
   :members
   ("foil" "patch")
   :rules
   ((:in-order-to :compile (:all)
     (:caused-by (:compile :previous))
     (:requires (:load :previous)))))


(defsystem :cl-tools
   (:default-pathname
    (merge-pathnames (make-pathname :directory (cons :relative '("tools" "cl")))
                     *application-startup-directory*))
   :members
   ("macros" "dev" "mvlet" "list" "string" "misc")
   :rules
   ((:in-order-to :compile (:all)
     (:requires (:load "macros")))))


;;; contains all the systems
(defsystem :root
   ()
   :members (...
             (:foil :type :system)
             (:cl-tools :type :system)
              ...
             )
   :rules
   ((:in-order-to :compile (:all)
     (:requires (:load
                 "foil"
                 "cl-tools"
                 ...
                 )))))

Hope it helps,

Francis


>I keep running into problems, so it's obvious that I'm doing something wrong
>and I'm not following the path of least resistance.
>
>The project has a bunch of sub-directories, each with its own defsys.lisp.
>
>I open lispworks in the parent directory.
>
>I'd like to caused all the defsys.lisp's to be loaded, then compile & load the
>system.  Out of habit, I don't want to use absolute pathnames anywhere - so
>that some time in the future, I could just lift the whole directory structure
>and plant it somewhere else and still have the thing load and compile.
>
>I wrote a script (in the parent directory) to load the defsys.lisp's being
>careful to change-directory to the subdirectories and using
>(current-pathnames) in the defsys.lisp's default-directory.
>
>This still fails - it's getting the pathnames wrong.
>
>I'm beginning to think that I'm missing the "obvious" way to use the system
>browser to load a multi-directory project.
>
>Any advice would be appreciated.
>
>thanx
>pt


Re: how to use defsys "correctly"

Unable to parse email body. Email id is 4228

Re: how to use defsys "correctly"

On July 26, 2005 05:04 pm, Martin Simmons wrote:

> because it defaults to the directory of the defsys file itself.

That's what I was missing.  I was over-specifying (using :default-directory 
when I didn't need to).

Now it looks nice and simple.

Thanks.

pt


Updated at: 2020-12-10 08:51 UTC