caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: caml-list caml-list <caml-list@yquem.inria.fr>
Subject: Working on dependent projects with ocamlbuild
Date: Wed, 24 Oct 2007 13:07:27 +0200	[thread overview]
Message-ID: <7BE597C9-3EF8-4DF4-946F-826FF312A256@erratique.ch> (raw)

Hello,

Somewhat related to the discussion we had about the (bad) idea of  
embedding dependencies into projects. I'd like to share the following  
setup with ocamlbuild that allows me to work simultaneously on a  
'base' project and two independent projects 'p1' and 'p2' that use  
'base'. Basically my sources are distributed as follows :

base/src
p1/src
p2/src

What I used to do is to build a .cma out of the sources in base/src  
and point the others to that .cma. When I did a change in base, I had  
to build that .cma again, sometimes forgetting and seeking for bugs  
in code while it was just a .cma freshness issue.

What I do now is that I completly forget about .cma's. I just create  
the following links in p1 and p2

ln -s ../base/src p1/base
ln -s ../base/src p2/base

And add the following to their _tags file :

echo "<base>: include" >> p1/_tags
echo "<base>: include" >> p2/_tags

The rest is simply sorted out by ocamlbuild. Whenever I do a change  
in base/src I don't need to recompile anything there, if I rework in  
p1 or p2 things are automatically updated, I always use the latest  
version of base's code. Of course this means longer build time when  
you ocamlbuild -clean in p1 and p2 since they each build their own  
version of base. But on the scale at which I work it is currently not  
an issue.

The only caveat (that may disappear in the future) is that base/src  
should be able to build without a plugin. Otherwise you will
have to integrate base's myocamlbuild.ml instructions into p1 and  
p2's myocamlbuild.ml (btw. couldn't we find a less egoistic name for  
that file). But if you are only working with _tagged caml sources it  
should works perfectly, put your tags for base in base/src/_tags.

Best,

Daniel


             reply	other threads:[~2007-10-24 11:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24 11:07 Daniel Bünzli [this message]
2007-10-24 12:10 ` [Caml-list] " Matthieu Dubuget
2007-10-24 13:09 ` Nicolas Pouillard
2007-11-01 10:53 ` Daniel Bünzli
2007-11-01 12:51   ` Daniel Bünzli
2007-11-02 15:32   ` Nicolas Pouillard
2007-11-04 21:08     ` Daniel Bünzli
2007-11-05 10:02       ` Nicolas Pouillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7BE597C9-3EF8-4DF4-946F-826FF312A256@erratique.ch \
    --to=daniel.buenzli@erratique.ch \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).