Here is how I organize my own projects. I hope maybe some of you have some comments on this.
I use packages fairly heavily, with the project spread over 9 packages currently. This is in order to encapsulate functionality, and to avoid having to load unnecessary functionality in different builds. The packages are contained within separate directories, with a main file containing the package definition.
ASDF is use to manage the system build and dependencies. I see a lot of complaining about ASDF, but it seems to works for me.
I put a test directory under each package directory, containing an additional test package. This test package separates testing dependencies and symbols from the main package, and makes it easy to load and run the tests. The ASDF definition loads the main package and the testing framework (fiveam), while the test package definition imports internal symbols from the main package as needed. Each CL code file in the main package will usually have a corresponding .test.lisp file with the associated tests.
Code files are usually centered around specific data structures (eg. CLOS classes), generic function interfaces or particular functionality. There usually some shuffling around of statements to avoid warnings at load/compile time.
package-a/package-a.asd <- builds system and loads dependencies
package-a/package-a.lisp <- defines package and possibly main package interface
package-a/blablabla.lisp <- regular lisp code compiled and loaded by ASDF
package-a/test/package-a.test.asd <- loads main system, along with test files
package-a/test/package-a.test.lisp <- test package definition along with necessary imports
package-a/test/blablabla.test.lisp <- tests associated with functionality in the blablabla.lisp file.
Well, these are just some thoughts about how I've structured my projects. I'ld be happy to hear about how the rest of you has organized your code and tests and etcetera!
-andré
thoughts on CL project organization
Re: thoughts on CL project organization
Hi
I organize things similarly. One thing I like about your setup is the separation of tests and regular code. I usually do not like libraries conflating these two aspects in a single file, especially because tests are dependent on a specific testing library which I may not want to deal with.
Cheers
I organize things similarly. One thing I like about your setup is the separation of tests and regular code. I usually do not like libraries conflating these two aspects in a single file, especially because tests are dependent on a specific testing library which I may not want to deal with.
Cheers
Marco Antoniotti
Re: thoughts on CL project organization
One thing that has turned me off ASDF (besides being a pain on Windows) is that it doesn't seem to take version numbers into account. I suppose if developers named their packages as :my-library1 and the successor as :my-library2 (and so on) then api issues would be mitigated.
Instead of using asdf I'm trying to organize thing into modules. I like the way Python does it; you just load the module when you need it, and it works. The developer using the module doesn't need to be concerned with anything other than how to use it.
So I do things in a similar way as you do, with the exception of using a modular design over asdf (I know their both modular, but the way their executed is different).
Instead of using asdf I'm trying to organize thing into modules. I like the way Python does it; you just load the module when you need it, and it works. The developer using the module doesn't need to be concerned with anything other than how to use it.
So I do things in a similar way as you do, with the exception of using a modular design over asdf (I know their both modular, but the way their executed is different).
-
- Posts: 2
- Joined: Wed Jul 16, 2008 12:24 am
Re: thoughts on CL project organization
I usually use ASDF to package my code, but do not use that symbolic link .asd managing stuff. I have setup a hierarchical folder structure where I just drop the ASDF packages folder at the right place. Some function grovels over all folders, collection *.asd and adding each folder that has a *.asd on the asdf:*central-registry*. If there is a conflicting system the function tells me so.
My libraries are structured like this
Sometimes - when things grow considerably bigger, I add additional module levels below src/
ciao,
Jochen
My libraries are structured like this
Code: Select all
some-project/
some-project.asd
doc/
...
tests/
...
src/
packages.lisp
logical-hostnames.lisp
a.lisp
b.lisp
c.lisp
Code: Select all
some-project/
some-project.asd
doc/
README
INSTALL
...
tests/
packages.lisp
logical-hostnames.lisp
tests.lisp
...
src/
platform-dependent/
packages.lisp
a.lisp
model/
packages.lisp
a.lisp
protocols/
packages.lisp
a.lisp
packages.lisp
logical-hostnames.lisp
a.lisp
b.lisp
c.lisp
Jochen
Re: thoughts on CL project organization
It is possible to write custom system-definition search function (function that takes system name and returns the file), and then push it into asdf:*system-definition-search-functions*. I used such function when trying ASDF on windows.Neonsquare wrote:Some function grovels over all folders, collection *.asd and adding each folder that has a *.asd on the asdf:*central-registry*.