|
|
@ -21,9 +21,11 @@ import com.google.samples.apps.nowinandroid.configureGradleManagedDevices
|
|
|
|
import com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
|
|
|
import com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
|
|
|
import com.google.samples.apps.nowinandroid.configurePrintApksTask
|
|
|
|
import com.google.samples.apps.nowinandroid.configurePrintApksTask
|
|
|
|
import com.google.samples.apps.nowinandroid.disableUnnecessaryAndroidTests
|
|
|
|
import com.google.samples.apps.nowinandroid.disableUnnecessaryAndroidTests
|
|
|
|
|
|
|
|
import com.google.samples.apps.nowinandroid.getPlugin
|
|
|
|
import com.google.samples.apps.nowinandroid.libs
|
|
|
|
import com.google.samples.apps.nowinandroid.libs
|
|
|
|
import org.gradle.api.Plugin
|
|
|
|
import org.gradle.api.Plugin
|
|
|
|
import org.gradle.api.Project
|
|
|
|
import org.gradle.api.Project
|
|
|
|
|
|
|
|
import org.gradle.kotlin.dsl.apply
|
|
|
|
import org.gradle.kotlin.dsl.configure
|
|
|
|
import org.gradle.kotlin.dsl.configure
|
|
|
|
import org.gradle.kotlin.dsl.dependencies
|
|
|
|
import org.gradle.kotlin.dsl.dependencies
|
|
|
|
import org.gradle.kotlin.dsl.kotlin
|
|
|
|
import org.gradle.kotlin.dsl.kotlin
|
|
|
@ -31,11 +33,9 @@ import org.gradle.kotlin.dsl.kotlin
|
|
|
|
class AndroidLibraryConventionPlugin : Plugin<Project> {
|
|
|
|
class AndroidLibraryConventionPlugin : Plugin<Project> {
|
|
|
|
override fun apply(target: Project) {
|
|
|
|
override fun apply(target: Project) {
|
|
|
|
with(target) {
|
|
|
|
with(target) {
|
|
|
|
with(pluginManager) {
|
|
|
|
apply(plugin = libs.getPlugin("android.library"))
|
|
|
|
apply(libs.findPlugin("android-library").get().get().pluginId)
|
|
|
|
apply(plugin = libs.getPlugin("kotlin.android"))
|
|
|
|
apply(libs.findPlugin("kotlin-android").get().get().pluginId)
|
|
|
|
apply(plugin = libs.getPlugin("nowinandroid.android.lint"))
|
|
|
|
apply(libs.findPlugin("nowinandroid.android.lint").get().get().pluginId)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extensions.configure<LibraryExtension> {
|
|
|
|
extensions.configure<LibraryExtension> {
|
|
|
|
configureKotlinAndroid(this)
|
|
|
|
configureKotlinAndroid(this)
|
|
|
@ -46,7 +46,9 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
|
|
|
|
configureGradleManagedDevices(this)
|
|
|
|
configureGradleManagedDevices(this)
|
|
|
|
// The resource prefix is derived from the module name,
|
|
|
|
// The resource prefix is derived from the module name,
|
|
|
|
// so resources inside ":core:module1" must be prefixed with "core_module1_"
|
|
|
|
// so resources inside ":core:module1" must be prefixed with "core_module1_"
|
|
|
|
resourcePrefix = path.split("""\W""".toRegex()).drop(1).distinct().joinToString(separator = "_").lowercase() + "_"
|
|
|
|
resourcePrefix =
|
|
|
|
|
|
|
|
path.split("""\W""".toRegex()).drop(1).distinct().joinToString(separator = "_")
|
|
|
|
|
|
|
|
.lowercase() + "_"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
extensions.configure<LibraryAndroidComponentsExtension> {
|
|
|
|
extensions.configure<LibraryAndroidComponentsExtension> {
|
|
|
|
configurePrintApksTask(this)
|
|
|
|
configurePrintApksTask(this)
|
|
|
|