-
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
dune subst reads from dune-project #2955
Conversation
Well, I meant to create a draft pull-request but misclicked |
src/dune/watermarks.ml
Outdated
@@ -173,7 +173,7 @@ let subst_file path ~map = | |||
|
|||
(* Minimal API for dune-project files that makes as little assumption about the | |||
contents as possible and keeps enough info for editing the file. *) | |||
module Dune_project = struct | |||
module Dune_project_mini = struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, the intent of this sub-module was to not do a complete decoding of the dune-project
file and keep enough information to edit it. However, now that we are fully loading the dune-project
file it makes less sense to also load it again in a minimal way on the side. At this point we are only relying on this module for editing the dune-project
file, so I propose to rename it Dune_project_editor
instead, to state its purpose more clearly.
We could also extend the main Dune_project
module to keep the necessary information to do the edition. It's not a requirement for this PR, but you are welcome to have a look if you feel motivated :)
No worries for the draft status. I left a couple of comments but otherwise it looks good to me! Could you also add a test for this please? To do so, you need to add a directory with a |
Still working in progress. I don't see any way to modify the dune project by the exported API, so I guess we'll have to leave the editor here for the moment being. I changed the editor module to extend the original With regards to testing, I see we're having a problem. Now |
I added
Seems good to me. The current code looks clear.
Hmm, that's odd. I'm looking at the failing tests and I would have expected the information to be capture by the |
Ah ok, I just remembered that we don't parse all the fields when reading opam files in One possibility is to change this code to instead read the data from the opam file. We can use the code in |
@fangyi-zhou did you have a chance to take another look at this issue since last time? |
I'll try to work on it a bit tonight, otherwise I'm fine if someone would like to take over from me, or start a new PR |
Ok, let me know how it goes. Happy to help finishing the PR. |
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Fangyi Zhou <me@fangyi.io>
Signed-off-by: Fangyi Zhou <me@fangyi.io>
Signed-off-by: Fangyi Zhou <me@fangyi.io>
We only need to know whether the package has a corresponding opam file or not. Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Superposing the two sources of information is not ideal. Dune makes sure there is only one source of information written by the user: the opam files or the dune-project file. But we can't have both. I'm refactoring a bit the code to make that more explicit. |
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Instead of merging them later on Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
I reworked a bit the code. Now all the information is collected and merged right from the start and contained in Merging this now. Thanks for your contribution to Dune! |
Thanks a lot for the help! |
…lugin, dune-private-libs and dune-glob (2.2.0) CHANGES: - `dune test` is now a command alias for `dune runtest`. This is to make the CLI less idiosyncratic (ocaml/dune#3006, @shonfeder) - Allow to set menhir flags in the `env` stanza using the `menhir_flags` field. (ocaml/dune#2960, fix ocaml/dune#2924, @bschommer) - By default, do not show the full command line of commands executed by `dune` when `dune` is executed inside `dune`. This is to make integration tests more reproducible (ocaml/dune#3042, @diml) - `dune subst` now works even without opam files (ocaml/dune#2955, fixes ocaml/dune#2910, @fangyi-zhou and @diml) - Hint when trying to execute an executable defined in the current directory without using the `./` prefix (ocaml/dune#3041, fixes ocaml/dune#1094, @voodoos). - Extend the list of modifiers that can be nested under `with-accepted-exit-codes` with `chdir`, `setenv`, `ignore-<outputs>`, `with-stdin-from` and `with-<outputs>-to` (ocaml/dune#3027, fixes ocaml/dune#3014, @voodoos) - It is now an error to have a preprocessing dependency on a ppx rewriter library that is not marked as `(kind ppx_rewriter)` (ocaml/dune#3039, @snowleopard). - Fix permissions of files promoted to the source tree when using the shared cache. In particular, make them writable by the user (ocaml/dune#3043, fixes ocaml/dune#3026, @diml) - Only detect internal OCaml tools with `.opt` extensions. Previously, this detection applied to other binaries as well (@kit-ty-kate, @rgrinberg, ocaml/dune#3051). - Give the user a proper error message when they try to promote into a source directory that doesn't exist. (ocaml/dune#3073, fix ocaml/dune#3069, @rgrinberg) - Correctly build vendored packages in `-p` mode. These packages were incorrectly filtered out before. (ocaml/dune#3705, @diml) - Do not install vendored packages (ocaml/dune#3704, @diml) - `make` now prints a message explaining the main targets available (ocaml/dune#3085, fix ocaml/dune#3078, @diml) - Add a `byte_complete` executable mode to build programs as self-contained bytecode programs (ocaml/dune#3076, fixes ocaml/dune#1519, @diml)
…lugin, dune-private-libs and dune-glob (2.2.0) CHANGES: - `dune test` is now a command alias for `dune runtest`. This is to make the CLI less idiosyncratic (ocaml/dune#3006, @shonfeder) - Allow to set menhir flags in the `env` stanza using the `menhir_flags` field. (ocaml/dune#2960, fix ocaml/dune#2924, @bschommer) - By default, do not show the full command line of commands executed by `dune` when `dune` is executed inside `dune`. This is to make integration tests more reproducible (ocaml/dune#3042, @diml) - `dune subst` now works even without opam files (ocaml/dune#2955, fixes ocaml/dune#2910, @fangyi-zhou and @diml) - Hint when trying to execute an executable defined in the current directory without using the `./` prefix (ocaml/dune#3041, fixes ocaml/dune#1094, @voodoos). - Extend the list of modifiers that can be nested under `with-accepted-exit-codes` with `chdir`, `setenv`, `ignore-<outputs>`, `with-stdin-from` and `with-<outputs>-to` (ocaml/dune#3027, fixes ocaml/dune#3014, @voodoos) - It is now an error to have a preprocessing dependency on a ppx rewriter library that is not marked as `(kind ppx_rewriter)` (ocaml/dune#3039, @snowleopard). - Fix permissions of files promoted to the source tree when using the shared cache. In particular, make them writable by the user (ocaml/dune#3043, fixes ocaml/dune#3026, @diml) - Only detect internal OCaml tools with `.opt` extensions. Previously, this detection applied to other binaries as well (@kit-ty-kate, @rgrinberg, ocaml/dune#3051). - Give the user a proper error message when they try to promote into a source directory that doesn't exist. (ocaml/dune#3073, fix ocaml/dune#3069, @rgrinberg) - Correctly build vendored packages in `-p` mode. These packages were incorrectly filtered out before. (ocaml/dune#3705, @diml) - Do not install vendored packages (ocaml/dune#3704, @diml) - `make` now prints a message explaining the main targets available (ocaml/dune#3085, fix ocaml/dune#3078, @diml) - Add a `byte_complete` executable mode to build programs as self-contained bytecode programs (ocaml/dune#3076, fixes ocaml/dune#1519, @diml)
Signed-off-by: Fangyi Zhou me@fangyi.io
Working in progress for #2910