Continue retooling incremental tests to the new builders (compiler server).
authordboulytchev <gjhjctyjr>
Mon, 30 Jan 2012 10:26:32 +0000 (14:26 +0400)
committerdboulytchev <gjhjctyjr>
Mon, 30 Jan 2012 10:27:04 +0000 (14:27 +0400)
jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java

index cfba0719cf258562872691ab5f1abf8e0034c982..931bc55ca63613d6ad01e71de22f98d0e4efa464 100644 (file)
@@ -390,6 +390,8 @@ public class IncProjectBuilder {
     final BuildDataManager dataManager = context.getDataManager();
     final boolean compilingTests = context.isCompilingTests();
     try {
     final BuildDataManager dataManager = context.getDataManager();
     final boolean compilingTests = context.isCompilingTests();
     try {
+      final Collection<String> allOutputs = new LinkedList<String>();
+
       context.processFilesToRecompile(chunk, new FileProcessor() {
         private final Map<Module, SourceToOutputMapping> storageMap = new HashMap<Module, SourceToOutputMapping>();
 
       context.processFilesToRecompile(chunk, new FileProcessor() {
         private final Map<Module, SourceToOutputMapping> storageMap = new HashMap<Module, SourceToOutputMapping>();
 
@@ -403,24 +405,11 @@ public class IncProjectBuilder {
           final String srcPath = FileUtil.toSystemIndependentName(file.getPath());
           final Collection<String> outputs = srcToOut.getState(srcPath);
 
           final String srcPath = FileUtil.toSystemIndependentName(file.getPath());
           final Collection<String> outputs = srcToOut.getState(srcPath);
 
-          if (LOG.isDebugEnabled()) {
-            if (outputs != null && context.isMake()) {
-              LOG.info("Cleaning output files:");
-              final String[] buffer = new String[outputs.size()];
-              int i = 0;
-              for (String output : outputs) {
-                buffer[i++] = output;
-              }
-              Arrays.sort(buffer);
-              for (String output : buffer) {
-                LOG.info(output);
-              }
-              LOG.info("End of files");
-            }
-          }
-
           if (outputs != null) {
             for (String output : outputs) {
           if (outputs != null) {
             for (String output : outputs) {
+              if (LOG.isDebugEnabled()) {
+                allOutputs.add(output);
+              }
               FileUtil.delete(new File(output));
             }
             srcToOut.remove(srcPath);
               FileUtil.delete(new File(output));
             }
             srcToOut.remove(srcPath);
@@ -428,6 +417,22 @@ public class IncProjectBuilder {
           return true;
         }
       });
           return true;
         }
       });
+
+      if (LOG.isDebugEnabled()) {
+        if (context.isMake() && allOutputs.size() > 0) {
+          LOG.info("Cleaning output files:");
+          final String[] buffer = new String[allOutputs.size()];
+          int i = 0;
+          for (String output : allOutputs) {
+            buffer[i++] = output;
+          }
+          Arrays.sort(buffer);
+          for (String output : buffer) {
+            LOG.info(output);
+          }
+          LOG.info("End of files");
+        }
+      }
     }
     catch (Exception e) {
       throw new ProjectBuildException(e);
     }
     catch (Exception e) {
       throw new ProjectBuildException(e);
index d2e63772a39e6869fd36419d90ca5e6926c0c716..d0ea121136254fa283adfa037d45493d3f66d801 100644 (file)
@@ -59,7 +59,61 @@ public abstract class IncrementalTestCase extends TestCase {
       return s;
     }
   } 
       return s;
     }
   } 
-  
+
+  static {
+    Logger.setFactory(new Logger.Factory() {
+          @Override
+          public Logger getLoggerInstance(String category) {
+            final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(category);
+
+            final boolean affectedLogger = category.equals("#org.jetbrains.jps.incremental.java.JavaBuilder") ||
+                                           category.equals("#org.jetbrains.jps.incremental.IncProjectBuilder");
+
+            return new Logger() {
+              @Override
+              public boolean isDebugEnabled() {
+                return affectedLogger;
+              }
+
+              @Override
+              public void debug(@NonNls String message) {
+              }
+
+              @Override
+              public void debug(@Nullable Throwable t) {
+              }
+
+              @Override
+              public void debug(@NonNls String message, @Nullable Throwable t) {
+              }
+
+              @Override
+              public void error(@NonNls String message, @Nullable Throwable t, @NonNls String... details) {
+              }
+
+              @Override
+              public void info(@NonNls String message) {
+                if (affectedLogger) {
+                  logger.info(stripper.strip(message));
+                }
+              }
+
+              @Override
+              public void info(@NonNls String message, @Nullable Throwable t) {
+              }
+
+              @Override
+              public void warn(@NonNls String message, @Nullable Throwable t) {
+              }
+
+              @Override
+              public void setLevel(Level level) {
+              }
+            };
+          }
+        });
+  }
+
   private static RootStripper stripper = new RootStripper();
   
   private final String groupName;
   private static RootStripper stripper = new RootStripper();
   
   private final String groupName;
@@ -198,61 +252,6 @@ public abstract class IncrementalTestCase extends TestCase {
     properties.setProperty("log4j.appender.A1.layout.ConversionPattern", "%m%n");
 
     PropertyConfigurator.configure(properties);
     properties.setProperty("log4j.appender.A1.layout.ConversionPattern", "%m%n");
 
     PropertyConfigurator.configure(properties);
-
-    Logger.setFactory(new Logger.Factory() {
-      @Override
-      public Logger getLoggerInstance(String category) {
-        final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(category);
-
-        final boolean affectedLogger = category.equals("#org.jetbrains.jps.incremental.java.JavaBuilder") ||
-                                       category.equals("#org.jetbrains.jps.incremental.IncProjectBuilder");
-        
-        final String root = getWorkDir() + File.separator;
-        final int pos = root.length();
-
-        return new Logger() {
-          @Override
-          public boolean isDebugEnabled() {
-            return affectedLogger;
-          }
-
-          @Override
-          public void debug(@NonNls String message) {
-          }
-
-          @Override
-          public void debug(@Nullable Throwable t) {
-          }
-
-          @Override
-          public void debug(@NonNls String message, @Nullable Throwable t) {
-          }
-
-          @Override
-          public void error(@NonNls String message, @Nullable Throwable t, @NonNls String... details) {
-          }
-
-          @Override
-          public void info(@NonNls String message) {
-            if (affectedLogger) {
-              logger.info(stripper.strip(message));
-            }
-          }
-
-          @Override
-          public void info(@NonNls String message, @Nullable Throwable t) {
-          }
-
-          @Override
-          public void warn(@NonNls String message, @Nullable Throwable t) {
-          }
-
-          @Override
-          public void setLevel(Level level) {
-          }
-        };
-      }
-    });
   }
 
   public void doTest() throws Exception {
   }
 
   public void doTest() throws Exception {