|
|
|
@ -24,17 +24,16 @@ import com.google.samples.apps.nowinandroid.disableUnnecessaryAndroidTests
|
|
|
|
|
import com.google.samples.apps.nowinandroid.libs
|
|
|
|
|
import org.gradle.api.Plugin
|
|
|
|
|
import org.gradle.api.Project
|
|
|
|
|
import org.gradle.kotlin.dsl.apply
|
|
|
|
|
import org.gradle.kotlin.dsl.configure
|
|
|
|
|
import org.gradle.kotlin.dsl.dependencies
|
|
|
|
|
|
|
|
|
|
class AndroidLibraryConventionPlugin : Plugin<Project> {
|
|
|
|
|
override fun apply(target: Project) {
|
|
|
|
|
with(target) {
|
|
|
|
|
with(pluginManager) {
|
|
|
|
|
apply("com.android.library")
|
|
|
|
|
apply("org.jetbrains.kotlin.android")
|
|
|
|
|
apply("nowinandroid.android.lint")
|
|
|
|
|
}
|
|
|
|
|
apply(plugin = "com.android.library")
|
|
|
|
|
apply(plugin = "org.jetbrains.kotlin.android")
|
|
|
|
|
apply(plugin = "nowinandroid.android.lint")
|
|
|
|
|
|
|
|
|
|
extensions.configure<LibraryExtension> {
|
|
|
|
|
configureKotlinAndroid(this)
|
|
|
|
@ -45,7 +44,9 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
|
|
|
|
|
configureGradleManagedDevices(this)
|
|
|
|
|
// The resource prefix is derived from the module name,
|
|
|
|
|
// 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> {
|
|
|
|
|
configurePrintApksTask(this)
|
|
|
|
|