ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.62k stars 401 forks source link

Thoughts about management of the environment #4382

Open ghost opened 3 years ago

ghost commented 3 years ago

Dumping here the result of various discussions we had with about environment variables, for future reference.

Currently, Dune passes through the environment it is executed in to commands it runs. The only management of the environment we do is allowing users to declare dependency on environment variables, so that actions are re-executed when such environment variables change.

There are several issues we know about regarding the environment:

For the first issue, we discussed and/or tested a few ideas:

As always, any behaviour change should be tied to the version of the Dune language to ensure good backward compatibility.

We are currently passing around the environment as a string map, and overall it feels like we should probably use some more structured representation.

bobot commented 3 years ago

(For the second issue we discussed splitting those directories, for example one directory for each binary or for each package so that we can create a PATH variable which really represent the binaries declared as dependencies (similarly to nix))