Add Android library build plugin
This commit is contained in:
parent
e7e1d9ca9d
commit
864ee60c63
7 changed files with 67 additions and 25 deletions
|
@ -9,5 +9,5 @@ insert_final_newline = true
|
|||
[*.{kt,kts}]
|
||||
ij_kotlin_imports_layout = *,^*
|
||||
|
||||
[*.{yml,yaml,json}]
|
||||
[*.{yml,yaml,json,toml}]
|
||||
indent_size = 2
|
||||
|
|
|
@ -6,12 +6,12 @@ dependencies {
|
|||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
|
||||
|
||||
implementation(plugin(libs.plugins.kotlin.jvm))
|
||||
|
||||
implementation(plugin(libs.plugins.spotless))
|
||||
|
||||
implementation(plugin(libs.plugins.kotlin.android))
|
||||
|
||||
implementation(plugin(libs.plugins.android.application))
|
||||
implementation(plugin(libs.plugins.android.library))
|
||||
|
||||
implementation(plugin(libs.plugins.spotless))
|
||||
}
|
||||
|
||||
fun plugin(provider: Provider<PluginDependency>) = with(provider.get()) {
|
||||
|
|
33
build-plugin/src/main/kotlin/AndroidExtension.kt
Normal file
33
build-plugin/src/main/kotlin/AndroidExtension.kt
Normal file
|
@ -0,0 +1,33 @@
|
|||
import com.android.build.api.dsl.CommonExtension
|
||||
|
||||
fun CommonExtension<*, *, *, *>.configureSharedConfig() {
|
||||
compileSdk = ThunderbirdProjectConfig.androidSdkCompile
|
||||
|
||||
defaultConfig {
|
||||
compileSdk = ThunderbirdProjectConfig.androidSdkCompile
|
||||
minSdk = ThunderbirdProjectConfig.androidSdkMin
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = ThunderbirdProjectConfig.javaVersion
|
||||
targetCompatibility = ThunderbirdProjectConfig.javaVersion
|
||||
}
|
||||
|
||||
lint {
|
||||
checkDependencies = true
|
||||
abortOnError = false
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
isIncludeAndroidResources = true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,5 +5,6 @@ object ThunderbirdPlugins {
|
|||
}
|
||||
object Library {
|
||||
const val jvm = "thunderbird.library.jvm"
|
||||
const val android = "thunderbird.library.android"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,25 +4,14 @@ plugins {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdk = ThunderbirdProjectConfig.androidSdkCompile
|
||||
configureSharedConfig()
|
||||
|
||||
defaultConfig {
|
||||
minSdk = ThunderbirdProjectConfig.androidSdkMin
|
||||
targetSdk = ThunderbirdProjectConfig.androidSdkTarget
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
|
||||
sourceCompatibility = ThunderbirdProjectConfig.javaVersion
|
||||
targetCompatibility = ThunderbirdProjectConfig.javaVersion
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
|
@ -30,18 +19,9 @@ android {
|
|||
}
|
||||
|
||||
lint {
|
||||
checkDependencies = true
|
||||
|
||||
abortOnError = false
|
||||
lintConfig = file("${rootProject.projectDir}/config/lint/lint.xml")
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
isIncludeAndroidResources = true
|
||||
}
|
||||
}
|
||||
|
||||
dependenciesInfo {
|
||||
includeInApk = false
|
||||
includeInBundle = false
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
plugins {
|
||||
id("com.android.library")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
android {
|
||||
configureSharedConfig()
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = ThunderbirdProjectConfig.javaVersion.toString()
|
||||
}
|
||||
|
||||
lint {
|
||||
lintConfig = file("${rootProject.projectDir}/config/lint/lint.xml")
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
isIncludeAndroidResources = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation(libs.bundles.shared.jvm.test)
|
||||
}
|
|
@ -134,4 +134,6 @@ shared-jvm-test = [
|
|||
"truth",
|
||||
"mockito-inline",
|
||||
"mockito-kotlin",
|
||||
"koin-test",
|
||||
"koin-test-junit4",
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue