!RENDER_DIAGNOSTICS_FULL_TEXT directive

Compares diagnostics rendered as text with corresponding .diag.txt file
This commit is contained in:
Dmitry Petrov
2020-02-06 12:35:47 +03:00
parent 4e6c3b6b43
commit a1326d3ef5
6 changed files with 99 additions and 28 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.cli.common.messages;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.utils.fileUtils.FileUtilsKt;
@@ -69,6 +70,23 @@ public interface MessageRenderer {
}
};
MessageRenderer SYSTEM_INDEPENDENT_RELATIVE_PATHS = new PlainTextMessageRenderer() {
private final File cwd = new File(".").getAbsoluteFile();
@Nullable
@Override
protected String getPath(@NotNull CompilerMessageLocation location) {
return FileUtil.toSystemIndependentName(
FileUtilsKt.descendantRelativeTo(new File(location.getPath()), cwd).getPath()
);
}
@Override
public String getName() {
return "SystemIndependentRelativePath";
}
};
MessageRenderer GRADLE_STYLE = new GradleStyleMessageRenderer();
String renderPreamble();