mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
compiler extra logging
This commit is contained in:
@@ -257,7 +257,17 @@ public class CompileDriver {
|
||||
synchronized (CompilerManager.getInstance(myProject)) {
|
||||
ProgressManager.getInstance().runProcess(new Runnable() {
|
||||
public void run() {
|
||||
doCompile(compileContext, isRebuild, forceCompile, callback, checkCachesVersion);
|
||||
try {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("COMPILATION STARTED");
|
||||
}
|
||||
doCompile(compileContext, isRebuild, forceCompile, callback, checkCachesVersion);
|
||||
}
|
||||
finally {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("COMPILATION FINISHED");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, compileContext.getProgressIndicator());
|
||||
}
|
||||
@@ -838,7 +848,13 @@ public class CompileDriver {
|
||||
if (cache.isDirty()) {
|
||||
context.getProgressIndicator().setText("Saving caches...");
|
||||
if (cache.isDirty()) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("--Saving translating cache for compiler " + compiler.getDescription());
|
||||
}
|
||||
cache.save();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("--Done");
|
||||
}
|
||||
}
|
||||
}
|
||||
context.getProgressIndicator().popState();
|
||||
@@ -936,6 +952,9 @@ public class CompileDriver {
|
||||
public void run() {
|
||||
context.getProgressIndicator().setText("Updating caches...");
|
||||
final FileTypeManager typeManager = FileTypeManager.getInstance();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Updating internal caches: successfully compiled " + successfullyCompiled.length + " files; toRecompile: " + filesToRecompile.length + " files");
|
||||
}
|
||||
for (int idx = 0; idx < successfullyCompiled.length; idx++) {
|
||||
final TranslatingCompiler.OutputItem item = successfullyCompiled[idx];
|
||||
final String outputPath = item.getOutputPath();
|
||||
@@ -953,6 +972,9 @@ public class CompileDriver {
|
||||
else {
|
||||
className = null;
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Putting: [outputPath, className, sourceFile] = [" + outputPath + ";" + className + ";" + sourceFile.getPresentableUrl() + "]");
|
||||
}
|
||||
cache.update(outputPath, className, sourceFile);
|
||||
}
|
||||
for (int idx = 0; idx < filesToRecompile.length; idx++) {
|
||||
@@ -1019,6 +1041,10 @@ public class CompileDriver {
|
||||
}
|
||||
}
|
||||
if (forceCompile || file.getTimeStamp() != cache.getSourceTimestamp(snapshot.getUrlByFile(file))) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
final String url = snapshot.getUrlByFile(file);
|
||||
LOG.debug("File is out-of-date: " + url + "; current timestamp = " + file.getTimeStamp() + "; stored timestamp = " + cache.getSourceTimestamp(url));
|
||||
}
|
||||
toCompile.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ public class TimestampCache extends StateCache <Long> {
|
||||
|
||||
public void update(String url, Long state) {
|
||||
LOG.assertTrue(state != null);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("TimestampCache.update: " + url + "; " + state);
|
||||
}
|
||||
super.update(url, state);
|
||||
}
|
||||
|
||||
@@ -30,4 +33,41 @@ public class TimestampCache extends StateCache <Long> {
|
||||
public void write(Long aLong, DataOutputStream stream) throws IOException {
|
||||
stream.writeLong(aLong.longValue());
|
||||
}
|
||||
|
||||
protected boolean load() {
|
||||
final boolean notInitialized = (myMap == null);
|
||||
if (LOG.isDebugEnabled() && notInitialized) {
|
||||
LOG.debug("TimestampCache.load");
|
||||
}
|
||||
try {
|
||||
return super.load();
|
||||
}
|
||||
finally {
|
||||
if (LOG.isDebugEnabled() && notInitialized) {
|
||||
LOG.debug("TimestampCache.loaded: " + (myMap != null? myMap.size() + " items" : "empty map"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
if (LOG.isDebugEnabled() && myMap != null) {
|
||||
LOG.debug("TimestampCache.save");
|
||||
}
|
||||
super.save();
|
||||
}
|
||||
|
||||
public boolean wipe() {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("TimestampCache.wipe");
|
||||
}
|
||||
return super.wipe();
|
||||
}
|
||||
|
||||
public void remove(final String url) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("TimestampCache.remove: " + url);
|
||||
}
|
||||
super.remove(url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -469,7 +469,11 @@ class BackendCompilerWrapper {
|
||||
final String outputDirPath = outputDir.replace(File.separatorChar, '/');
|
||||
for (int idx = 0; idx < sourceRoots.length; idx++) {
|
||||
final VirtualFile root = sourceRoots[idx];
|
||||
buildOutputItemsList(outputDirPath, root, typeManager, compiledWithErrors, root, myProjectFileIndex.getPackageNameByDirectory(root));
|
||||
final String packagePrefix = myProjectFileIndex.getPackageNameByDirectory(root);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Building output items for " + root.getPresentableUrl() + "; output dir = " + outputDirPath + "; packagePrefix = \"" + packagePrefix + "\"");
|
||||
}
|
||||
buildOutputItemsList(outputDirPath, root, typeManager, compiledWithErrors, root, packagePrefix);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -605,9 +609,9 @@ class BackendCompilerWrapper {
|
||||
}
|
||||
|
||||
private void updateOutputItemsList(final String outputDir, VirtualFile javaFile, Set<VirtualFile> compiledWithErrors, VirtualFile sourceRoot, final String packagePrefix) {
|
||||
String name = javaFile.getName();
|
||||
if (myFileNameToSourceMap.containsKey(name)) {
|
||||
Set<Pair<String, String>> paths = myFileNameToSourceMap.get(name);
|
||||
final String javaFileName = javaFile.getName();
|
||||
if (myFileNameToSourceMap.containsKey(javaFileName)) {
|
||||
Set<Pair<String, String>> paths = myFileNameToSourceMap.get(javaFileName);
|
||||
|
||||
if (paths != null && paths.size() > 0) {
|
||||
final String prefix = packagePrefix != null && packagePrefix.length() > 0? packagePrefix.replace('.', '/') + "/" : "";
|
||||
@@ -621,10 +625,18 @@ class BackendCompilerWrapper {
|
||||
final Pair<String, String> realLocation = moveToRealLocation(outputDir, outputPath, javaFile);
|
||||
if (realLocation != null) {
|
||||
myOutputItems.add(new OutputItemImpl(realLocation.getFirst(), realLocation.getSecond(), javaFile));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Added output item: [outputDir; outputPath; sourceFile] = [" + realLocation.getFirst() + "; " + realLocation.getSecond() + "; " + javaFile.getPresentableUrl() + "]");
|
||||
}
|
||||
if (!compiledWithErrors.contains(javaFile)) {
|
||||
mySuccesfullyCompiledJavaFiles.add(javaFile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Failed to move to real location: " + outputPath + "; from " + outputDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@ import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
|
||||
public class JavaCompiler implements TranslatingCompiler {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.JavaCompiler");
|
||||
private Project myProject;
|
||||
private BackendCompiler JAVAC_BACKEND;
|
||||
private BackendCompiler JIKES_BACKEND;
|
||||
@@ -49,6 +51,9 @@ public class JavaCompiler implements TranslatingCompiler {
|
||||
context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
|
||||
}
|
||||
catch (CacheCorruptedException e) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(e);
|
||||
}
|
||||
context.requestRebuildNextTime(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.jdom.Element;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.awt.*;
|
||||
@@ -140,34 +141,38 @@ public class DebuggerTreeBase extends Tree {
|
||||
|
||||
public JComponent createToolTip(MouseEvent e) {
|
||||
DebuggerTreeNodeImpl node = getNodeToShowTip(e);
|
||||
if (node == null) return null;
|
||||
if (node == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(myCurrentTooltip != null &&
|
||||
myCurrentTooltip.isShowing() &&
|
||||
myCurrentTooltipNode == node) return myCurrentTooltip;
|
||||
if(myCurrentTooltip != null && myCurrentTooltip.isShowing() && myCurrentTooltipNode == node) {
|
||||
return myCurrentTooltip;
|
||||
}
|
||||
|
||||
myCurrentTooltipNode = node;
|
||||
|
||||
JToolTip toolTip = new JToolTip();
|
||||
toolTip.setLayout(new BorderLayout());
|
||||
final String toolTipText = getTipText(node);
|
||||
if(toolTipText == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String toolTipText = getTipText(node);
|
||||
if(toolTipText == null) return null;
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane(createTipContent(toolTipText));
|
||||
final JComponent tipContent = createTipContent(toolTipText);
|
||||
final JScrollPane scrollPane = new JScrollPane(tipContent);
|
||||
scrollPane.setBorder(null);
|
||||
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
toolTip.add(scrollPane);
|
||||
|
||||
JComponent tipContent = createTipContent(toolTipText);
|
||||
final JToolTip toolTip = new JToolTip();
|
||||
toolTip.setLayout(new BorderLayout());
|
||||
toolTip.add(scrollPane, BorderLayout.CENTER);
|
||||
|
||||
Rectangle tipRectangle = getTipRectangle(e, tipContent.getPreferredSize());
|
||||
if(toolTip.getBorder() != null) {
|
||||
Insets borderInsets = toolTip.getBorder().getBorderInsets(this);
|
||||
tipRectangle.setSize(tipRectangle.width + borderInsets.left + borderInsets.right,
|
||||
tipRectangle.height + borderInsets.top + borderInsets.bottom);
|
||||
final Border tooltipBorder = toolTip.getBorder();
|
||||
if(tooltipBorder != null) {
|
||||
final Insets borderInsets = tooltipBorder.getBorderInsets(this);
|
||||
tipRectangle.setSize(tipRectangle.width + borderInsets.left + borderInsets.right, tipRectangle.height + borderInsets.top + borderInsets.bottom);
|
||||
}
|
||||
Dimension tipSize = new Dimension(tipRectangle.getSize());
|
||||
final Dimension tipSize = new Dimension(tipRectangle.getSize());
|
||||
|
||||
if(tipRectangle.getWidth() < tipContent.getPreferredSize().getWidth()) {
|
||||
tipSize.height += scrollPane.getHorizontalScrollBar().getPreferredSize().height;
|
||||
@@ -215,7 +220,9 @@ public class DebuggerTreeBase extends Tree {
|
||||
TreePath path = getPathForLocation(event.getX(), event.getY());
|
||||
if (path != null) {
|
||||
Object last = path.getLastPathComponent();
|
||||
if (last instanceof DebuggerTreeNodeImpl) return (DebuggerTreeNodeImpl)last;
|
||||
if (last instanceof DebuggerTreeNodeImpl) {
|
||||
return (DebuggerTreeNodeImpl)last;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -237,16 +244,21 @@ public class DebuggerTreeBase extends Tree {
|
||||
if(event.getY() > contentRect.y + contentRect.height / 2) {
|
||||
y = Math.max(contentRect.y, nodeBounds.y - tipContentSize.height - vgap);
|
||||
height = Math.min(tipContentSize.height, nodeBounds.y - contentRect.y - vgap);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
y = nodeBounds.y + nodeBounds.height + vgap;
|
||||
height = Math.min(tipContentSize.height, contentRect.height - y);
|
||||
}
|
||||
|
||||
Dimension tipSize = new Dimension(width, height);
|
||||
final Dimension tipSize = new Dimension(width, height);
|
||||
|
||||
x = event.getX() - width / 2;
|
||||
if(x < contentRect.x) x = contentRect.x;
|
||||
if(x + width > contentRect.x + contentRect.width) x = contentRect.x + contentRect.width - width;
|
||||
if(x < contentRect.x) {
|
||||
x = contentRect.x;
|
||||
}
|
||||
if(x + width > contentRect.x + contentRect.width) {
|
||||
x = contentRect.x + contentRect.width - width;
|
||||
}
|
||||
|
||||
return new Rectangle(new Point(x, y), tipSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user