mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 15:17:05 +05:30
build-logic: make android-common a separate plugin and support com.android.test
This commit is contained in:
parent
504cdfe78a
commit
4d6b97adaf
4 changed files with 28 additions and 6 deletions
|
@ -30,6 +30,10 @@ gradlePlugin {
|
||||||
id = "dev.msfjarvis.claw.android-application"
|
id = "dev.msfjarvis.claw.android-application"
|
||||||
implementationClass = "dev.msfjarvis.aps.gradle.ApplicationPlugin"
|
implementationClass = "dev.msfjarvis.aps.gradle.ApplicationPlugin"
|
||||||
}
|
}
|
||||||
|
register("android-common") {
|
||||||
|
id = "dev.msfjarvis.claw.android-common"
|
||||||
|
implementationClass = "dev.msfjarvis.aps.gradle.AndroidCommonPlugin"
|
||||||
|
}
|
||||||
register("android-library") {
|
register("android-library") {
|
||||||
id = "dev.msfjarvis.claw.android-library"
|
id = "dev.msfjarvis.claw.android-library"
|
||||||
implementationClass = "dev.msfjarvis.aps.gradle.LibraryPlugin"
|
implementationClass = "dev.msfjarvis.aps.gradle.LibraryPlugin"
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
package dev.msfjarvis.aps.gradle
|
package dev.msfjarvis.aps.gradle
|
||||||
|
|
||||||
|
import com.android.build.api.dsl.TestExtension
|
||||||
import com.android.build.gradle.TestedExtension
|
import com.android.build.gradle.TestedExtension
|
||||||
import org.gradle.api.JavaVersion
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.configure
|
import org.gradle.kotlin.dsl.findByType
|
||||||
|
|
||||||
@Suppress("UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
object AndroidCommon {
|
class AndroidCommonPlugin : Plugin<Project> {
|
||||||
fun configure(project: Project) {
|
override fun apply(project: Project) {
|
||||||
project.extensions.configure<TestedExtension> {
|
project.extensions.findByType<TestedExtension>()?.run {
|
||||||
setCompileSdkVersion(31)
|
setCompileSdkVersion(31)
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
|
@ -35,6 +37,22 @@ object AndroidCommon {
|
||||||
targetCompatibility = JavaVersion.VERSION_11
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testOptions {
|
||||||
|
animationsDisabled = true
|
||||||
|
unitTests.isReturnDefaultValues = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
project.extensions.findByType<TestExtension>()?.run {
|
||||||
|
compileSdk = 31
|
||||||
|
defaultConfig {
|
||||||
|
minSdk = 26
|
||||||
|
targetSdk = 31
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
testOptions {
|
testOptions {
|
||||||
animationsDisabled = true
|
animationsDisabled = true
|
||||||
unitTests.isReturnDefaultValues = true
|
unitTests.isReturnDefaultValues = true
|
|
@ -15,7 +15,7 @@ class ApplicationPlugin : Plugin<Project> {
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
project.pluginManager.apply(AppPlugin::class)
|
project.pluginManager.apply(AppPlugin::class)
|
||||||
AndroidCommon.configure(project)
|
project.pluginManager.apply(AndroidCommonPlugin::class)
|
||||||
project.extensions.getByType<BaseAppModuleExtension>().run {
|
project.extensions.getByType<BaseAppModuleExtension>().run {
|
||||||
adbOptions.installOptions("--user 0")
|
adbOptions.installOptions("--user 0")
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@ class LibraryPlugin : Plugin<Project> {
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
project.pluginManager.apply(LibraryPlugin::class)
|
project.pluginManager.apply(LibraryPlugin::class)
|
||||||
AndroidCommon.configure(project)
|
project.pluginManager.apply(AndroidCommonPlugin::class)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue