Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add entering/leaving directory messages to build output
Ok, so here's the deal: with v2-build we can have multiple different package directories in one build. At the moment we always start GHC in the package directory with the paths to the sources being relative to that. GHC's error messages are going to copy those paths verbatim. Now when we have multiple packages in seperate directories, say: proj/ pkg-a/A.hs pkg-b/B.hs then error messages are juts going to mention "A.hs" or "B.hs" without the pkg-* prefix. So while this is kinda confusing for users that's not really the main problem. Editors (Emacs in my case) usually have a mode that parses compiler output to provide jump-to-error functionality. This usually relies on the paths in error messages being relative to the current directory of the editor or some such but we break this assumption with v2-build. It turns out we're not the first build-tool to have this problem, recursive make pretty much has the same problem and the "solution" there is to just print messages before and after starting a recursive instance of the build system in another directory. Editors already have support to parse these annotations so I'm just adding support to do that to cabal. Cabal's equivalent of the recursive make instance is Setup.hs/SetupWrapper which for v2 is always invoked through either 'buildInplaceUnpackedPackage' or 'buildAndInstallUnpackedPackage' so we add code there to print these messages. Together with the preceeding commit adding log linearizaton we can actually guarantee that the output will make sense to editors trying to parse it since it's as if we'd run with -j1, unlike the mess 'make' makes of things when concurrent builds are active!
- Loading branch information