Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 19850

Gradle - configure subprojects based on plugin presence

$
0
0

@sterling do you have a recommended pattern for conditional plugin applications while still using withPlugin()? We have a use case where we have one configuration we want to run for, say, android library projects but only if the Kotlin kapt plugin is not applied. If kapt’s plugin is applied, then we’d want to apply something different

Right now we’re basically doing something like this:

if (project.pluginManager.hasPlugin("org.jetbrains.kotlin.kapt")) {
  // Apply kapt configuration
} else if (project.pluginManager.hasPlugin("com.android.application")) {
  // Do something different
}

The hasPlugin system works, but obviously has ordering concerns. Figuring this might be our only option, but hoping there’s maybe another mechanism for this case that I’m missing.


Viewing all articles
Browse latest Browse all 19850

Trending Articles