OCaml Forge

Detail: [#1174] VCS-friendly myocamlbuild.ml

Feature Requests: Browse | Download .csv | Monitor

[#1174] VCS-friendly myocamlbuild.ml

Date:
2012-06-14 19:13
Priority:
3
State:
Open
Submitted by:
Petter Urkedal (paurkedal)
Assigned to:
Sylvain Le Gall (gildor-admin)
Resolution:
None
Due in version:
None
Product:
OASIS
Component:
Plugin OCamlbuild
Operating System:
All
 
Summary:
VCS-friendly myocamlbuild.ml

Detailed description
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.

Followup

Message
Date: 2012-08-17 16:47
Sender: Petter Urkedal

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.
Date: 2012-08-17 16:17
Sender: Christophe Troestler

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...

Attached Files:

Changes:

Field Old Value Date By
assigned_tonone2014-06-16 09:41gildor-admin