-
Notifications
You must be signed in to change notification settings - Fork 407
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
Fix workspace lookup in conjunction with --root #997
Conversation
@@ -25,7 +25,8 @@ analogously, jbuilder will ignore it | |||
specifying the workspace file is possible: | |||
|
|||
$ dune build --root custom-workspace --workspace custom-workspace/dune-workspace.dev | |||
Error: workspace file custom-workspace/dune-workspace.dev does not exist | |||
File "/Users/rgrinberg/reps/dune/_build/default/test/blackbox-tests/test-cases/workspaces/custom-workspace/dune-workspace.dev", line 2, characters 10-24: |
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.
This contains an absolute path
Do we have the same issue for the |
Ah yeah. This would be an issue for any of these file arguments. |
BTW, this is not a big breaking change. The |
One slightly annoying thing about this is that we still need to save the original string for dumping |
@diml you can see the last commit where I did this. |
bin/main.ml
Outdated
@@ -189,6 +188,11 @@ let find_root () = | |||
let package_name = | |||
Arg.conv ((fun p -> Ok (Package.Name.of_string p)), Package.Name.pp) | |||
|
|||
let path_arg = |
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.
What about:
module Arg = struct
include Arg
let file = ...
end
?
Just to make sure we don't use the wrong combinator.
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.
Sure, that makes sense. And the original args issue?
I suppose the type can be |
Should we try and bring it back? The current orig_args is quite janky anyway. For example, it will not recall the original --build-dir in the execution. |
I suppose we can. The current method is painful and I believe there are regression test for the original issues. |
The workspace is specified to the initial CWD hence we must convert it a path relative to it Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This path argument will take paths relatively to the initial CWD Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Hmm, yeah the original args are no good because you have to parse out the subcommand out of them. Not very pleasant. I will do your approach and just maintain the original string as well. |
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
6e352ae
to
f9c1d56
Compare
@diml ready for another review. |
let conv = Arg.conv ((fun p -> Ok p), Format.pp_print_string) | ||
end | ||
|
||
let path = Path.conv |
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.
Can we have let file = path
as well? Just to make sure we don't use the wrong thing
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.
Done
So cmdliner requires that the subcommand is the first argument, so it might actually be ok. I think I didn't know that at the time |
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Hmm, yeah. Might be worth trying another time. With things like exec, we also need to remove everything after and including |
CHANGES: - Fix lookup of command line specified files when `--root` is given. Previously, passing in `--root` in conjunction with `--workspace` or `--config` would not work correctly (ocaml/dune#997, @rgrinberg) - Add support for customizing env nodes in workspace files. The `env` stanza is now allowed in toplevel position in the workspace file, or for individual contexts. This feature requires `(dune lang 1.1)` (ocaml/dune#1038, @rgrinberg) - Add `enabled_if` field for aliases and tests. This field controls whether the test will be ran using a boolean expression language. (ocaml/dune#819, @rgrinberg) - Make `name`, `names` fields optional when a `public_name`, `public_names` field is provided. (ocaml/dune#1041, fix ocaml/dune#1000, @rgrinberg) - Interpret `X` in `--libdir X` as relative to `PREFIX` when `X` is relative (ocaml/dune#1072, fix ocaml/dune#1070, @diml) - Add support for multi directory libraries by writing `(include_subdirs unqualified)` (ocaml/dune#1034, @diml) - Add `(staged_pps ...)` to support staged ppx rewriters such as ones using the OCaml typer like `ppx_import` (ocaml/dune#1080, fix ocaml/dune#193, @diml) - Use `-opaque` in the `dev` profile. This option trades off binary quality for compilation speed when compiling .cmx files. (ocaml/dune#1079, fix ocaml/dune#1058, @rgrinberg) - Fix placeholders in `dune subst` documentation (ocaml/dune#1090, @emillon, thanks @trefis for the bug report) - Add locations to errors when a missing binary in PATH comes from a dune file (ocaml/dune#1096, fixes ocaml/dune#1095, @rgrinberg)
The workspace is specified to the initial CWD hence we must convert it a path
relative to it
Not sure if we should include this in 1.0 or not. But if this doesn't make it to 1.0 then it will need a CHANGELOG entry.