Log what test classes were regenerated

This commit is contained in:
Andrey Breslav
2013-09-23 14:14:39 -07:00
parent ade544a8b7
commit 09da73da1b
2 changed files with 10 additions and 2 deletions
@@ -20,6 +20,7 @@ import com.google.common.collect.Lists;
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.TestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.di.GeneratorsFileUtil;
import org.jetbrains.jet.utils.Printer;
import java.io.File;
@@ -129,7 +130,7 @@ public class TestGenerator {
String testSourceFilePath = baseDir + "/" + suiteClassPackage.replace(".", "/") + "/" + suiteClassName + ".java";
File testSourceFile = new File(testSourceFilePath);
FileUtil.writeToFile(testSourceFile, out.toString());
GeneratorsFileUtil.writeFileIfContentChanged(testSourceFile, out.toString(), false);
}
private void generateTestClass(Printer p, TestClassModel testClassModel, boolean isStatic) {
@@ -26,6 +26,11 @@ import java.io.IOException;
public class GeneratorsFileUtil {
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public static void writeFileIfContentChanged(File file, String newText) throws IOException {
writeFileIfContentChanged(file, newText, true);
}
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public static void writeFileIfContentChanged(File file, String newText, boolean logNotChanged) throws IOException {
File parentFile = file.getParentFile();
if (!parentFile.exists()) {
if (parentFile.mkdirs()) {
@@ -37,7 +42,9 @@ public class GeneratorsFileUtil {
}
if (checkFileIgnoringLineSeparators(file, newText)) {
System.out.println("Not changed: " + file.getAbsolutePath());
if (logNotChanged) {
System.out.println("Not changed: " + file.getAbsolutePath());
}
return;
}