Skip to content

Commit

Permalink
Add support for com.android.feature plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tk3y committed Jun 6, 2017
1 parent bdf76f2 commit f053d79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Expand Up @@ -21,7 +21,12 @@ class Android25ProjectHandler(kotlinConfigurationTools: KotlinConfigurationTools
val androidExtension = project.extensions.getByName("android")
when (androidExtension) {
is AppExtension -> androidExtension.applicationVariants.all(action)
is LibraryExtension -> androidExtension.libraryVariants.all(action)
is LibraryExtension -> {
androidExtension.libraryVariants.all(action)
if (androidExtension is FeatureExtension) {
androidExtension.featureVariants.all(action)
}
}
is TestExtension -> androidExtension.applicationVariants.all(action)
}
if (androidExtension is TestedExtension) {
Expand Down
Expand Up @@ -12,6 +12,7 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.logging.Logger
import org.gradle.api.logging.Logging
import org.gradle.api.plugins.InvalidPluginException
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPluginConvention
Expand Down Expand Up @@ -423,9 +424,12 @@ abstract class AbstractAndroidProjectHandler<V>(private val kotlinConfigurationT

project.afterEvaluate { project ->
if (project != null) {
val plugin = (project.plugins.findPlugin("android")
?: project.plugins.findPlugin("android-library")
?: project.plugins.findPlugin("com.android.test")) as BasePlugin
val plugin = sequenceOf("android", "android-library", "com.android.test", "com.android.feature")
.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.")

val subpluginEnvironment = loadSubplugins(project)

forEachVariant(project) {
Expand Down

0 comments on commit f053d79

Please sign in to comment.