Skip to content

Commit

Permalink
Migrate Hilt to use KSP
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Oct 4, 2023
1 parent a658982 commit 406bcc7
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ plugins {
id("skydoves.spotless")
id("kotlin-parcelize")
id("dagger.hilt.android.plugin")
id("com.google.devtools.ksp")
id(libs.plugins.baseline.profile.get().pluginId)
}

Expand All @@ -47,7 +48,7 @@ android {
versionName = Configurations.versionName
}

packagingOptions {
packaging {
resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
Expand Down Expand Up @@ -105,7 +106,7 @@ dependencies {
implementation(libs.androidx.startup)
implementation(libs.hilt.android)
implementation(libs.androidx.hilt.navigation.compose)
kapt(libs.hilt.compiler)
ksp(libs.hilt.compiler)

// image loading
implementation(libs.landscapist.glide)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ class AndroidHiltConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("org.jetbrains.kotlin.kapt")
apply("com.google.devtools.ksp")
}

val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")

dependencies {
add("implementation", libs.findLibrary("hilt.android").get())
add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get())
add("kapt", libs.findLibrary("hilt.compiler").get())
add("ksp", libs.findLibrary("hilt.compiler").get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package com.skydoves.chatgpt.core.designsystem.component

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -28,7 +28,7 @@ import com.skydoves.chatgpt.core.designsystem.theme.ChatGPTComposeTheme

@Composable
fun ChatGPTSmallTopBar(title: String) {
SmallTopAppBar(
TopAppBar(
modifier = Modifier.fillMaxWidth(),
title = {
Text(
Expand All @@ -37,7 +37,7 @@ fun ChatGPTSmallTopBar(title: String) {
style = MaterialTheme.typography.titleLarge
)
},
colors = TopAppBarDefaults.smallTopAppBarColors(
colors = TopAppBarDefaults.mediumTopAppBarColors(
containerColor = MaterialTheme.colorScheme.primary
)
)
Expand Down
1 change: 0 additions & 1 deletion core-network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ plugins {
id("skydoves.android.library")
id("skydoves.android.hilt")
id("skydoves.spotless")
id("com.google.devtools.ksp")
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import javax.inject.Inject

class NetworkInitializer : Initializer<Unit> {

@set:Inject
@Inject
internal lateinit var globalOperator: ClearCacheGlobalOperator<Any>

override fun create(context: Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import kotlin.random.Random
*/
class StreamChatInitializer : Initializer<Unit> {

@set:Inject
@Inject
internal lateinit var preferences: Preferences

override fun create(context: Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ internal class ChatGPTMessageWorker @AssistedInject constructor(
@Assisted private val workerParams: WorkerParameters
) : CoroutineWorker(context, workerParams) {

@set:Inject
@Inject
internal lateinit var repository: GPTMessageRepository

@set:Inject
@Inject
internal lateinit var chatClient: ChatClient

override suspend fun doWork(): Result {
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ streamLog = "1.1.4"
balloon = "1.6.0"
landscapist = "2.2.10"
androidDesugarJdkLibs = "2.0.3"
androidGradlePlugin = "8.1.1"
androidGradlePlugin = "8.1.2"
androidxActivity = "1.7.2"
androidxAppCompat = "1.6.1"
androidxCompose = "1.5.1"
androidxCompose = "1.5.2"
androidxComposeCompiler = "1.5.3"
androidxComposeMaterial3 = "1.2.0-alpha07"
androidxComposeConstraintLayout = "1.0.1"
androidxComposeNavigation = "2.7.2"
androidxComposeNavigation = "2.7.3"
androidxCore = "1.12.0"
androidxHiltNavigationCompose = "1.0.0"
androidxLifecycle = "2.6.2"
androidxMacroBenchmark = "1.2.0-beta05"
androidxMacroBenchmark = "1.2.0-rc01"
androidxNavigation = "2.5.0"
androidxProfileinstaller = "1.3.1"
androidxStartup = "1.1.1"
Expand All @@ -26,7 +26,7 @@ androidxTracing = "1.1.0"
androidxWorker = "2.8.1"
androidxUiAutomator = "2.3.0-alpha04"
viewModelLifecycle = "1.1.0"
hilt = "2.48"
hilt = "2.48.1"
hiltWorker = "1.0.0"
junit4 = "4.13.2"
kotlin = "1.9.10"
Expand Down

0 comments on commit 406bcc7

Please sign in to comment.