-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to mimic _tags file within myocamlbuild.ml #19
Comments
The internal function to do this is |
Here's a test case:
Now looking at (The extensive use of mutable variables in |
Ignore last question. I was doing something else wrong. Here's a solution that is working so far:
Leaving open for now, until I test a bit more. |
Either
Pull requests to improve the current status would be warmly welcome. I think your use-case is interesting and would warrant improvements to the current OCamlbuild API. Please keep providing feedback on what you would need. One related feature that was proposed (I can't find the mantis ticket back) is to provide a filesystem overlay: some kind of master It looks like such a feature could be useful for your purposes. Would you be interested in helping implement it? |
Thanks for the additional input.
My goal is to eliminate _tags, mllib, odocl, etc. I know OCaml, so I want to express my build in OCaml. Adding a YAML file seems to me the wrong direction.
I'm not yet convinced that ocamlbuild has a good model. The general problem is rather complex and interesting, and has use cases beyond compiling code. I'm still exploring, but will contribute what I can to ocamlbuild along the way (if not code, at least feedback and examples of anything that works for me). |
My proposal is to explicit the fact that OCamlbuild works on a virtual abstraction of the "project tree", not only the filesystem sub-hierarchy at hand. Currently this virtual project tree is a mirror of the fragment of the filesystem delimited by |
What can you specify with such a tree? Does it add any expressivity beyond what you can currently do, which is dependent on builtin conventions for all these specific files: _tags, .mllib, etc? IIUC, this would only let you specify the content of these files in a different place, which perhaps you find more convenient. I'm kind of considering the same thing. I'm now expressing my
Is it clear why they prefer _tags? I wonder if that's because writing a myocamlbuild.ml file has been so scary. A nicer user API might remove that issue.
Would users of the OCaml API benefit at all from the overlay proposal? If not, then they aren't complementary, but rather the OCaml API is the more fundamental one and the overlay proposal is an easier interface for simpler cases (but as above I wonder if the OCaml API couldn't be made just as easy). Is this the usual debate between making a new configuration language or providing an embedded DSL. The latter is always better if your users don't have an aversion to the host language, which in this case they shouldn't; ocamlbuild users are OCaml programmers. |
Yes (but if you have suggestion for "more expressive" things, why not). Basically, instead of creating
to
from myocamlbuild.ml. The interest in having this avaibility is that some users dislike having to create many files in their project to satisfy the build system. For example, people ask for the ability to use
I tend to agree with you -- the very first step is to have a documented API and this what this manual is about. But I suspect that some users would still be ready to jump through hoops to not write OCaml code -- it would be nice to find a way to please both crowds. (I resist adding to much to _tags if it means diverging from its current simple declarative semantics, which is also why other files could be considered.)
Well the API would let you add and change things in the project tree overlay. But it may also give you more fine-grained, better typed, better ways to do things. This is similar to what you are doing right now: feeding strings to a parsing function is not really ideal but it is expressive, I'm sure you would appreciate a typeful API to build tag descriptions. (It would be rather easy to add one with one pull request exposing the type |
Your examples dissuade me further from the overlay idea. It seems to be adding cruft on top of cruft. You'll have yet another way to specify something, making it harder to understand a project's build rules by human readers. The _tags file at least has some reasonable amount of information, but files like mllib and odocl are so basic that I feel having a file for them is too much. Why not just give a string list to some function in myocamlbuild.ml and be done with it. And now I can, if I want to, generate that list by reading my directory contents. I really can't imagine not wanting that. On a separate note, there are modules |
Make that file be
Yes and surprised to not find it. |
Within
myocamlbuild.ml
, how can I apply some tags to files matching a filter.I know the recommended way of doing this is to define an
_tags
file, but I don't want to because:.merlin
file. Thus, I need the list of packages my project uses withinmyocamlbuild.ml
.I tried mutating
Options.tags
, but I'm not sure that's the right variable to change and I don't know how to do this selectively on files matching a pattern.The text was updated successfully, but these errors were encountered: