Fix NoSuchMethod in android-extensions-plugin
#KT-10263 Fixed
This commit is contained in:
@@ -28,6 +28,12 @@
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-gradle-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-gradle-plugin-api</artifactId>
|
||||
|
||||
+4
-3
@@ -16,12 +16,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.android
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin
|
||||
import org.gradle.api.Project
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import com.android.build.gradle.api.AndroidSourceSet
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
|
||||
import org.jetbrains.kotlin.gradle.plugin.android.AndroidGradleWrapper
|
||||
import org.w3c.dom.Document
|
||||
import java.io.File
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
@@ -48,7 +49,7 @@ public class AndroidSubplugin : KotlinGradleSubplugin {
|
||||
|
||||
addVariant(mainSourceSet)
|
||||
|
||||
val flavorSourceSets = androidExtension.productFlavors.map { sourceSets.findByName(it.name) }.filterNotNull()
|
||||
val flavorSourceSets = AndroidGradleWrapper.getProductFlavorsSourceSets(androidExtension).filterNotNull()
|
||||
for (sourceSet in flavorSourceSets) {
|
||||
addVariant(sourceSet)
|
||||
}
|
||||
|
||||
+6
@@ -2,6 +2,7 @@ package org.jetbrains.kotlin.gradle.plugin.android
|
||||
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import com.android.build.gradle.BasePlugin
|
||||
import com.android.build.gradle.api.AndroidSourceSet
|
||||
import com.android.build.gradle.api.ApkVariant
|
||||
import com.android.build.gradle.api.BaseVariant
|
||||
import com.android.build.gradle.api.TestVariant
|
||||
@@ -67,6 +68,11 @@ class AndroidGradleWrapper {
|
||||
return variant.getProductFlavors().iterator().collect { it.getName() }
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static def List<AndroidSourceSet> getProductFlavorsSourceSets(BaseExtension extension) {
|
||||
return extension.productFlavors.iterator().collect { extension.sourceSets.findByName(it.name) }
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static def DefaultDomainObjectSet<TestVariant> getTestVariants(BaseExtension extension) {
|
||||
if (extension.getMetaClass().getMetaMethod("getTestVariants")) {
|
||||
|
||||
Reference in New Issue
Block a user