add dependencies for room

This commit is contained in:
Martin Ptáček
2023-06-18 23:02:09 +02:00
parent adade5203f
commit f059142ce8
2 changed files with 48 additions and 4 deletions

View File

@ -2,9 +2,13 @@ plugins {
id 'com.android.application' id 'com.android.application'
id 'org.jetbrains.kotlin.android' id 'org.jetbrains.kotlin.android'
id 'kotlinx-serialization' id 'kotlinx-serialization'
// ksp for room database
id 'com.google.devtools.ksp'
} }
apply plugin: 'com.google.protobuf' apply plugin: 'com.google.protobuf'
apply plugin: 'kotlin-android'
android { android {
namespace 'com.birdthedeveloper.prometheus.android.prometheus.android.exporter' namespace 'com.birdthedeveloper.prometheus.android.prometheus.android.exporter'
@ -30,8 +34,8 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_17
} }
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = '1.8'
@ -52,6 +56,12 @@ android {
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "17"
}
}
protobuf { protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.11.0' } protoc { artifact = 'com.google.protobuf:protoc:3.11.0' }
generateProtoTasks { generateProtoTasks {
@ -64,7 +74,36 @@ protobuf {
} }
dependencies { dependencies {
// custom -tests implementation 'androidx.core:core-ktx:1.10.1'
// custom - room database ----------------------------------------------------------------------
def room_version = "2.5.1"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// ksp room database annotations
ksp "androidx.room:room-compiler:$room_version"
// optional - RxJava2 support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// optional - RxJava3 support for Room
implementation "androidx.room:room-rxjava3:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:$room_version"
// optional - Test helpers
testImplementation "androidx.room:room-testing:$room_version"
// optional - Paging 3 Integration
implementation "androidx.room:room-paging:$room_version"
// room database end ---------------------------------------------------------------------------
// custom - tests
androidTestImplementation 'androidx.test:runner:1.5.2' androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestUtil 'androidx.test:orchestrator:1.4.2' androidTestUtil 'androidx.test:orchestrator:1.4.2'

View File

@ -5,17 +5,22 @@ buildscript {
} }
ext { ext {
compose_ui_version = '1.4.2' compose_ui_version = '1.4.2'
kotlin_version = '1.8.21'
} }
dependencies { dependencies {
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.3" classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
}// Top-level build file where you can add configuration options common to all sub-projects/modules. }// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.0.2' apply false id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false id 'org.jetbrains.kotlin.android' version '1.8.21' apply false
// serialization plugins // serialization plugins
id 'org.jetbrains.kotlin.jvm' version '1.8.21' id 'org.jetbrains.kotlin.jvm' version '1.8.21'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.21' id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.21'
// ksp for room database
id 'com.google.devtools.ksp' version '1.8.21-1.0.11' apply false
} }