Migrate "room" from "kapt" to "ksp" (#3777)

- Add ksp plugin
- Switch room to use ksp instead of kapt
- `ArrayList` -> `List` in a few places to fix errors about unbound generics
This commit is contained in:
Nik Clayton 2023-06-29 18:37:46 +02:00 committed by GitHub
parent 1f7a5f626d
commit 25376170c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 13 deletions

View file

@ -1,5 +1,6 @@
plugins { plugins {
alias(libs.plugins.android.application) alias(libs.plugins.android.application)
alias(libs.plugins.google.ksp)
alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt) alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.kotlin.parcelize) alias(libs.plugins.kotlin.parcelize)
@ -113,12 +114,10 @@ android {
} }
} }
kapt { ksp {
arguments {
arg("room.schemaLocation", "$projectDir/schemas") arg("room.schemaLocation", "$projectDir/schemas")
arg("room.incremental", "true") arg("room.incremental", "true")
} }
}
configurations { configurations {
// JNI-only libraries don't play nicely with Robolectric // JNI-only libraries don't play nicely with Robolectric
@ -134,7 +133,7 @@ dependencies {
implementation libs.bundles.androidx implementation libs.bundles.androidx
implementation libs.bundles.room implementation libs.bundles.room
kapt libs.androidx.room.compiler ksp libs.androidx.room.compiler
implementation libs.android.material implementation libs.android.material

View file

@ -89,7 +89,7 @@ data class ConversationStatusEntity(
val bookmarked: Boolean, val bookmarked: Boolean,
val sensitive: Boolean, val sensitive: Boolean,
val spoilerText: String, val spoilerText: String,
val attachments: ArrayList<Attachment>, val attachments: List<Attachment>,
val mentions: List<Status.Mention>, val mentions: List<Status.Mention>,
val tags: List<HashTag>?, val tags: List<HashTag>?,
val showingHiddenContent: Boolean, val showingHiddenContent: Boolean,

View file

@ -102,8 +102,8 @@ class Converters @Inject constructor(
} }
@TypeConverter @TypeConverter
fun jsonToAttachmentList(attachmentListJson: String?): ArrayList<Attachment>? { fun jsonToAttachmentList(attachmentListJson: String?): List<Attachment>? {
return gson.fromJson(attachmentListJson, object : TypeToken<ArrayList<Attachment>>() {}.type) return gson.fromJson(attachmentListJson, object : TypeToken<List<Attachment>>() {}.type)
} }
@TypeConverter @TypeConverter

View file

@ -16,7 +16,6 @@
package com.keylesspalace.tusky.entity package com.keylesspalace.tusky.entity
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import java.util.ArrayList
import java.util.Date import java.util.Date
data class DeletedStatus( data class DeletedStatus(
@ -25,7 +24,7 @@ data class DeletedStatus(
@SerializedName("spoiler_text") val spoilerText: String, @SerializedName("spoiler_text") val spoilerText: String,
val visibility: Status.Visibility, val visibility: Status.Visibility,
val sensitive: Boolean, val sensitive: Boolean,
@SerializedName("media_attachments") val attachments: ArrayList<Attachment>?, @SerializedName("media_attachments") val attachments: List<Attachment>?,
val poll: Poll?, val poll: Poll?,
@SerializedName("created_at") val createdAt: Date, @SerializedName("created_at") val createdAt: Date,
val language: String? val language: String?

View file

@ -19,7 +19,6 @@ import android.text.SpannableStringBuilder
import android.text.style.URLSpan import android.text.style.URLSpan
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.keylesspalace.tusky.util.parseAsMastodonHtml import com.keylesspalace.tusky.util.parseAsMastodonHtml
import java.util.ArrayList
import java.util.Date import java.util.Date
data class Status( data class Status(
@ -42,7 +41,7 @@ data class Status(
val sensitive: Boolean, val sensitive: Boolean,
@SerializedName("spoiler_text") val spoilerText: String, @SerializedName("spoiler_text") val spoilerText: String,
val visibility: Visibility, val visibility: Visibility,
@SerializedName("media_attachments") val attachments: ArrayList<Attachment>, @SerializedName("media_attachments") val attachments: List<Attachment>,
val mentions: List<Mention>, val mentions: List<Mention>,
val tags: List<HashTag>?, val tags: List<HashTag>?,
val application: Application?, val application: Application?,

View file

@ -1,5 +1,6 @@
plugins { plugins {
alias(libs.plugins.android.application) apply false alias(libs.plugins.android.application) apply false
alias(libs.plugins.google.ksp) apply false
alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.kapt) apply false alias(libs.plugins.kotlin.kapt) apply false
alias(libs.plugins.kotlin.parcelize) apply false alias(libs.plugins.kotlin.parcelize) apply false

View file

@ -57,6 +57,7 @@ xmlwriter = "1.0.4"
[plugins] [plugins]
android-application = { id = "com.android.application", version.ref = "agp" } android-application = { id = "com.android.application", version.ref = "agp" }
google-ksp = "com.google.devtools.ksp:1.8.22-1.0.11"
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }