-
Notifications
You must be signed in to change notification settings - Fork 415
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
env-vars
, paths
and dune files
#2465
Comments
Thanks for digging into this :)
In my head, that was actually about semantic. If you allow such settings to cross project boundaries, then the interpretation of dune files depend on the workspace they are in. This might make it harder to reason about a project on its own. Maybe that's ok for environment variables though, I'm not sure. I guess it all depends how these are used. Do you have use cases in mind for modifying paths in dune files?
That seems like a net win over the current world. Modifying |
One thing that I forgot to mention is the I also forgot to mention this in @nojb's PR. Does this field help at all? You should be able to override ocamlc this way, and if not then we should simply fix that. |
I thought about this when working in #2426, but it was not enough for my use-case: on Windows for example the native compiler toolchain does not typically live in the PATH (because it is usual to work with several versions at once) and one needs to add them explicitly. Adding each tool individually using
As far as I remember, indeed it is the case that one cannot currently use |
As far as I remember, it works in the sense that it is passed in the environment of launched programs, but it is not taken into account for resolving binaries. This could be fixed, but I didn't do that when working on #2426 because it would not be easy to append to |
I don't want to modify PATH, indeed the binaries field is better. My use case is just for tools that, as ocamlfind, use variables (like
Since this paths variable would be append only in I haven't finished to code but the documentation would be, inside the env stanza:
I don't like that the semantic is a little different in Another question I haven't answered is should we have a way to specify that the path should not be absolutized in the source directory, but in the build directory; or should it be the default. EDIT: the advantage for build directory is it forces to give good dependencies. |
Good point but I think that for OCaml we could have added special support via some sort of |
In that case, I don't understand correctly the documentation:
|
No because the compiler and related tools are resolved when creating the |
This doc refers only to |
Ok, I see but we can remove this difference. I propose that both |
Does that correspond to the dune files between between the root of the current and the current directory? |
No it corresponds to all the |
In the Coq case, what would be the full story? I don't know the detail, but my guess is that |
Yup, it is roughly equivalent to ocamlpath. |
I would like to add
paths
(added in #2426) in dune files. But the design choices are scattered among different issues and merge request, so I would like to summarize them and see howpaths
in dune fills in.Firstly
env-vars
andpaths
can be defined indune-workspace
file andenv-vars
in dune files. Indeed contrary to what the documentation says they could already be used in dune files.Currently
env-vars
that are used for executing a command depends on the directory where the rule/exec is defined/ran. Theenv-vars
used are the one of the directory and all its parent with usual inheritance rule (the parent has a smaller priority). We don't take theenv-vars
of all the scopes because we don't want to look at scopes we don't need to, in order to scale to big repositories. Moreover the priority rule to apply is not clear.Still this design is different from the binaries and libraries one. Indeed all the public binaries and libraries built are available inside all the directories. So the environment variables that accompanied them should also.
Since
paths
can be appended (the priority rule is less problematic), we could choose a design more in line with binaries and libraries. We could use thepaths
from all thedune-files
which are currently installed or more easily that are in theArtifacts.t
value ofSuper_context.t
.At first we can forbid environment variable used and modified by dune (e.g
PATH
,OCAMLPATH
) to be changed in dune file.The text was updated successfully, but these errors were encountered: