Browse thread
Working on dependent projects with ocamlbuild
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Daniel_Bünzli <daniel.buenzli@e...> |
| Subject: | Working on dependent projects with ocamlbuild |
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