Add (glob_files <glob>) and (glob_files_rec <glob>) to the files field of the install stanza#6250
Conversation
1b734c3 to
e5f29eb
Compare
christinerose
left a comment
There was a problem hiding this comment.
A few minor grammar / formatting suggestions as well as a question or two.
test/blackbox-tests/test-cases/install-glob/install-glob-files-only.t
Outdated
Show resolved
Hide resolved
test/blackbox-tests/test-cases/install-glob/install-glob-files-only.t
Outdated
Show resolved
Hide resolved
test/blackbox-tests/test-cases/install-glob/install-glob-recursive.t
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,17 @@ | |||
| open! Import | |||
There was a problem hiding this comment.
Add a small description of the module please.
src/dune_rules/dune_file.ml
Outdated
| let to_file_bindings_expanded t ~expand_str ~dir = | ||
| let open Memo.O in | ||
| to_file_bindings_unexpanded t ~expand_str | ||
| >>= Memo.List.map ~f:(File_binding.Unexpanded.expand ~dir ~f:expand_str) |
There was a problem hiding this comment.
It's a matter of style, but you can just do Memo.bind and remove the let open uses only once.
|
Should be updated to require 3.6.0 Btw, does this compose with |
7c09323 to
071b100
Compare
|
Updated to require 3.6. Good question about |
071b100 to
e84bd95
Compare
|
I added a test which used globs in a dune file inside a subdirectory and that highlighted a problem with my implementation. I've updated this so that now the |
296392c to
8118f81
Compare
Added test composing |
|
The failure in CI looks a little suspicious: Do you think it's related to some your changes? |
997a63d to
2d73dfa
Compare
Interesting. I'll investigate this tomorrow. |
|
I found yet another case which this didn't handle. Namely, it would crash if the glob contained an absolute path. Note that relative globs containing absolute paths previously resulted in an unhandled error. I've added a |
c3f496b to
e665cee
Compare
|
I found two cases which would previously crash dune (prior to this PR that is):
I've made these cases result in user errors instead and updated the docs accordingly. |
e665cee to
824f2a4
Compare
|
Why aren't absolute paths allowed in install stanzas? They're allowed in dependency specifications. |
|
It would also be good to separate all the absolute paths business into a separate PR. |
Just because currently they cause dune to crash. |
src/dune_rules/glob_files.ml
Outdated
| >>| List.map ~f:(replace_path_dir relative_dir)) | ||
| >>| List.sort ~compare:String.compare | ||
|
|
||
| let expand_memo t ~f ~base_dir = |
There was a problem hiding this comment.
This function looks awfully similar, can we only keep one if possible?
There was a problem hiding this comment.
I've had a go at combining them with a functor, and added a Glob_file.Expand signature to avoid repetition in the interface. Can you take a look and tell me if there's too much indirection for it to be readable? It's non-trivial because it needs to generalize over the Memo.t and Action_builder.t type constructors. Is there are more ergonomic way of doing this than what I've come up with? I tried to simplify it with first-class modules but ran into an issue because I couldn't access internal parameterized types of first-class modules in function signatures.
b77396d to
e954fbb
Compare
Agreed. I've opened #6331 and rebased this PR on top. |
5a81874 to
09a3ef3
Compare
09a3ef3 to
c4686f2
Compare
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
c4686f2 to
e7dead3
Compare
|
Merged after a few cosmetic changes and simplifications. Thanks. |
* main: feature: glob_files to (install (files ...)) (ocaml#6250)
…ne-site, dune-rpc, dune-rpc-lwt, dune-private-libs, dune-glob, dune-configurator, dune-build-info, dune-action-plugin and chrome-trace (3.6.0) CHANGES: - Forbid multiple instances of dune running concurrently in the same workspace. (ocaml/dune#6360, fixes ocaml/dune#236, @rgrinberg) - Allow promoting into source directories specified by `subdir` (ocaml/dune#6404, fixes ocaml/dune#3502, @rgrinberg) - Make dune describe workspace return the correct root path (ocaml/dune#6380, fixes ocaml/dune#6379, @esope) - Introduce a `$ dune ocaml top-module` subcommand to load modules directly without sealing them behind the signature. (ocaml/dune#5940, @rgrinberg) - [ctypes] do not mangle user written names in the ctypes stanza (ocaml/dune#6374, fixes ocaml/dune#5561, @rgrinberg) - Support `CLICOLOR` and `CLICOLOR_FORCE` to enable/disable/force ANSI colors. (ocaml/dune#6340, fixes ocaml/dune#6323, @MisterDA). - Forbid private libraries with `(package ..)` set from depending on private libraries that don't belong to a package (ocaml/dune#6385, fixes ocaml/dune#6153, @rgrinberg) - Allow `Byte_complete` binaries to be installable (ocaml/dune#4873, @AltGr, @rgrinberg) - Revive `$ dune external-lib-deps` under `$ dune describe external-lib-deps`. (ocaml/dune#6045, @moyodiallo) - Fix running inline tests in bytecode mode (ocaml/dune#5622, fixes ocaml/dune#5515, @dariusf) - [ctypes] always re-run `pkg-config` because we aren't tracking its external dependencies (ocaml/dune#6052, @rgrinberg) - [ctypes] remove dependency on configurator in the generated rules (ocaml/dune#6052, @rgrinberg) - Build progress status now shows number of failed jobs (ocaml/dune#6242, @Alizter) - Allow absolute build directories to find public executables. For example, those specified with `(deps %{bin:...})` (ocaml/dune#6326, @anmonteiro) - Create a fake socket file `_build/.rpc/dune` on windows to allow rpc clients to connect using the build directory. (ocaml/dune#6329, @rgrinberg) - Prevent crash if absolute paths are used in the install stanza and in recursive globs. These cases now result in a user error. (ocaml/dune#6331, @gridbugs) - Add `(glob_files <glob>)` and `(glob_files_rec <glob>)` terms to the `files` field of the `install` stanza (ocaml/dune#6250, closes ocaml/dune#6018, @gridbugs) - Allow `:standard` in the `(modules)` field of the `coq.pp` stanza (ocaml/dune#6229, fixes ocaml/dune#2414, @Alizter) - Fix passing of flags to dune coq top (ocaml/dune#6369, fixes ocaml/dune#6366, @Alizter) - Extend the promotion CLI to a `dune promotion` group: `dune promote` is moved to `dune promotion apply` (the former still works) and the new `dune promotion diff` command can be used to just display the promotion without applying it. (ocaml/dune#6160, fixes ocaml/dune#5368, @emillon)
Closes #6018