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
Add general option -output-directory #17392
Conversation
4e5c1e9
to
9eb1c17
Compare
Do we want to make the option agnostic to extraction ? |
9eb1c17
to
6309b5e
Compare
6309b5e
to
0b8844e
Compare
What do you mean? Isn't it already independent of extraction per se? |
@herbelin right but the option is still named extraction output directory? |
With this PR, there are two levels of options, one on the command line Is it confusing? If yes, we may also add, say |
8fdb07a
to
0b8844e
Compare
OK then I was just confused. |
The "needs: rebase" label was set more than 30 days ago. If the PR is not rebased in 30 days, it will be automatically closed. |
This PR was not rebased after 30 days despite the warning, it is now closed. |
Co-authored-by: Jim Fehrle <jim.fehrle@gmail.com>
86895f7
to
ec211db
Compare
I fixed in passing an issue with option |
@@ -96,3 +96,6 @@ val default_inline_level : int | |||
(** Global profile_ltac flag *) | |||
val profile_ltac : bool ref | |||
val profile_ltac_cutoff : float ref | |||
|
|||
(** Default output directory *) | |||
val output_directory : CUnix.physical_path option ref |
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.
IMO this should be in system.ml
(use point), not here.
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.
Why not. I will consider it.
sysinit/coqargs.ml
Outdated
@@ -382,6 +384,10 @@ let parse_args ~usage ~init arglist : t * string list = | |||
let native_output_dir = next () in | |||
{ oval with config = { oval.config with native_output_dir } } | |||
|
|||
|"-output-dir" | "-output-directory" -> | |||
let dir = CUnix.canonical_dir (next ()) in |
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 that messing with the directory the user provides is not a good idea. Why are you doing this?
For example, error messages won't contain the original directory, and the extra resolution may cause other issues.
IMHO this is a blocker for this PR.
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.
The motivation is to be robust over Cd
: it is more intuitive that a relative directory given on the command line is resolved relatively to the command line directory than dynamically depending on which Cd
s have done so far.
But the question of reporting an error is a good question. So maybe, what can be done is to keep the pair of both the relative output directory and of the directory in which the command has been launched??
boot/util.ml
Outdated
@@ -48,7 +48,7 @@ let use_suffix prefix suffix = | |||
then suffix | |||
else Filename.concat prefix suffix | |||
|
|||
let canonical_path_name p = | |||
let canonical_dir p = |
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.
Please don't do these kind of changes in unrelated PRs.
Due to the renaming extra noise, it took me much longer to review this PR, and I couldn't do as much of as precise job.
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.
Sorry about that, I should have told that the renaming is in a separate commit.
More generally, even with the renaming, I'm not fully satisfied by the terminology used in CUnix
. We should fix some naming conventions at some time.
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.
Yes, I didn't mean in a bad way (I hope it was clear, I was just writing a bit rushed)
It is just that the change could be merged already while we discuss the minor issue with path normalization.
I agree that it'd be great to do some CUnix refactoring, I'd suggest doing a small meeting of those interested and coming up with maybe a new design?
For example, I've found many useful patterns in other OCaml projects which are all about files (like dune
), we could also think of what's the right IO interface design for the lower layers of Coq, where IO is usually owned by the build system / doc manager.
@herbelin do you want to do some code changes in response to @ejgallego comments or is this ready? |
@SkySkimmer I think maybe we should avoid the Other than I think the PR is OK. |
If someone does Cd "baz".
Redirect "file" Check True. what should happen? The canonical_dir call IIUC is to make it write to |
The canonical_dir call is used to make the directory absolute, but it does a lot more stuff, for example will resolve hard and soft links. That second behavior is the problematic one, as user passes If What I propose is not to mess with [Note that we must handle absolute stuff for windows paths too, etc...] |
In the end I think the discussion just outlines that the businees of path / artifacts handling is complex (as we well known for example in Dune), an in general it is better for most of Coq to just have an interface so layers producing articats can inform the DM / build system, which is usually well-prepared to handle this kind of issues, as it has knowlegde about where files are (which coqc doesn't). |
We could do that as well. |
Can be used for example to choose the extraction output directory from the build system.
Co-authored-by: Jim Fehrle <jim.fehrle@gmail.com>
ec211db
to
28df7ec
Compare
I now moved the |
Co-authored-by: Jim Fehrle <jim.fehrle@gmail.com> Co-authored-by: Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>
Co-authored-by: Jim Fehrle <jim.fehrle@gmail.com>
28df7ec
to
9295b6a
Compare
@coqbot merge now |
Depends on, and refines #16126 (which added option
Set Extraction Output Directory
).This PR adds an option
-output-directory
(with worddirectory
in full to be consistent with using a full word in optionSet Extraction Output Directory
in #16126, and more generally with the general use of non-abbreviated words in commands) with synonym-output-dir
(to be consistent with other command line options such as-native-output-dir
).This option is used by default for extraction (when
Extraction Output Directory
is unset),Redirect "file"
, andPrint Universes "file"
when"file"
is not an absolute path.Together with #16126, this should provide:
Redirect
relatively to the repository where the.vo
file is outputCd
deprecate Cd command #16119 (or to replace it by an optionSet Output Directory
interactively mimicking-output-directory
, though this might not be what most developers would recommend)Closes #8649
Open questions:
Redirect
/Extraction
)?-redirect-output-directory
,-extraction-output-directory
?