more logging for compiler tests

This commit is contained in:
Eugene Zhuravlev
2011-02-14 11:57:03 +01:00
parent fc9e50460c
commit bf40e70a51
3 changed files with 16 additions and 2 deletions
@@ -92,7 +92,7 @@ import java.util.*;
public class CompileDriver {
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileDriver");
// to be used in tests only for debug output
public static boolean ourDebugMode = false;
public static volatile boolean ourDebugMode = false;
private final Project myProject;
private final Map<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> myGenerationCompilerModuleToOutputDirMap; // [IntermediateOutputCompiler, Module] -> [ProductionSources, TestSources]
@@ -16,11 +16,12 @@
package com.intellij.compiler.impl.javaCompiler;
import com.intellij.compiler.OutputParser;
import com.intellij.compiler.impl.CompileDriver;
import com.intellij.compiler.make.CacheCorruptedException;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.compiler.CompilerMessageCategory;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.SpinAllocator;
import com.intellij.util.StringBuilderSpinAllocator;
import org.jetbrains.annotations.NonNls;
@@ -107,6 +108,9 @@ public class CompilerParsingThread implements Runnable, OutputParser.Callback {
if (LOG.isDebugEnabled()) {
LOG.debug("LIne read: #" + line + "#");
}
if (CompileDriver.ourDebugMode) {
System.out.println("LIne read: #" + line + "#");
}
if (TERMINATION_STRING.equals(line)) {
myLastReadLine = null;
}
@@ -24,6 +24,7 @@ package com.intellij.compiler.impl.javaCompiler;
import com.intellij.compiler.CompilerConfiguration;
import com.intellij.compiler.CompilerConfigurationImpl;
import com.intellij.compiler.CompilerException;
import com.intellij.compiler.impl.CompileDriver;
import com.intellij.compiler.make.CacheCorruptedException;
import com.intellij.openapi.compiler.*;
import com.intellij.openapi.compiler.ex.CompileContextEx;
@@ -61,13 +62,22 @@ public class JavaCompiler implements TranslatingCompiler {
final BackendCompiler backEndCompiler = getBackEndCompiler();
final BackendCompilerWrapper wrapper = new BackendCompilerWrapper(moduleChunk, myProject, Arrays.asList(files), (CompileContextEx)context, backEndCompiler, sink);
try {
if (CompileDriver.ourDebugMode) {
System.out.println("Starting java compiler; with backend compiler: " + backEndCompiler.getClass().getName());
}
wrapper.compile();
}
catch (CompilerException e) {
if (CompileDriver.ourDebugMode) {
e.printStackTrace();
}
context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
LOG.info(e);
}
catch (CacheCorruptedException e) {
if (CompileDriver.ourDebugMode) {
e.printStackTrace();
}
LOG.info(e);
context.requestRebuildNextTime(e.getMessage());
}