I’ve searched the documentation, and haven’t found this, hence my asking the question:
Is there a way to use opam to build a package, but not install it? That is, no external effects whatsoever ? Just do everything required to build it? Of course, that would mean that if the package has prereqs that aren’t installed, then the build fails (and you need to do a
install --deps-only beforehand).
This would be nice for, y’know, testing packages nearly-completely.
There are opam plugins opam-build and opam-test that sort of do this. See: GitHub - kit-ty-kate/opam-build: Experimental opam plugin
looking at the doc for
opam-build, it appears that it builds a local switch? I ran it, and that’s what seemed to be happening (and no flags to disable it)? That’s actually not what I want. B/c I have N “global” switches, and in each I want to do the build (in order to test for version-compatibility). Among other things, I’d like to run all these installs in parallel (8-way AMD Ryzen, gotta use it up
Is there a way to tell opam-build to use the current switch ?
Yes sorry, that’s what I meant by “sort of”. I agree that that would be nice. Even more with a way to test different compilers / etc. I guess @kit-ty-kate can say more about the plugin.
Another option is to use ocaml-ci, which builds with different versions and checks that it builds which is nice because it also makes sure that the dependencies are at least correct enough to contain all required code to build on “someone else’s machine”. Currently it is not in general availability state but you can probably get added to the list of approved users.
The problem with opam-ci is that it does a large pile of installs for prereqs, and that takes time. The nice thing about “do an install but skip the last step of actually copying files into place” is that it’s so much cheaper. But otherwise, yes, opam-ci is what I’d like. Trying to get some part of the benefit without the cost.