tycho
tycho copied to clipboard
tycho-compiler-plugin dropping part of compiler output
I'm debugging some failing builds related to failure of compiler to see some imports so I put this in my pom
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
and hoped I will get the output from compiler to tell me exactly what files it is looking at e.g.
[parsing .../common/preferences/MyPreferences.java - #1/38]
[parsing .../common/util/JsonUtils.java - #2/38]
...
[reading org/eclipse/e4/core/contexts/IEclipseContext.class]
[analyzing .../common/preferences/MyPreferences.java - #1/38]
...
but these were not printed at all.
Turns out this is because JDTCompiler
only preserves stderr, not stdout of the compiler https://github.com/eclipse/tycho/blob/master/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java#L373
So what I'd like it to do is give me both, preferably interleaved in original order, something like this:
CompilerResult compileInProcess(String[] args, CompilerConfiguration config, CustomCompilerConfiguration custom)
throws CompilerException {
StringWriter outErr = new StringWriter();
PrintWriter printOutErr = new PrintWriter(outErr)
Main compiler = new Main(printOutErr, printOutErr, false, null, null);
...
try {
String output = outErr.toString();
Was there some reason behind dropping stdout or is this simply an oversight? Would you be willing to accept a PR for printing output of the compiler like this?
@vaclavHala You can prepare a PR and report back if it fixes your issues. If it is considered a breaking change, we are about to prepare for tycho 3.0 and could even include breaking changes there.
One could even thing about an <extraVerbose>
flag.
@vaclavHala do you like to propose a patch with an <extraVerbose>
flag added?
Instead of an extra flag, Verbose level should be turned into an enum.
Sorry for no activity on this from me. I got my original problem fixed and then had to move to other non-tycho things so I did not manage to put together a worthy PR with tests and all. I changed the output printing in a very similar way to what I proposed, can be found here https://github.com/vaclavHala/tycho/commit/1a4fe2eedbdb1bb8548efbe8028bcd594372df9e . I plan to prepare the full PR next time I'm doing some work on our tycho build.
@vaclavHala we are preparing a 2.7.1 bugfix release, so if you think there is an issue please let us know so this might be included.