in android/build-logic/convention/src/main/kotlin/com/theguardian/convention/AndroidLibraryConventionPlugin.kt [23:62]
override fun apply(target: Project) {
with(target) {
val shouldSetupAndroidTests = hasAndroidTests()
with(pluginManager) {
apply(libs.plugin("agp-library").pluginId)
apply(libs.plugin("kgp").pluginId)
apply(libs.plugin("dokka").pluginId)
apply(libs.plugin("kotlinter").pluginId)
}
setupDetekt()
setupKotlinter()
extensions.configure<LibraryExtension> {
configureAndroidModule<KotlinAndroidProjectExtension>(this)
if (shouldSetupAndroidTests) {
configureAndroidTests(this)
}
}
// Setup Dokka
dependencies {
add("implementation", libs.findLibrary("dokka-android").get())
}
dokkaConfig()
if (!shouldSetupAndroidTests) {
// Disable unnecessary Android instrumented tests for the project if there are no
// tests in the `androidTest` folder. Otherwise, these projects would be compiled,
// packaged, installed and run only to end-up with the following message:
//
// > Starting 0 tests on AVD
extensions.configure<LibraryAndroidComponentsExtension> {
beforeVariants { it.enableAndroidTest = false }
}
}
}
}