ocamlfind icon indicating copy to clipboard operation
ocamlfind copied to clipboard

an "ocamlfind reinstall-if-diff" command

Open chetmurthy opened this issue 4 years ago • 1 comments

[this is almost certainly not one I think you'll want to add to ocamlfind, so I'm really asking you this to get your opinion whether this is a foolish idea, before I implement it]

Recently I've been building a project with a bunch of interrelated sub-packages that need to be built in a particular order. At full-project-install time, I install a single findlib package with a bunch of sub-packages. Durin the build, each sub-package is built and then installed in a local repository. So sub-package C can depend on sub-package A,B, by depending on their findlib directories, and instead of a mess of include-directories and references to cmo/cmi/cma files, the references are always to other findlib packages. It's very clean and neat.

There is only one problem: the last step in building a sub-package is to "ocamlfind install" it to the local repository. But if the package hasn't actually changed, then the act of installing it will update the insalled package. So if I rerun the build on package B, this will cause C to think that B has changed, and trigger a complete rebuild of C.

If there were an "ocamlfind reinstall-if-diff " command that would (a) check that the list of files provided was identical to the contents of the package , and if so, then do nothing, and (b) if different, would delete package and reinstall it, then this would be perfect.

I don't think this belongs in ocamlfind, but I do think this is a useful way to organize nontrivial ocaml projects with a bunch of internal dependencies.

What do you think? Am I missing something?

P.S. I believe that along this path will be an integration between ocamlfind and Google Bazel. That's sort of where I'm heading.

chetmurthy avatar Apr 30 '20 17:04 chetmurthy

Gerd, I've implemented the "reinstall-if-diff" command in a git repo ( https://github.com/chetmurthy/ocamlfind2 ) and would like to release this. The project contains also the preprocess command, and it's possible over time I'll add more commands. They're all 'add-ons' that I view as not central to ocamlfind, but maybe useful.

Right now, the project name ocamlfind2 seems .... well, both a little presumptuous, and maybe confusing. I think I should change the name, the ensure no possibility of confusion. I'm open to any suggestion you have for a different name, and (since my sister said 'always suggest a default choice") I'll suggest as a default "not-ocamlfind" or "ocamlfind-experimental" (even this latter one, I find a little presumptuous).

Would you be OK with "not-ocamlfind"?

chetmurthy avatar May 21 '20 02:05 chetmurthy