197 lines
6.5 KiB
Kotlin
197 lines
6.5 KiB
Kotlin
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.ksp)
|
|
alias(libs.plugins.dagger.hilt.android)
|
|
alias(libs.plugins.kover)
|
|
alias(libs.plugins.compose.compiler)
|
|
}
|
|
|
|
android {
|
|
namespace = "com.sebaslogen.resacaapp.sample"
|
|
compileSdk = libs.versions.compileSdk.get().toInt()
|
|
defaultConfig {
|
|
applicationId = "com.sebaslogen.resacaapp"
|
|
minSdk = libs.versions.minSdk.get().toInt()
|
|
targetSdk = libs.versions.targetSdk.get().toInt()
|
|
versionCode = 1
|
|
versionName = "1.0"
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
vectorDrawables {
|
|
useSupportLibrary = true
|
|
}
|
|
}
|
|
buildFeatures { // Enables Jetpack Compose for this module
|
|
compose = true
|
|
buildConfig = true
|
|
}
|
|
buildTypes {
|
|
getByName("release") {
|
|
isMinifyEnabled = false
|
|
proguardFiles("proguard-rules.pro")
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
kotlinOptions {
|
|
jvmTarget = JavaVersion.VERSION_17.toString()
|
|
}
|
|
packaging {
|
|
resources {
|
|
excludes += setOf(
|
|
// Exclude AndroidX version files
|
|
"META-INF/*.version",
|
|
// Exclude consumer proguard files
|
|
"META-INF/proguard/*",
|
|
// Exclude the Firebase/Fabric/other random properties files
|
|
"/*.properties",
|
|
"fabric/*.properties",
|
|
"META-INF/*.properties",
|
|
"/META-INF/{AL2.0,LGPL2.1}",
|
|
)
|
|
}
|
|
}
|
|
lint {
|
|
baseline = file("lint-baseline.xml")
|
|
}
|
|
testOptions {
|
|
unitTests {
|
|
isIncludeAndroidResources = true
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(project(":resacahilt"))
|
|
implementation(project(":resacakoin"))
|
|
|
|
implementation(libs.coroutines.android)
|
|
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.appcompat)
|
|
implementation(libs.androidx.constraintlayout)
|
|
implementation(libs.android.material)
|
|
|
|
// Hilt dependencies
|
|
implementation(libs.dagger.hilt)
|
|
ksp(libs.dagger.hilt.compiler)
|
|
|
|
implementation(libs.koin.android)
|
|
|
|
// Test dependencies
|
|
|
|
testImplementation(libs.junit)
|
|
testImplementation(libs.robolectric)
|
|
testImplementation(libs.kotlin.coroutines.test)
|
|
// Test rules and transitive dependencies:
|
|
testImplementation(libs.compose.ui.test.junit)
|
|
// Needed for createComposeRule, but not createAndroidComposeRule:
|
|
debugImplementation(libs.compose.ui.test.manifest)
|
|
testImplementation(libs.dagger.hilt.android.testing)
|
|
kspTest(libs.dagger.hilt.android.compiler)
|
|
testImplementation(libs.koin.android.test)
|
|
// Espresso dependencies for Activity recreation tests
|
|
androidTestImplementation(libs.espresso)
|
|
androidTestImplementation(libs.test.runner)
|
|
androidTestImplementation(libs.test.rules)
|
|
androidTestImplementation(libs.androidx.junit.ktx)
|
|
androidTestImplementation(platform(libs.compose.bom))
|
|
androidTestImplementation(libs.compose.ui.test.junit)
|
|
androidTestImplementation(libs.koin.android.test)
|
|
|
|
|
|
// Compose dependencies and integration libs
|
|
|
|
implementation(libs.androidx.activity.compose)
|
|
// Compose integration with ViewModels
|
|
implementation(libs.bundles.androidx.lifecycle.viewmodel)
|
|
implementation(libs.androidx.navigation.compose)
|
|
|
|
// Compose dependencies
|
|
implementation(libs.compose.compiler)
|
|
implementation(platform(libs.compose.bom))
|
|
implementation(libs.compose.runtime)
|
|
implementation(libs.compose.ui)
|
|
// Tooling support (Previews, etc.)
|
|
implementation(libs.compose.ui.toolingPreview)
|
|
debugRuntimeOnly(libs.compose.ui.tooling)
|
|
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
|
|
implementation(libs.compose.foundation)
|
|
// Material Design
|
|
implementation(libs.compose.material)
|
|
}
|
|
|
|
tasks.withType<AbstractTestTask> {
|
|
// Add test output to gradle console
|
|
afterSuite(KotlinClosure2({ desc: TestDescriptor, result: TestResult ->
|
|
if (desc.parent == null) { // will match the outermost suite
|
|
println("Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)")
|
|
}
|
|
}))
|
|
|
|
// Disable unit tests for release build type (Robolectric limitations)
|
|
if (name.contains("testReleaseUnitTest")) {
|
|
enabled = false
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
* Kover code coverage configs for library modules
|
|
*/
|
|
dependencies {
|
|
kover(project(":resaca"))
|
|
kover(project(":resacahilt"))
|
|
kover(project(":resacakoin"))
|
|
}
|
|
|
|
kover {
|
|
currentProject {
|
|
createVariant("custom") {
|
|
/**
|
|
* Tests, sources, classes, and compilation tasks of the 'debug' build variant will be included in the report variant `custom`.
|
|
* Thus, information from the 'debug' variant will be included in the `custom` report for this project and any project that specifies this project as a dependency.
|
|
*/
|
|
addWithDependencies("debug")
|
|
}
|
|
}
|
|
reports {
|
|
// filters for all report types of all build variants
|
|
filters {
|
|
excludes {
|
|
androidGeneratedClasses()
|
|
}
|
|
}
|
|
variant("custom") {
|
|
filters {
|
|
excludes {
|
|
androidGeneratedClasses()
|
|
classes(
|
|
"*Fragment",
|
|
"*Fragment\$*",
|
|
"*Activity",
|
|
"*Activity\$*",
|
|
"*.databinding.*",
|
|
"*.BuildConfig",
|
|
"*ComposableSingletons\$*",
|
|
"*ColorKt*",
|
|
"*ThemeKt*",
|
|
"*TypeKt*",
|
|
"hilt_aggregated_deps.*",
|
|
"*dagger.hilt.internal.aggregatedroot.codegen*",
|
|
"*com.sebaslogen.resacaapp.sample*", // Ignore sample code
|
|
"*com.sebaslogen.resaca.ViewModelNewInstanceFactory*", // Skip class that is not used in code but used as backup for ViewModelFactory
|
|
)
|
|
}
|
|
}
|
|
|
|
verify {
|
|
rule {
|
|
minBound(90)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |