[tests] publish configs and build logs if a compilation test fails as build artifacts

This is needed to investigate IJPL-115184.

GitOrigin-RevId: 29df8e164b5fee6f2101190134fa989300b89e7b
This commit is contained in:
Nikolay Chashnikov
2024-07-17 12:58:41 +02:00
committed by intellij-monorepo-bot
parent d146b00d1c
commit 128b7b34df
2 changed files with 4 additions and 20 deletions

View File

@@ -26,7 +26,6 @@ import com.intellij.openapi.roots.CompilerProjectExtension;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.NioFiles;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
@@ -271,25 +270,7 @@ public final class CompilerTester {
public static void printBuildLog() {
File logDirectory = BuildManager.getBuildLogDirectory();
File[] files = logDirectory.listFiles(file -> file.getName().endsWith(".log"));
if (files == null || files.length == 0) {
LOG.debug("No *.log files in " + logDirectory + " after build");
return;
}
Arrays.sort(files, Comparator.comparing(File::getName));
for (File file : files) {
LOG.debug(file.getName() + ":");
try {
List<String> lines = FileUtil.loadLines(file);
for (String line : lines) {
LOG.debug(line);
}
}
catch (IOException e) {
LOG.debug("Failed to load contents: " + e.getMessage());
}
}
TestLoggerFactory.publishArtifactIfTestFails(logDirectory.toPath(), "build-log");
}
public static void enableDebugLogging() {