Log what test classes were regenerated
This commit is contained in:
@@ -20,6 +20,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.di.GeneratorsFileUtil;
|
||||||
import org.jetbrains.jet.utils.Printer;
|
import org.jetbrains.jet.utils.Printer;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -129,7 +130,7 @@ public class TestGenerator {
|
|||||||
|
|
||||||
String testSourceFilePath = baseDir + "/" + suiteClassPackage.replace(".", "/") + "/" + suiteClassName + ".java";
|
String testSourceFilePath = baseDir + "/" + suiteClassPackage.replace(".", "/") + "/" + suiteClassName + ".java";
|
||||||
File testSourceFile = new File(testSourceFilePath);
|
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) {
|
private void generateTestClass(Printer p, TestClassModel testClassModel, boolean isStatic) {
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ import java.io.IOException;
|
|||||||
public class GeneratorsFileUtil {
|
public class GeneratorsFileUtil {
|
||||||
@SuppressWarnings("UseOfSystemOutOrSystemErr")
|
@SuppressWarnings("UseOfSystemOutOrSystemErr")
|
||||||
public static void writeFileIfContentChanged(File file, String newText) throws IOException {
|
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();
|
File parentFile = file.getParentFile();
|
||||||
if (!parentFile.exists()) {
|
if (!parentFile.exists()) {
|
||||||
if (parentFile.mkdirs()) {
|
if (parentFile.mkdirs()) {
|
||||||
@@ -37,7 +42,9 @@ public class GeneratorsFileUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (checkFileIgnoringLineSeparators(file, newText)) {
|
if (checkFileIgnoringLineSeparators(file, newText)) {
|
||||||
System.out.println("Not changed: " + file.getAbsolutePath());
|
if (logNotChanged) {
|
||||||
|
System.out.println("Not changed: " + file.getAbsolutePath());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user