You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src contains a library and examples example applications. If I go to the examples directory and issue a build command from there (e.g. from an editor), an error in example foo.ml would be reported using location examples/foo.ml. This is a problem for inferring correct error locations. The editor does not know where the root of this path is, because we are in a (potentially even deeper) subdirectory.
Could you please print the absolute path of the root for error messages for a particular build when jbuilder is invoked so editors can infer the correct path? E.g. Vim allows you to pattern match on the build output to keep track of directory stacks for correct errors locations. A somewhat unique string should be used to correctly identify this location message, preferably an existing make-like Entering directory message that Vim or Emacs already understand.
Yes, something like that would work. I don't think it would be a good idea to have everybody write their own editor scripts for how jbuilder determines build roots or maybe even changes directories during build operations.
It's not a big deal. Various messages can coexist. You can choose your own, maybe something like jbuilder root is ....
I'm not sure how jbuilder works, but it would certainly be necessary to never change directories if different directories are built in parallel. All paths would have to start at the root to avoid confusing editors.
The handling of C-files makes things more complicated then. Since you presumably build them in parallel, I guess the best way would be to only print the directory change right before emitting an error message, making sure that there is no race condition that could insert another message between the directory change message and the error message.
I'm not sure (cd <dir> && ...) is unique enough. There may also be a chance that the S-expression pretty printer, if it's being used here, will break lines, which makes pattern matching in editors more difficult.
The standard way of launching a build system in Emacs is M-x compile, usually bound to C-c C-c.
Unless there is a strong motivation, it would be better to keep the sentence Entering directory '<dir>' — you can put anything you want before it but it must end the line —, otherwise editors will need to be told about it.
Another possibility (which I'm not particularly fond of) is to invoke OCaml compilers with absolute file names, the errors will then contain the full path and links to errors will work.
jbuilder now prints directory changes, but the format does not match the patterns typically defined in Vim configurations for make. E.g. it prints:
Entering directory '...'
But most Vim errorformat configurations would expect something like the following:
jbuilder: Entering directory `...'
This would require the following changes:
Print jbuilder: before Entering directory to indicate the build tool.
Use a backtick to open the quoted directory (keep the regular tick at the end).
I have updated my personal (public) OCaml Vim configuration to support both kinds of ticks, which is what other configurations do now, too. GNU make is apparently switching to saner quoting. But it would help if jbuilder stayed compatible with legacy make error formats.
But it would help if jbuilder stayed compatible with legacy make error formats.
The format that jbuilder is currently using is the output used by gnu make since 4.0 (2013). Editors have been updated (for example four years ago for emacs).
Even if gnu make 4.0 had been adopted slowly it is now. So I don't want jbuilder to support an old format that is deprecated.
I agree about not supporting deprecated formats but @mmottl has a point when he says that the line is still prefixed by make: (hence, here, jbuilder:). Emacs is not sensitive to that but Vim may be.
Activity
mmottl commentedon Jun 12, 2017
Yes, something like that would work. I don't think it would be a good idea to have everybody write their own editor scripts for how
jbuilderdetermines build roots or maybe even changes directories during build operations.bobot commentedon Jun 13, 2017
Instead of an option that should be added manually, can't jbuilder always print
Entering "<absolute path>"when it is not the current directory?PS: I personally use projectile, where projectile-compile run the command where the .git is.
mmottl commentedon Jun 13, 2017
It's not a big deal. Various messages can coexist. You can choose your own, maybe something like
jbuilder root is ....I'm not sure how
jbuilderworks, but it would certainly be necessary to never change directories if different directories are built in parallel. All paths would have to start at the root to avoid confusing editors.mmottl commentedon Jun 14, 2017
Btw., if anybody needs a quickfix for now when building from within a subdirectory of the root, just create a
Makefilecontaining e.g.:Then a simple call to
makeshould do what you want.mmottl commentedon Jun 15, 2017
The handling of C-files makes things more complicated then. Since you presumably build them in parallel, I guess the best way would be to only print the directory change right before emitting an error message, making sure that there is no race condition that could insert another message between the directory change message and the error message.
I'm not sure
(cd <dir> && ...)is unique enough. There may also be a chance that the S-expression pretty printer, if it's being used here, will break lines, which makes pattern matching in editors more difficult.Chris00 commentedon Aug 19, 2017
The standard way of launching a build system in Emacs is
M-x compile, usually bound to C-c C-c.Unless there is a strong motivation, it would be better to keep the sentence
Entering directory '<dir>'— you can put anything you want before it but it must end the line —, otherwise editors will need to be told about it.Another possibility (which I'm not particularly fond of) is to invoke OCaml compilers with absolute file names, the errors will then contain the full path and links to errors will work.
mmottl commentedon Nov 26, 2017
jbuildernow prints directory changes, but the format does not match the patterns typically defined in Vim configurations formake. E.g. it prints:But most Vim
errorformatconfigurations would expect something like the following:This would require the following changes:
jbuilder:beforeEntering directoryto indicate the build tool.I have updated my personal (public) OCaml Vim configuration to support both kinds of ticks, which is what other configurations do now, too. GNU make is apparently switching to saner quoting. But it would help if
jbuilderstayed compatible with legacymakeerror formats.bobot commentedon Nov 27, 2017
The format that jbuilder is currently using is the output used by gnu make since 4.0 (2013). Editors have been updated (for example four years ago for emacs).
Even if gnu make 4.0 had been adopted slowly it is now. So I don't want jbuilder to support an old format that is deprecated.
Chris00 commentedon Nov 27, 2017
I agree about not supporting deprecated formats but @mmottl has a point when he says that the line is still prefixed by
make:(hence, here,jbuilder:). Emacs is not sensitive to that but Vim may be.bobot commentedon Nov 27, 2017
Indeed I forget to say that I don't see any problem for the first point.
10 remaining items
Print "Leaving directory '...'" in addition to "Entering directory ..."
cpitclaudel commentedon Feb 1, 2020
Done (roughly 4 months later 🎉) in #3072
fix: print "Leaving Directory"
fix: print "Leaving Directory"
fix: print "Leaving Directory"
fix: print "Leaving Directory"
fix: print "Leaving Directory"
fix: print "Leaving Directory"
fix: print "Leaving Directory"
fix: print "Leaving Directory"
fix: print "Leaving Directory" (#6419)
[new release] xdg, stdune, ordering, ocamlc-loc, dyn, dune, dune-site…
[new release] xdg, stdune, ordering, ocamlc-loc, dyn, dune, dune-site…
makefile: --no-print-directory is needed for OCaml's error messages