Migrate DB gradle file to kotlin dsl

This commit is contained in:
Shinokuni 2024-07-04 11:00:21 +02:00
parent a1df9dbe89
commit 4fa377bf26
3 changed files with 98 additions and 93 deletions

View File

@ -1,92 +0,0 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"room.incremental" : "true",
"room.schemaLocation": "$projectDir/schemas".toString()
]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
sourceSets {
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
testCoverageEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
lint {
abortOnError false
}
namespace 'com.readrops.db'
}
// Needed for kapt starting with kotlin plugin 1.5
kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas".toString())
arg("room.incremental", "true")
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api "androidx.core:core-ktx:1.6.0"
api 'androidx.appcompat:appcompat:1.3.0'
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation(libs.bundles.room)
kapt(libs.room.compiler)
androidTestImplementation(libs.room.testing)
implementation(libs.bundles.paging)
api 'joda-time:joda-time:2.10.10' //TODO replace with java.time?
implementation(libs.bundles.koin)
testImplementation(libs.bundles.kointest)
implementation(libs.bundles.coroutines)
androidTestImplementation(libs.coroutines.test)
}

97
db/build.gradle.kts Normal file
View File

@ -0,0 +1,97 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.kapt")
id("org.jetbrains.kotlin.plugin.parcelize")
}
android {
namespace = "com.readrops.db"
compileSdkVersion(34)
defaultConfig {
minSdkVersion(21)
targetSdkVersion(34)
buildToolsVersion("34.0.0")
/*javaCompileOptions {
annotationProcessorOptions {
arguments = listOf(
"room.incremental" to "true",
"room.schemaLocation" to "$projectDir/schemas".toString()
)
}
}*/
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
sourceSets {
getByName("androidTest") {
kotlin.srcDirs("$projectDir/schemas")
}
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
debug {
isMinifyEnabled = false
isTestCoverageEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
lint {
abortOnError = false
}
}
// Needed for kapt starting with kotlin plugin 1.5
kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas".toString())
arg("room.incremental", "true")
}
}
dependencies {
api("androidx.core:core-ktx:1.6.0")
api("androidx.appcompat:appcompat:1.3.0")
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0")
testImplementation("junit:junit:4.13")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test:runner:1.4.0")
androidTestImplementation("androidx.test:rules:1.4.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
implementation(libs.bundles.room)
kapt(libs.room.compiler)
androidTestImplementation(libs.room.testing)
implementation(libs.bundles.paging)
api("joda-time:joda-time:2.10.10") //TODO replace with java.time?
implementation(libs.bundles.koin)
testImplementation(libs.bundles.kointest)
implementation(libs.bundles.coroutines)
androidTestImplementation(libs.coroutines.test)
}

View File

@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html