JPS: Report "Cyclically dependent modules should have same compiler" as build error rather than exception

#KT-27285 Fixed

Original commit: 3c8b15ca54
This commit is contained in:
Sergey Rostov
2018-11-26 09:11:39 +03:00
parent 6f683d5154
commit ea4256088a
2 changed files with 10 additions and 6 deletions
@@ -336,6 +336,14 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
val kotlinContext = context.kotlin
val kotlinChunk = chunk.toKotlinChunk(context)!!
if (!kotlinChunk.haveSameCompiler) {
messageCollector.report(
ERROR,
"Cyclically dependent modules ${kotlinChunk.presentableModulesToCompilersList} should have same compiler."
)
return ABORT
}
if (representativeTarget is KotlinUnsupportedModuleBuildTarget) {
val msg = "${representativeTarget.kind} is not yet supported in IDEA internal build system. " +
"Please use Gradle to build ${kotlinChunk.presentableShortName}."
@@ -37,14 +37,10 @@ class KotlinChunk internal constructor(val context: KotlinCompileContext, val ta
val representativeTarget
get() = targets.first()
private val presentableModulesToCompilersList: String
val presentableModulesToCompilersList: String
get() = targets.joinToString { "${it.module.name} (${it.globalLookupCacheId})" }
init {
check(targets.all { it.javaClass == representativeTarget.javaClass }) {
"Cyclically dependent modules $presentableModulesToCompilersList should have same compiler."
}
}
val haveSameCompiler = targets.all { it.javaClass == representativeTarget.javaClass }
private val defaultLanguageVersion = VersionView.RELEASED_VERSION