Suggest to provide explicit dependency on new kotlin-reflect

In case when there's kotlin-stdlib 1.1 and kotlin-reflect 1.0 in the classpath
This commit is contained in:
Alexander Udalov
2017-02-15 19:38:40 +03:00
parent 71fcb07fad
commit 8e407d548a
@@ -271,6 +271,20 @@ object JvmRuntimeVersionsConsistencyChecker {
}
}.trimEnd())
// If there's kotlin-stdlib of version X in the classpath and kotlin-reflect of version Y < X,
// we suggest to provide an explicit dependency on version X.
// TODO: report this depending on the content of the jars instead
val minReflectJar =
jars.filter { it.file.name.startsWith("kotlin-reflect") }.minBy { it.version }
val maxStdlibJar =
jars.filter { it.file.name.startsWith("kotlin-runtime") || it.file.name.startsWith("kotlin-stdlib") }.maxBy { it.version }
if (minReflectJar != null && maxStdlibJar != null && minReflectJar.version < maxStdlibJar.version) {
messageCollector.issue(
null,
"Consider providing an explicit dependency on kotlin-reflect ${maxStdlibJar.version} to prevent strange errors"
)
}
return null
}