From ff95d0e3c554caeb6fb7edfe3e82e1b259a166d3 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Mon, 28 Mar 2005 19:05:11 +0400 Subject: [PATCH] more logging added to make --- .../com/intellij/compiler/OutputParser.java | 3 + .../intellij/compiler/impl/CompilerUtil.java | 8 --- .../javaCompiler/BackendCompilerWrapper.java | 66 +++++++++++-------- .../javaCompiler/CompilerParsingThread.java | 4 +- 4 files changed, 46 insertions(+), 35 deletions(-) diff --git a/source/com/intellij/compiler/OutputParser.java b/source/com/intellij/compiler/OutputParser.java index 06e8d970f47e..b655a883a87b 100644 --- a/source/com/intellij/compiler/OutputParser.java +++ b/source/com/intellij/compiler/OutputParser.java @@ -57,6 +57,9 @@ public abstract class OutputParser { } private void processParsingMessage(final Callback callback, final String filePath) { + if (LOG.isDebugEnabled()) { + LOG.debug("Process parsing message: " + filePath); + } int index = filePath.lastIndexOf('/'); final String name = index >= 0 ? filePath.substring(index + 1) : filePath; diff --git a/source/com/intellij/compiler/impl/CompilerUtil.java b/source/com/intellij/compiler/impl/CompilerUtil.java index 8bb3908a56e8..7586cfbf835f 100644 --- a/source/com/intellij/compiler/impl/CompilerUtil.java +++ b/source/com/intellij/compiler/impl/CompilerUtil.java @@ -31,14 +31,6 @@ public class CompilerUtil { return path; } - public static String normalizePath(String path, char pathSeparator) { - int index = path.lastIndexOf(pathSeparator); - if (index >= 0) { - return path.substring(0, index).toLowerCase() + path.substring(index); - } - return path; - } - public static boolean startsWith(String path1, String path2) { if (path2.length() > path1.length()) { return false; diff --git a/source/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java b/source/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java index 57c59131a87c..ef599c99ed24 100644 --- a/source/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java +++ b/source/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java @@ -403,6 +403,12 @@ class BackendCompilerWrapper { private void runTransformingCompilers(final ModuleChunk chunk) { final Compiler[] transformers = CompilerManager.getInstance(myProject).getCompilers(JavaSourceTransformingCompiler.class); + if (transformers.length == 0) { + return; + } + if (LOG.isDebugEnabled()) { + LOG.debug("Running transforming compilers..."); + } final Module[] modules = chunk.getModules(); for (int idx = 0; idx < transformers.length; idx++) { final JavaSourceTransformingCompiler transformer = (JavaSourceTransformingCompiler)transformers[idx]; @@ -501,6 +507,9 @@ class BackendCompilerWrapper { final Set compiledWithErrors = getFilesCompiledWithErrors(); final FileTypeManager typeManager = FileTypeManager.getInstance(); final String outputDirPath = outputDir.replace(File.separatorChar, '/'); + if (LOG.isDebugEnabled()) { + LOG.debug("myFileNameToSourceMap contains entries: " + myFileNameToSourceMap.size()); + } for (int idx = 0; idx < sourceRoots.length; idx++) { final VirtualFile root = sourceRoots[idx]; final String packagePrefix = myProjectFileIndex.getPackageNameByDirectory(root); @@ -633,6 +642,9 @@ class BackendCompilerWrapper { } private void putName(String sourceFileName, String relativePathToSource, String pathToClass) { + if (LOG.isDebugEnabled()) { + LOG.debug("Registering [sourceFileName, relativePathToSource, pathToClass] = [" + sourceFileName + "; " + relativePathToSource + "; " + pathToClass + "]"); + } Set> paths = myFileNameToSourceMap.get(sourceFileName); if (paths == null) { @@ -643,33 +655,35 @@ class BackendCompilerWrapper { } private void updateOutputItemsList(final String outputDir, VirtualFile javaFile, Set compiledWithErrors, VirtualFile sourceRoot, final String packagePrefix) { - final String javaFileName = javaFile.getName(); - if (myFileNameToSourceMap.containsKey(javaFileName)) { - Set> paths = myFileNameToSourceMap.get(javaFileName); + final Set> paths = myFileNameToSourceMap.get(javaFile.getName()); + if (LOG.isDebugEnabled()) { + LOG.debug("Checking java file " + javaFile.getPresentableUrl()); + LOG.debug("myFileNameToSourceMap contains: " + paths); + } + if (paths != null && paths.size() > 0) { + final String prefix = packagePrefix != null && packagePrefix.length() > 0? packagePrefix.replace('.', '/') + "/" : ""; + final String filePath = "/" + prefix + VfsUtil.getRelativePath(javaFile, sourceRoot, '/'); - if (paths != null && paths.size() > 0) { - final String prefix = packagePrefix != null && packagePrefix.length() > 0? packagePrefix.replace('.', '/') + "/" : ""; - final String filePath = !SystemInfo.isFileSystemCaseSensitive ? - "/" + CompilerUtil.normalizePath(prefix + VfsUtil.getRelativePath(javaFile, sourceRoot, '/'), '/') : - "/" + prefix + VfsUtil.getRelativePath(javaFile, sourceRoot, '/'); - for (Iterator> it = paths.iterator(); it.hasNext();) { - final Pair pair = it.next(); - if (filePath.equals(pair.getSecond())) { - final String outputPath = pair.getFirst().replace(File.separatorChar, '/'); - final Pair 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); - } + for (Iterator> it = paths.iterator(); it.hasNext();) { + final Pair pair = it.next(); + if (LOG.isDebugEnabled()) { + LOG.debug("Checking pair [pathToClass; relPathToSource] = [" + pair.getFirst() + "; " + pair.getSecond() + "]"); + } + if (CompilerUtil.pathsEqual(filePath, pair.getSecond())) { + final String outputPath = pair.getFirst().replace(File.separatorChar, '/'); + final Pair 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() + "]"); } - else { - if (LOG.isDebugEnabled()) { - LOG.debug("Failed to move to real location: " + outputPath + "; from " + outputDir); - } + if (!compiledWithErrors.contains(javaFile)) { + mySuccesfullyCompiledJavaFiles.add(javaFile); + } + } + else { + if (LOG.isDebugEnabled()) { + LOG.debug("Failed to move to real location: " + outputPath + "; from " + outputDir); } } } @@ -691,7 +705,7 @@ class BackendCompilerWrapper { realOutputDir = getOutputDir(module); } - if (tempOutputDir.equals(realOutputDir)) { // no need to move + if (CompilerUtil.pathsEqual(tempOutputDir, realOutputDir)) { // no need to move myFilesToRefresh.add(new File(pathToClass)); return new Pair(realOutputDir, pathToClass); } diff --git a/source/com/intellij/compiler/impl/javaCompiler/CompilerParsingThread.java b/source/com/intellij/compiler/impl/javaCompiler/CompilerParsingThread.java index d0531bcd79b1..9d0a39c5b666 100644 --- a/source/com/intellij/compiler/impl/javaCompiler/CompilerParsingThread.java +++ b/source/com/intellij/compiler/impl/javaCompiler/CompilerParsingThread.java @@ -74,7 +74,9 @@ public abstract class CompilerParsingThread extends Thread implements OutputPars public final String getNextLine() { try { final String line = readLine(myErrorStreamReader); - //System.out.println("Line read: " + line); + if (LOG.isDebugEnabled()) { + LOG.debug("LIne read: " + line); + } return TERMINATION_STRING.equals(line)? null : line; } catch(IOException e) {