RFC: DUNE_IGNORE variable to ignore some source files#11819
RFC: DUNE_IGNORE variable to ignore some source files#11819gasche wants to merge 1 commit intoocaml:mainfrom
Conversation
|
The feature request is reasonable, but I'd rather such a glob live the dune file rather than as an environment variable. We already have a See this ticket for more discussion #7811 |
|
Thanks! I'm happy to have a look at implementing Ideas:
(My preference would go to a |
|
I was thinking of something a little simpler, perhaps: Would evaluate Your other suggestions seem fine as well. I'd say go for whatever you find simplest to implement. I'd suggest that you look over the implementation of |
Alternatively, a |
|
Note: I have not had any time to look at this again, but this remains a feature that would be very useful for using |
|
I haven't had time to revisit this PR, but at the same time it would be very convenient if it (or something like this) would be available in Dune today to work on the compiler with Merlin support. I wonder if one of the following would be possible?
|
I'll try to give it a shot. But since I haven't actually looked at the code yet, I can't promise something unexpected won't come up :) |
|
Thanks! (Indeed it is not clear to me that configuration information is available at the place I tweaked in the code, and I don't know how easy and elegant it would be to propagate configuration information until that point. It may be that the same filtering can be performed somewhere else, but I tried a couple things before finding a place that works as intended.) |
See #12879 for my attempt. |
|
This is superseded by #12879 which has been merged. Note that the current PR makes it easy to ignore files in all subdirectories, rather than asking to tweak each dune file manually, so it rather corresponds to I felt a bit bad a few days ago to be asking Dune contributors to do more work on my behalf, but I am happy with the result :-) Thanks! |
The dune build system for github/ocaml is very painful to use for everyday compiler development. I would like to make it less painful to use, and I think a reasonable approach would be to implement a couple simple tweaks in dune to make it more pleasant. (The compiler is an unusual project building in a special environment, so maybe it deserves a couple specific tweaks in dune).
This PR is not inteded to be merged as-is, but more a starting point for discussion: I'm willing to do a bit of work to make dune less painful, what changes would you be willing to accept?
In the PR I add a DUNE_IGNORE environment variable to ask it to ignore some files in the source directories -- directed by a glob pattern.
Before:
After:
Much more pleasant!
Context
Currently the only way to get Merlin support for the compiler sources is to use its dune build system. See github/ocaml/HACKING.adoc#using-merlin.
One major limitation in my experience is that, because the dune build is incomplete, we need to keep building using the makefile for development, testing, etc. So currently the workflow is as follows:
makemake clean; dune build @libsmakemake clean; dune build @libsThe need to run
make cleanin between two dune invocations is a massive pain. This is mostly solved by the proposed feature.(Note: it's important to ignore the build outputs that are present in source directories, and not, for example, to use them as valid outputs instead of the other rules to build them, because they are not built by the same compiler as Dune. Dune uses the compiler from the opam switch, while Make uses the bootstrap or in-development compilers.)
What would be an acceptable interface?
I understand that such "ignore rules" are not well-regarded by Dune designers. I wish there were available, but they could be maked by a prefix to discourage their usage, or require a certain explicit marker in
dune_project(for example aspecial_hacks_for_the_compilerstanza), or be hidden within an environment variable to discourage usage ever more. What would be acceptable to you?What would be an acceptable implementation?
I can see that other environment variables are surrounded by much more ceremony to guarantee that they are recorded as build dependencies and do not break the memoization machinery. I'm happy to try to implement this for DUNE_IGNORE as well, if there is a consensus that this is the preferred user interface for this feature. Any other implementation advice is welcome.