mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-17 08:37:03 +05:30
all: switch to moshi-ksp
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
7b87792d8a
commit
fb2005fd83
9 changed files with 15 additions and 7 deletions
|
@ -1,11 +1,12 @@
|
|||
plugins {
|
||||
kotlin("jvm")
|
||||
id("com.google.devtools.ksp") version "1.4.30-1.0.0-alpha04"
|
||||
`lobsters-plugin`
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(Dependencies.ThirdParty.Retrofit.lib)
|
||||
implementation(Dependencies.ThirdParty.Moshi.moshiMetadataReflect)
|
||||
ksp(Dependencies.ThirdParty.Moshi.ksp)
|
||||
implementation(Dependencies.ThirdParty.Retrofit.moshi)
|
||||
testImplementation(Dependencies.Kotlin.Coroutines.core)
|
||||
testImplementation(Dependencies.Testing.junit)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package dev.msfjarvis.lobsters.model
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
class KeybaseSignature(
|
||||
@Json(name = "kb_username")
|
||||
val kbUsername: String,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package dev.msfjarvis.lobsters.model
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
class LobstersPost(
|
||||
@Json(name = "short_id")
|
||||
val shortId: String,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package dev.msfjarvis.lobsters.model
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
class Submitter(
|
||||
val username: String,
|
||||
@Json(name = "created_at")
|
||||
|
|
|
@ -2,7 +2,6 @@ package dev.msfjarvis.lobsters.data.api
|
|||
|
||||
import com.squareup.moshi.Moshi
|
||||
import dev.msfjarvis.lobsters.util.TestUtils
|
||||
import dev.zacsweers.moshix.reflect.MetadataKotlinJsonAdapterFactory
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import mockwebserver3.Dispatcher
|
||||
import mockwebserver3.MockResponse
|
||||
|
@ -24,7 +23,6 @@ class LobstersApiTest {
|
|||
private val webServer = MockWebServer()
|
||||
private val apiData = TestUtils.getJson("hottest.json")
|
||||
private val moshi = Moshi.Builder()
|
||||
.add(MetadataKotlinJsonAdapterFactory())
|
||||
.build()
|
||||
private val okHttp = OkHttpClient.Builder()
|
||||
.build()
|
||||
|
|
|
@ -54,7 +54,6 @@ dependencies {
|
|||
implementation(Dependencies.Kotlin.Coroutines.android)
|
||||
implementation(Dependencies.ThirdParty.accompanist)
|
||||
implementation(Dependencies.ThirdParty.Moshi.lib)
|
||||
implementation(Dependencies.ThirdParty.Moshi.moshiMetadataReflect)
|
||||
implementation(Dependencies.ThirdParty.Retrofit.moshi)
|
||||
implementation(Dependencies.ThirdParty.SQLDelight.androidDriver)
|
||||
testImplementation(Dependencies.Testing.junit)
|
||||
|
|
|
@ -6,7 +6,6 @@ import dagger.Provides
|
|||
import dagger.Reusable
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import dev.zacsweers.moshix.reflect.MetadataKotlinJsonAdapterFactory
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
|
@ -15,7 +14,6 @@ object MoshiModule {
|
|||
@Reusable
|
||||
fun provideMoshi(): Moshi {
|
||||
return Moshi.Builder()
|
||||
.add(MetadataKotlinJsonAdapterFactory())
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ object Dependencies {
|
|||
|
||||
private const val version = "1.11.0"
|
||||
const val lib = "com.squareup.moshi:moshi:$version"
|
||||
const val moshiMetadataReflect = "dev.zacsweers.moshix:moshi-metadata-reflect:0.9.1"
|
||||
const val ksp = "dev.zacsweers.moshix:moshi-ksp:0.9.1"
|
||||
}
|
||||
|
||||
object Retrofit {
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
rootProject.name = "Claw"
|
||||
include(":app", ":api", ":database")
|
||||
enableFeaturePreview("GRADLE_METADATA")
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue