oasis icon indicating copy to clipboard operation
oasis copied to clipboard

VCS-friendly myocamlbuild.ml

Open gildor478 opened this issue 4 years ago • 0 comments

This feature request has been migrated from artifact #1174 on forge.ocamlcore.org. It was assigned to user102.

user6958 posted on 2012-06-14 19:13:19:

It would be nice if it was possible to split the custom and generated content of myocamlbuild.ml. Otherwise, custom bits of myocamlbuild.ml cannot be committed to a VCS without also committing a fair amount of generated code. I can think of two options:

Option 1. I think the most elegant solution would be to do something similar to what "oasis -setup-update dynamic" does to "setup.ml". That is, myocamlbuild.ml would look something like

(* OASIS_START ) ( DO NOT EDIT ... ) open OASISDynOcamlbuildPlugin;; ( OASIS_END *)

oasis_dispatch begin function | ... -> ... | e -> () end

Alternatively, using the regular "dispatch":

dispatch begin function | ... as e -> ...; dispatch_default e | e -> dispatch_default e end

Option 2. Maybe it's easier to include the user's code from another file. That is, if a file, say _myocamlbuild.ml exists when "oasis" is invoked, it is included in myocamlbuild.ml just before (* OASIS_END *), and nothing is emitted after this marker.

user144 replied on 2012-08-17 16:17:14:

This is not well documented but actually "oasis setup -setup-update dynamic" is enough, just include

(* OASIS_START ) ( OASIS_END *)

in your myocamlbuild.ml and it will be populated dynamically...

user6958 replied on 2012-08-17 16:47:46:

Thanks for the tip, that was just what I needed.

Yes, I think it would be good with an explanation in the manual. The oasis setup -help almost explains it, except for use of the comment markers, which one might guess by analogy with the normal operation.

gildor478 avatar Oct 24 '20 16:10 gildor478