-
Notifications
You must be signed in to change notification settings - Fork 452
Looking up paths to executables with dune describe location
#11905
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
Conversation
|
Here's an example session using this command: |
a574375 to
6e42f8b
Compare
|
Is this essentially |
|
It is, yes, but I bet a lot of people don't know you can expand pforms like that (for example I did not know this). |
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.
I think it is a very cool feature. In fact, I would actually suggest making a dune which top level command, as dune exec --which is a flag I will immediately forget and it is fairly obscure and does not actually execute the command.
6e42f8b to
e143dff
Compare
|
Updated this so that the command is now |
f59a49b to
985c96c
Compare
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.
Except for some minor cleanup I think this is nearly done. I really like the cram test!
|
Maybe this should go under |
|
Why is the expected frequency with which a command will be used a useful metric for deciding whether to put it at the top level or not? I think it belongs at the top level because I expect this command to be used by people debugging a situation where dune ran a command they didn't expect, and for this use case it's important that the command be easy to discover. |
63981ae to
79e5ff2
Compare
|
There are other commands under The point of having a hierarchical command line is to make the commands more discoverable. If putting things under sub-commands made the CLI less discoverable, why did we introduce the hierarchy in the first place? Dune is not like git where sub-commands are their own binaries, so it was done for purely organizational purposes. IMO, the underlying issue is that the "discoverability" of one command comes at the expense of other commands. So yes, you have made Now it could be that I'm underestimating the utility of this command, and it is going to be more useful than I'm imagning - I'll leave the decision where to put it up to you. But I do want to clarify that:
Is the principle we should be following. We hide scarcely used commands, and promote the ones that are often used. We group related sub-commands to avoid repeating prefixes. We optimize for the common case. |
|
For what it's worth, something like |
|
Updated so that the command is now |
dune describe location
ed38ba5 to
b07dcdf
Compare
The "dune exec" command has three different ways of resolving the names of executables to paths to executables: - public executables defined in the current project - executables in the "bin" directories of dependencies - executables in directories listed in $PATH This can lead to unexpected shadowing, especially in the case of executables from dependecies, as users may not be aware that one of the packages in their project's dependency cone defines an executable with the same name of an executable that's also insalled system-wide. Short of fixing the problem for now, this change introduces a tool for helping investigate specifically which executable will be run by "dune exec". This adds a command "dune describe location" which prints the path to the executable. Signed-off-by: Stephen Sherratt <[email protected]>
Signed-off-by: Marek Kubica <[email protected]>
b07dcdf to
7cd0554
Compare
CHANGES: ### Fixed - Stop re-running cram tests after promotion when it's not necessary (ocaml/dune#11994, @rgrinberg) - fix: `$ dune subst` should not fail when adding the version field in opam files (ocaml/dune#11801, fixes ocaml/dune#11045, @btjorge) - Kill all processes in the process group after the main process has terminated; in particular this avoids background processes in cram tests to stick around after the test finished (ocaml/dune#11841, fixes ocaml/dune#11820, @Alizter, @Leonidas-from-XIV) ### Added - `(tests)` stanzas now generate aliases with the test name. To run `(test (name a))` you can do `dune build @runtest-a`. (ocaml/dune#11558, grants part of ocaml/dune#10239, @Alizter) - Inline test libraries now produce aliases `runtest-name_of_lib` allowing users to run specific inline tests as `dune build @runtest-name_of_lib`. (ocaml/dune#11109, partially fixes ocaml/dune#10239, @Alizter) - feature: `$ dune subst` use version from `dune-project` when no version control repository has been detected (ocaml/dune#11801, @btjorge) - Allow `dune exec` to run concurrently with another instance of dune in watch mode (ocaml/dune#11840, @gridbugs) - Introduce `%{os}`, `%{os_version}`, `%{os_distribution}`, and `%{os_family}` percent forms. These have the same values as their opam counterparts. (ocaml/dune#11863, @rgrinberg) - Introduce option `(implicit_transitive_deps false-if-hidden-includes-supported)` that is equivalent to `(implicit_transitive_deps false)` when `-H` is supported by the compiler (OCaml >= 5.2) and equivalent to `(implicit_transitive_deps true)` otherwise. (ocaml/dune#11866, fixes ocaml/dune#11212, @nojb) - Add `dune describe location` for printing the path to the executable that would be run (ocaml/dune#11905, @gridbugs) - `dune runtest` can now understand absolute paths as well as run tests in specific build contexts (ocaml/dune#11936, @Alizter). - Added 'empty' alias which contains no targets. (ocaml/dune#11556 ocaml/dune#11952 ocaml/dune#11955 ocaml/dune#11956, grants ocaml/dune#4161, @Alizter and @rgrinberg) - Allow `dune promote` to properly run while a watch mode server is running (ocaml/dune#12010, @ElectreAAS) - Add `--alias` and `--alias-rec` flags as an alternative to the `@` and `@@` syntax in the command line (ocaml/dune#12043, fixes ocaml/dune#5775, @rgrinberg) ### Changed - Format long lists in s-expressions to fill the line instead of formatting them in a vertical way (ocaml/dune#10892, fixes ocaml/dune#10860, @nojb) - Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more performant and difficult to break than MD5 (ocaml/dune#11735, @rgrinberg, @Alizter) - Print a warning when `dune build` runs over RPC (ocaml/dune#11836, @gridbugs) - Stop emitting empty module group wrapper `.js` file in `melange.emit` (ocaml/dune#11987, fixes ocaml/dune#11986, @anmonteiro)
CHANGES: ### Fixed - Stop re-running cram tests after promotion when it's not necessary (ocaml/dune#11994, @rgrinberg) - fix: `$ dune subst` should not fail when adding the version field in opam files (ocaml/dune#11801, fixes ocaml/dune#11045, @btjorge) - Kill all processes in the process group after the main process has terminated; in particular this avoids background processes in cram tests to stick around after the test finished (ocaml/dune#11841, fixes ocaml/dune#11820, @Alizter, @Leonidas-from-XIV) ### Added - `(tests)` stanzas now generate aliases with the test name. To run `(test (name a))` you can do `dune build @runtest-a`. (ocaml/dune#11558, grants part of ocaml/dune#10239, @Alizter) - Inline test libraries now produce aliases `runtest-name_of_lib` allowing users to run specific inline tests as `dune build @runtest-name_of_lib`. (ocaml/dune#11109, partially fixes ocaml/dune#10239, @Alizter) - feature: `$ dune subst` use version from `dune-project` when no version control repository has been detected (ocaml/dune#11801, @btjorge) - Allow `dune exec` to run concurrently with another instance of dune in watch mode (ocaml/dune#11840, @gridbugs) - Introduce `%{os}`, `%{os_version}`, `%{os_distribution}`, and `%{os_family}` percent forms. These have the same values as their opam counterparts. (ocaml/dune#11863, @rgrinberg) - Introduce option `(implicit_transitive_deps false-if-hidden-includes-supported)` that is equivalent to `(implicit_transitive_deps false)` when `-H` is supported by the compiler (OCaml >= 5.2) and equivalent to `(implicit_transitive_deps true)` otherwise. (ocaml/dune#11866, fixes ocaml/dune#11212, @nojb) - Add `dune describe location` for printing the path to the executable that would be run (ocaml/dune#11905, @gridbugs) - `dune runtest` can now understand absolute paths as well as run tests in specific build contexts (ocaml/dune#11936, @Alizter). - Added 'empty' alias which contains no targets. (ocaml/dune#11556 ocaml/dune#11952 ocaml/dune#11955 ocaml/dune#11956, grants ocaml/dune#4161, @Alizter and @rgrinberg) - Allow `dune promote` to properly run while a watch mode server is running (ocaml/dune#12010, @ElectreAAS) - Add `--alias` and `--alias-rec` flags as an alternative to the `@@` and `@` syntax in the command line (ocaml/dune#12043, fixes ocaml/dune#5775, @rgrinberg) - Added a `(timeout <float>)` field to the `(cram)` stanza to specify per-test time limits. Tests exceeding the timeout are terminated with an error. (ocaml/dune#12041, @Alizter) ### Changed - Format long lists in s-expressions to fill the line instead of formatting them in a vertical way (ocaml/dune#10892, fixes ocaml/dune#10860, @nojb) - Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more performant and difficult to break than MD5 (ocaml/dune#11735, @rgrinberg, @Alizter) - Print a warning when `dune build` runs over RPC (ocaml/dune#11833, @gridbugs) - Stop emitting empty module group wrapper `.js` file in `melange.emit` (ocaml/dune#11987, fixes ocaml/dune#11986, @anmonteiro)
CHANGES: ### Fixed - Stop re-running cram tests after promotion when it's not necessary (ocaml/dune#11994, @rgrinberg) - fix: `$ dune subst` should not fail when adding the version field in opam files (ocaml/dune#11801, fixes ocaml/dune#11045, @btjorge) - Kill all processes in the process group after the main process has terminated; in particular this avoids background processes in cram tests to stick around after the test finished (ocaml/dune#11841, fixes ocaml/dune#11820, @Alizter, @Leonidas-from-XIV) ### Added - `(tests)` stanzas now generate aliases with the test name. To run `(test (name a))` you can do `dune build @runtest-a`. (ocaml/dune#11558, grants part of ocaml/dune#10239, @Alizter) - Inline test libraries now produce aliases `runtest-name_of_lib` allowing users to run specific inline tests as `dune build @runtest-name_of_lib`. (ocaml/dune#11109, partially fixes ocaml/dune#10239, @Alizter) - feature: `$ dune subst` use version from `dune-project` when no version control repository has been detected (ocaml/dune#11801, @btjorge) - Allow `dune exec` to run concurrently with another instance of dune in watch mode (ocaml/dune#11840, @gridbugs) - Introduce `%{os}`, `%{os_version}`, `%{os_distribution}`, and `%{os_family}` percent forms. These have the same values as their opam counterparts. (ocaml/dune#11863, @rgrinberg) - Introduce option `(implicit_transitive_deps false-if-hidden-includes-supported)` that is equivalent to `(implicit_transitive_deps false)` when `-H` is supported by the compiler (OCaml >= 5.2) and equivalent to `(implicit_transitive_deps true)` otherwise. (ocaml/dune#11866, fixes ocaml/dune#11212, @nojb) - Add `dune describe location` for printing the path to the executable that would be run (ocaml/dune#11905, @gridbugs) - `dune runtest` can now understand absolute paths as well as run tests in specific build contexts (ocaml/dune#11936, @Alizter). - Added 'empty' alias which contains no targets. (ocaml/dune#11556 ocaml/dune#11952 ocaml/dune#11955 ocaml/dune#11956, grants ocaml/dune#4161, @Alizter and @rgrinberg) - Allow `dune promote` to properly run while a watch mode server is running (ocaml/dune#12010, @ElectreAAS) - Add `--alias` and `--alias-rec` flags as an alternative to the `@@` and `@` syntax in the command line (ocaml/dune#12043, fixes ocaml/dune#5775, @rgrinberg) - Added a `(timeout <float>)` field to the `(cram)` stanza to specify per-test time limits. Tests exceeding the timeout are terminated with an error. (ocaml/dune#12041, @Alizter) ### Changed - Format long lists in s-expressions to fill the line instead of formatting them in a vertical way (ocaml/dune#10892, fixes ocaml/dune#10860, @nojb) - Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more performant and difficult to break than MD5 (ocaml/dune#11735, @rgrinberg, @Alizter) - Print a warning when `dune build` runs over RPC (ocaml/dune#11833, @gridbugs) - Stop emitting empty module group wrapper `.js` file in `melange.emit` (ocaml/dune#11987, fixes ocaml/dune#11986, @anmonteiro)
CHANGES: ### Fixed - Stop re-running cram tests after promotion when it's not necessary (ocaml/dune#11994, @rgrinberg) - fix: `$ dune subst` should not fail when adding the version field in opam files (ocaml/dune#11801, fixes ocaml/dune#11045, @btjorge) - Kill all processes in the process group after the main process has terminated; in particular this avoids background processes in cram tests to stick around after the test finished (ocaml/dune#11841, fixes ocaml/dune#11820, @Alizter, @Leonidas-from-XIV) ### Added - `(tests)` stanzas now generate aliases with the test name. To run `(test (name a))` you can do `dune build @runtest-a`. (ocaml/dune#11558, grants part of ocaml/dune#10239, @Alizter) - Inline test libraries now produce aliases `runtest-name_of_lib` allowing users to run specific inline tests as `dune build @runtest-name_of_lib`. (ocaml/dune#11109, partially fixes ocaml/dune#10239, @Alizter) - feature: `$ dune subst` use version from `dune-project` when no version control repository has been detected (ocaml/dune#11801, @btjorge) - Allow `dune exec` to run concurrently with another instance of dune in watch mode (ocaml/dune#11840, @gridbugs) - Introduce `%{os}`, `%{os_version}`, `%{os_distribution}`, and `%{os_family}` percent forms. These have the same values as their opam counterparts. (ocaml/dune#11863, @rgrinberg) - Introduce option `(implicit_transitive_deps false-if-hidden-includes-supported)` that is equivalent to `(implicit_transitive_deps false)` when `-H` is supported by the compiler (OCaml >= 5.2) and equivalent to `(implicit_transitive_deps true)` otherwise. (ocaml/dune#11866, fixes ocaml/dune#11212, @nojb) - Add `dune describe location` for printing the path to the executable that would be run (ocaml/dune#11905, @gridbugs) - `dune runtest` can now understand absolute paths as well as run tests in specific build contexts (ocaml/dune#11936, @Alizter). - Added 'empty' alias which contains no targets. (ocaml/dune#11556 ocaml/dune#11952 ocaml/dune#11955 ocaml/dune#11956, grants ocaml/dune#4161, @Alizter and @rgrinberg) - Allow `dune promote` to properly run while a watch mode server is running (ocaml/dune#12010, @ElectreAAS) - Add `--alias` and `--alias-rec` flags as an alternative to the `@@` and `@` syntax in the command line (ocaml/dune#12043, fixes ocaml/dune#5775, @rgrinberg) - Added a `(timeout <float>)` field to the `(cram)` stanza to specify per-test time limits. Tests exceeding the timeout are terminated with an error. (ocaml/dune#12041, @Alizter) ### Changed - Format long lists in s-expressions to fill the line instead of formatting them in a vertical way (ocaml/dune#10892, fixes ocaml/dune#10860, @nojb) - Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more performant and difficult to break than MD5 (ocaml/dune#11735, @rgrinberg, @Alizter) - Print a warning when `dune build` runs over RPC (ocaml/dune#11833, @gridbugs) - Stop emitting empty module group wrapper `.js` file in `melange.emit` (ocaml/dune#11987, fixes ocaml/dune#11986, @anmonteiro)
CHANGES: ### Fixed - Stop re-running cram tests after promotion when it's not necessary (ocaml/dune#11994, @rgrinberg) - fix: `$ dune subst` should not fail when adding the version field in opam files (ocaml/dune#11801, fixes ocaml/dune#11045, @btjorge) - Kill all processes in the process group after the main process has terminated; in particular this avoids background processes in cram tests to stick around after the test finished (ocaml/dune#11841, fixes ocaml/dune#11820, @Alizter, @Leonidas-from-XIV) ### Added - `(tests)` stanzas now generate aliases with the test name. To run `(test (name a))` you can do `dune build @runtest-a`. (ocaml/dune#11558, grants part of ocaml/dune#10239, @Alizter) - Inline test libraries now produce aliases `runtest-name_of_lib` allowing users to run specific inline tests as `dune build @runtest-name_of_lib`. (ocaml/dune#11109, partially fixes ocaml/dune#10239, @Alizter) - feature: `$ dune subst` use version from `dune-project` when no version control repository has been detected (ocaml/dune#11801, @btjorge) - Allow `dune exec` to run concurrently with another instance of dune in watch mode (ocaml/dune#11840, @gridbugs) - Introduce `%{os}`, `%{os_version}`, `%{os_distribution}`, and `%{os_family}` percent forms. These have the same values as their opam counterparts. (ocaml/dune#11863, @rgrinberg) - Introduce option `(implicit_transitive_deps false-if-hidden-includes-supported)` that is equivalent to `(implicit_transitive_deps false)` when `-H` is supported by the compiler (OCaml >= 5.2) and equivalent to `(implicit_transitive_deps true)` otherwise. (ocaml/dune#11866, fixes ocaml/dune#11212, @nojb) - Add `dune describe location` for printing the path to the executable that would be run (ocaml/dune#11905, @gridbugs) - `dune runtest` can now understand absolute paths as well as run tests in specific build contexts (ocaml/dune#11936, @Alizter). - Added 'empty' alias which contains no targets. (ocaml/dune#11556 ocaml/dune#11952 ocaml/dune#11955 ocaml/dune#11956, grants ocaml/dune#4161, @Alizter and @rgrinberg) - Allow `dune promote` to properly run while a watch mode server is running (ocaml/dune#12010, @ElectreAAS) - Add `--alias` and `--alias-rec` flags as an alternative to the `@@` and `@` syntax in the command line (ocaml/dune#12043, fixes ocaml/dune#5775, @rgrinberg) - Added a `(timeout <float>)` field to the `(cram)` stanza to specify per-test time limits. Tests exceeding the timeout are terminated with an error. (ocaml/dune#12041, @Alizter) ### Changed - Format long lists in s-expressions to fill the line instead of formatting them in a vertical way (ocaml/dune#10892, fixes ocaml/dune#10860, @nojb) - Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more performant and difficult to break than MD5 (ocaml/dune#11735, @rgrinberg, @Alizter) - Print a warning when `dune build` runs over RPC (ocaml/dune#11833, @gridbugs) - Stop emitting empty module group wrapper `.js` file in `melange.emit` (ocaml/dune#11987, fixes ocaml/dune#11986, @anmonteiro)
CHANGES: ### Fixed - Stop re-running cram tests after promotion when it's not necessary (ocaml/dune#11994, @rgrinberg) - fix: `$ dune subst` should not fail when adding the version field in opam files (ocaml/dune#11801, fixes ocaml/dune#11045, @btjorge) - Kill all processes in the process group after the main process has terminated; in particular this avoids background processes in cram tests to stick around after the test finished (ocaml/dune#11841, fixes ocaml/dune#11820, @Alizter, @Leonidas-from-XIV) ### Added - `(tests)` stanzas now generate aliases with the test name. To run `(test (name a))` you can do `dune build @runtest-a`. (ocaml/dune#11558, grants part of ocaml/dune#10239, @Alizter) - Inline test libraries now produce aliases `runtest-name_of_lib` allowing users to run specific inline tests as `dune build @runtest-name_of_lib`. (ocaml/dune#11109, partially fixes ocaml/dune#10239, @Alizter) - feature: `$ dune subst` use version from `dune-project` when no version control repository has been detected (ocaml/dune#11801, @btjorge) - Allow `dune exec` to run concurrently with another instance of dune in watch mode (ocaml/dune#11840, @gridbugs) - Introduce `%{os}`, `%{os_version}`, `%{os_distribution}`, and `%{os_family}` percent forms. These have the same values as their opam counterparts. (ocaml/dune#11863, @rgrinberg) - Introduce option `(implicit_transitive_deps false-if-hidden-includes-supported)` that is equivalent to `(implicit_transitive_deps false)` when `-H` is supported by the compiler (OCaml >= 5.2) and equivalent to `(implicit_transitive_deps true)` otherwise. (ocaml/dune#11866, fixes ocaml/dune#11212, @nojb) - Add `dune describe location` for printing the path to the executable that would be run (ocaml/dune#11905, @gridbugs) - `dune runtest` can now understand absolute paths as well as run tests in specific build contexts (ocaml/dune#11936, @Alizter). - Added 'empty' alias which contains no targets. (ocaml/dune#11556 ocaml/dune#11952 ocaml/dune#11955 ocaml/dune#11956, grants ocaml/dune#4161, @Alizter and @rgrinberg) - Allow `dune promote` to properly run while a watch mode server is running (ocaml/dune#12010, @ElectreAAS) - Add `--alias` and `--alias-rec` flags as an alternative to the `@@` and `@` syntax in the command line (ocaml/dune#12043, fixes ocaml/dune#5775, @rgrinberg) - Added a `(timeout <float>)` field to the `(cram)` stanza to specify per-test time limits. Tests exceeding the timeout are terminated with an error. (ocaml/dune#12041, @Alizter) ### Changed - Format long lists in s-expressions to fill the line instead of formatting them in a vertical way (ocaml/dune#10892, fixes ocaml/dune#10860, @nojb) - Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more performant and difficult to break than MD5 (ocaml/dune#11735, @rgrinberg, @Alizter) - Print a warning when `dune build` runs over RPC (ocaml/dune#11833, @gridbugs) - Stop emitting empty module group wrapper `.js` file in `melange.emit` (ocaml/dune#11987, fixes ocaml/dune#11986, @anmonteiro)
The "dune exec" command has three different ways of resolving the names of executables to paths to executables:
This can lead to unexpected shadowing, especially in the case of executables from dependecies, as users may not be aware that one of the packages in their project's dependency cone defines an executable with the same name of an executable that's also insalled system-wide.
Short of fixing the problem for now, this change introduces a tool for helping investigate specifically which executable will be run by "dune exec". This adds a command "dune which" which prints the path to the executable.