Promote severity of configuration warnings to STRONG_WARNING

The reason is that these configuration problems may be the reason of
compilation errors, but they were hidden from the output because warnings are
not reported when there's at least one error
This commit is contained in:
Alexander Udalov
2017-01-27 16:45:02 +03:00
parent 7ac96163ac
commit e9a737b85a
6 changed files with 12 additions and 13 deletions
@@ -339,7 +339,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
private void reportUnknownExtraFlags(@NotNull MessageCollector collector, @NotNull A arguments) {
for (String flag : arguments.unknownExtraFlags) {
collector.report(
CompilerMessageSeverity.WARNING,
CompilerMessageSeverity.STRONG_WARNING,
"Flag is not supported by this version of the compiler: " + flag,
CompilerMessageLocation.NO_LOCATION
);
@@ -206,7 +206,7 @@ class AnalyzerWithCompilerReport(private val messageCollector: MessageCollector)
fun reportBytecodeVersionErrors(bindingContext: BindingContext, messageCollector: MessageCollector) {
val severity = if (System.getProperty("kotlin.jvm.disable.bytecode.version.error") == "true")
CompilerMessageSeverity.WARNING
CompilerMessageSeverity.STRONG_WARNING
else
CompilerMessageSeverity.ERROR
@@ -152,7 +152,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
if (destination != null) {
messageCollector.report(
CompilerMessageSeverity.WARNING,
CompilerMessageSeverity.STRONG_WARNING,
"The '-d' option with a directory destination is ignored because '-module' is specified",
CompilerMessageLocation.NO_LOCATION
)
@@ -365,7 +365,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
}
else {
if (arguments.jdkHome != null) {
messageCollector.report(CompilerMessageSeverity.WARNING,
messageCollector.report(CompilerMessageSeverity.STRONG_WARNING,
"The '-jdk-home' option is ignored because '-no-jdk' is specified",
CompilerMessageLocation.NO_LOCATION)
}
@@ -67,8 +67,7 @@ import org.jetbrains.kotlin.cli.common.CliModuleVisibilityManagerImpl
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.WARNING
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
import org.jetbrains.kotlin.cli.common.toBooleanLenient
import org.jetbrains.kotlin.cli.jvm.JvmRuntimeVersionsConsistencyChecker
import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot
@@ -217,7 +216,7 @@ class KotlinCoreEnvironment private constructor(
FqName(it)
}
else {
report(WARNING, "Invalid package prefix name is ignored: $it")
report(STRONG_WARNING, "Invalid package prefix name is ignored: $it")
null
}
}
@@ -273,7 +272,7 @@ class KotlinCoreEnvironment private constructor(
val path = root.file
val localFile = findLocalDirectory(path.absolutePath)
if (localFile == null) {
report(WARNING, "Classpath entry points to a non-existent location: $path")
report(STRONG_WARNING, "Classpath entry points to a non-existent location: $path")
return null
}
return localFile
@@ -286,7 +285,7 @@ class KotlinCoreEnvironment private constructor(
val path = root.file
val jarFile = applicationEnvironment.jarFileSystem.findFileByPath("$path${URLUtil.JAR_SEPARATOR}")
if (jarFile == null) {
report(WARNING, "Classpath entry points to a file that is not a JAR archive: $path")
report(STRONG_WARNING, "Classpath entry points to a file that is not a JAR archive: $path")
return null
}
return jarFile
@@ -297,7 +296,7 @@ class KotlinCoreEnvironment private constructor(
configuration.kotlinSourceRoots.forEach { path ->
if (!uniqueSourceRoots.add(path)) {
report(WARNING, "Duplicate source root: $path")
report(STRONG_WARNING, "Duplicate source root: $path")
}
}
@@ -65,7 +65,7 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
if (destination.endsWith(".jar")) {
// TODO: support .jar destination
collector.report(
CompilerMessageSeverity.WARNING,
CompilerMessageSeverity.STRONG_WARNING,
".jar destination is not yet supported, results will be written to the directory with the given name",
CompilerMessageLocation.NO_LOCATION
)
@@ -639,7 +639,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
// We do not support circular dependencies, but if they are present, we do our best should not break the build,
// so we simply yield a warning and report NOTHING_DONE
environment.messageCollector.report(
WARNING,
STRONG_WARNING,
"Circular dependencies are not supported. The following JS modules depend on each other: "
+ chunk.modules.map { it.name }.joinToString(", ") + ". "
+ "Kotlin is not compiled for these modules",
@@ -690,7 +690,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
): OutputItemsCollector? {
if (chunk.modules.size > 1) {
environment.messageCollector.report(
WARNING,
STRONG_WARNING,
"Circular dependencies are only partially supported. The following modules depend on each other: "
+ chunk.modules.map { it.name }.joinToString(", ") + ". "
+ "Kotlin will compile them, but some strange effect may happen",