Don't apply the Android Extensions subplugin to non-Android JVM tasks
In a multiplatform project with both Android and non-Android JVM targets the subplugin should only affect the tasks of the Android target
This commit is contained in:
+8
-1
@@ -29,7 +29,8 @@ import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
|
||||
import org.jetbrains.kotlin.gradle.model.builder.KotlinAndroidExtensionModelBuilder
|
||||
import org.jetbrains.kotlin.gradle.plugin.*
|
||||
import org.jetbrains.kotlin.gradle.plugin.android.AndroidGradleWrapper
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.multiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import org.w3c.dom.Document
|
||||
import java.io.File
|
||||
@@ -85,6 +86,12 @@ class AndroidSubplugin : KotlinGradleSubplugin<KotlinCompile> {
|
||||
if (project.plugins.findPlugin(AndroidExtensionsSubpluginIndicator::class.java) == null) {
|
||||
return false
|
||||
}
|
||||
project.multiplatformExtension?.let { kotlin ->
|
||||
return kotlin.targets.any { target ->
|
||||
target is KotlinAndroidTarget && target.compilations.any { it.compileKotlinTaskName == task.name }
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user