When a compilation triggers several dependent projects to compile, bloop indicates how many source files are being compiled, and where they are being compiled to, but not which dependency they relate to. This would be very useful information, especially if you can't infer it from the destination (which is probably less interesting in many cases).
I would suggest prefixing the message with the project name, either in the form,
[project-name] Compiling n Scala sources...
or
project-name: Compiling n Scala sources...
I agree, I want this too. Unfortunately, it's not that easy...
These logs are printed by Zinc, and the project name is only known by Bloop. If we want to print this, we need to have a way to tell Zinc that the project that we compile is called X or a way to intercept this message, identify the project it comes from, and then replace it by the nice version.
This will most likely go into our Zinc fork, and if we get to have something nice that doesn't pollute Zinc's API, we can PR upstream.
What's more, I think that we should also print the compilation time. That would require replacing the cryptic "Done compiling" by "project-name: Compilation took 1.2s".
Ah, I see... not quite as easy as those tags I added! :(
Thanks for the detailed explanation.
I know this is far from ideal, but what about: https://github.com/tues/bloop/commit/c3669dd7893ced354f87cb49256814ce488e93db?
Seems to be working quite well:
$ bloop compile frontend
[backend] Compiling 14 Scala sources to .../bloop/.bloop/backend/scala-2.12/classes ...
[jsonConfig] Compiling 3 Scala sources to .../bloop/.bloop/jsonConfig/scala-2.12/classes ...
[backend] Done compiling.
[jsonConfig] Done compiling.
[frontend] Compiling 50 Scala sources to .../bloop/.bloop/frontend/scala-2.12/classes ...
[frontend] Done compiling.
Seems like a step in the right direction! It would be nice to have messages align vertically, but that's hardly more important than getting the information. :)
Yes, I'd love to have vertical alignment. I guess we could take the list of all projects, check what is the longest name and align to that. If I get a green light for using this ProjectLogger approach I will definitely try to improve it.
For now the biggest problem is with:
def trace(exception: Supplier[Throwable]): Unit = underlying.trace(exception.get)
because there's no easy way to prepend project name to that. The only way I can think of is something like:
def trace(exception: Supplier[Throwable]): Unit = {
underlying.error(prefix + "Exception:")
underlying.trace(exception.get)
}
but with multiple threads printing messages it won't help much. Alternatively, we could add a correlation ID or wrap the Throwable in another one... Actually, I think I like the idea of wrapping it in our own Throwable with a custom message. WDYT?
@tues Good observation, I also thought that duplicating the logger to contain the information of the project name would be a good way to solve this problem. However, I'm not sure we want to solve this problem by prepending to the logs. I feel that a better fix would be to let Zinc output "Compiling 'frontend': 50 Scala sources to..." and likewise for the rest of the projects.
The coupling of Bloop and Zinc will grow more over time, so I think this is a sensible choice. This solution will also solve the need for vertical alignment. I would very much prefer have the project name in bold than wasting terminal space at the beginning of every line :smile:.
This will be fixed when pipelined compilation is merged.
This is already possible, but I feel like we should probably implement our own pretty way of showing parallel compilation logs together with this change, similar to what buck does with the "Super Console" https://buckbuild.com/about/performance_tuning.html.
I'm going to remove this ticket from the v1.1.0 milestone and I'll work on these two features together.