As per my previous question (Cannot link to BuildManagerListener - #10 by arcnor) I’ve managed to add a listener to builds starting and ending on CLion, but I need to fetch the compilation logs from said event (all that’s inside the “Messages” tab, basically). Does anybody know how to fetch those?
My best guess is that I need to get hold of a com.jetbrains.cidr.lang.workspace.CompilerTaskResult instance, but I don’t know how to get it, nor I do know if this is indeed the correct way to do it.
unfortunately, we don’t currently have a generic way for you to do this.
If you are fine with supporting only CMake, you can take a look at the EP com.intellij.cmake.buildStep to implement CMakeBuildProcessListenerCreator. You can add your own ProcessListener and override its onTextAvailable.
We are most likely going to decouple this from CMake soon to make it available for the other build-systems as well.
While we do that, you could query for the “Messages” toolwindow directly (ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);) and you could try to grab all the text in one go from there (e.g. in CidrBuildListener.afterFinished).
When you say a “generic” way you mean there is no way even only for CLion?
I think I’m fine doing it for CMake only at this stage but will be nice to have it generic of course. I’ll try fetching the results from the Messages window as well, that’s probably helpful (unless it does a copy, because logs can be big…), thanks!