(minor) Improve exception message in case no Android plugin was found

This commit is contained in:
Sergey Igushkin
2017-06-06 16:13:52 +03:00
parent 21b88995ab
commit 2cad64881d
@@ -424,11 +424,14 @@ abstract class AbstractAndroidProjectHandler<V>(private val kotlinConfigurationT
project.afterEvaluate { project ->
if (project != null) {
val plugin = sequenceOf("android", "android-library", "com.android.test", "com.android.feature")
val androidPluginIds = listOf("android", "com.android.application", "android-library", "com.android.library",
"com.android.test", "com.android.feature")
val plugin = androidPluginIds.asSequence()
.mapNotNull { project.plugins.findPlugin(it) as? BasePlugin }
.firstOrNull()
?: throw InvalidPluginException("The Kotlin Android plugin cannot be used without " +
"the Android Gradle plugin applied to the project.")
?: throw InvalidPluginException("'kotlin-android' expects one of the Android Gradle " +
"plugins to be applied to the project:\n\t" +
androidPluginIds.joinToString("\n\t") { "* $it" })
val subpluginEnvironment = loadSubplugins(project)