Files
fdroidclient/libs/database/build.gradle
2024-10-08 10:28:34 -03:00

132 lines
4.4 KiB
Groovy

plugins {
id 'kotlin-android'
id 'com.android.library'
id 'kotlin-kapt'
id 'org.jetbrains.dokka'
id "org.jlleitschuh.gradle.ktlint" version "10.2.1"
id 'com.vanniktech.maven.publish'
}
android {
namespace "org.fdroid.database"
compileSdk 34
defaultConfig {
minSdkVersion 21
targetSdk 33 // relevant for instrumentation tests (targetSdk 21 fails on Android 14)
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments disableAnalytics: 'true'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
androidTest {
java.srcDirs += "src/dbTest/java"
// Adds exported schema location as test app assets.
assets.srcDirs += files("$projectDir/schemas".toString())
}
test {
java.srcDirs += "src/dbTest/java"
// Adds exported schema location as test app assets.
assets.srcDirs += files("$projectDir/schemas".toString())
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
kotlinOptions {
jvmTarget = '17'
freeCompilerArgs += "-Xexplicit-api=strict"
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
aaptOptions {
// needed only for instrumentation tests: assets.openFd()
noCompress "json"
}
packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE.md'
exclude 'META-INF/LICENSE-notice.md'
}
}
dependencies {
implementation project(":libs:download")
implementation project(":libs:index")
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0'
implementation "androidx.room:room-runtime:2.6.1"
implementation "androidx.room:room-ktx:2.6.1"
kapt "androidx.room:room-compiler:2.6.1"
implementation 'io.github.microutils:kotlin-logging:2.1.21'
// 1.4.1 because https://github.com/Kotlin/kotlinx.serialization/issues/2231
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
testImplementation project(":libs:sharedTest")
testImplementation 'junit:junit:4.13.2'
testImplementation 'io.mockk:mockk:1.13.8'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'androidx.test:core:1.5.0'
testImplementation 'androidx.test.ext:junit:1.1.5'
testImplementation 'androidx.arch.core:core-testing:2.2.0'
testImplementation "androidx.room:room-testing:2.6.1"
testImplementation 'org.robolectric:robolectric:4.11.1'
testImplementation 'commons-io:commons-io:2.6'
testImplementation 'ch.qos.logback:logback-classic:1.4.5'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3'
testImplementation 'app.cash.turbine:turbine:1.0.0'
testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
androidTestImplementation project(":libs:sharedTest")
androidTestImplementation 'io.mockk:mockk-android:1.13.8'
androidTestImplementation 'org.jetbrains.kotlin:kotlin-test'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.arch.core:core-testing:2.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.room:room-testing:2.6.1"
androidTestImplementation 'commons-io:commons-io:2.6'
}
plugins.withId("kotlin-kapt") {
kapt.useBuildCache = true
}
signing {
useGpgCmd()
}
import org.jetbrains.dokka.gradle.DokkaTask
tasks.withType(DokkaTask).configureEach {
pluginsMapConfiguration.set(
["org.jetbrains.dokka.base.DokkaBase": """{
"customAssets": ["${file("${rootProject.rootDir}/logo-icon.svg")}"],
"footerMessage": "© 2010-2022 F-Droid Limited and Contributors"
}"""]
)
}
apply from: "${rootProject.rootDir}/gradle/ktlint.gradle"