Skip to content

Commit

Permalink
Replace kapt with ksp
Browse files Browse the repository at this point in the history
  • Loading branch information
khoi-nguyen-2359 committed Aug 23, 2024
1 parent 1246827 commit 514aad4
Show file tree
Hide file tree
Showing 28 changed files with 105 additions and 68 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
alias libs.plugins.ksp
id 'kotlin-parcelize'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
Expand All @@ -11,7 +11,7 @@ plugins {

android {
namespace 'akio.apps.myrun'
compileSdkVersion project.compileSdk
compileSdk project.compileSdk

defaultConfig {
applicationId project.appId
Expand Down Expand Up @@ -131,7 +131,7 @@ dependencies {

implementation(libs.dagger)
implementation(libs.anvil.annotations)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)

implementation(libs.androidx.core)
implementation(libs.androidx.appcompat)
Expand Down
4 changes: 2 additions & 2 deletions base/di/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
alias libs.plugins.ksp
}

android {
Expand Down Expand Up @@ -35,7 +35,7 @@ dependencies {
implementation(libs.kotlinx.coroutines.core)

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)

implementation(libs.timber)
}
4 changes: 2 additions & 2 deletions base/firebase/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
alias libs.plugins.ksp
}

android {
Expand Down Expand Up @@ -36,7 +36,7 @@ dependencies {
implementation(libs.kotlinx.coroutines.core)

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)

implementation platform(libs.firebase.bom)
implementation(libs.bundles.firebase.data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.io.ByteArrayOutputStream
import kotlinx.coroutines.tasks.await

object FirebaseStorageUtils {
suspend fun uploadBitmap(
private suspend fun uploadBitmap(
storageRef: StorageReference,
storeName: String,
bitmap: Bitmap,
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ buildscript {
classpath(libs.firebase.perf.plugin)
classpath(libs.buildtimetracker)
classpath(libs.kotlinserialization.plugin)
classpath(libs.anvil.plugin)
}
}

Expand Down
13 changes: 10 additions & 3 deletions data/activity/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlinx-serialization'
id 'com.squareup.anvil'
alias libs.plugins.ksp
alias libs.plugins.anvil
}

android {
Expand Down Expand Up @@ -34,6 +34,13 @@ android {
}
}

anvil {
useKsp(
true, // contributesAndFactoryGeneration
true // componentMerging
)
}

dependencies {
implementation(project(":data:api"))
implementation(project(":base:di"))
Expand All @@ -48,7 +55,7 @@ dependencies {
implementation(libs.tcxzpot)

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)

implementation(libs.playservices.map)
implementation(libs.googlemaps.androidutils)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import akio.apps.myrun.data.activity.api.ActivityTcxFileWriter
import android.app.Application
import com.squareup.anvil.annotations.MergeComponent
import dagger.BindsInstance
import dagger.Component
import javax.inject.Singleton

abstract class ActivityDataScope private constructor()
Expand All @@ -22,7 +21,7 @@ interface ActivityDataComponent {
fun activityRepository(): ActivityRepository
fun activityTcxFileWriter(): ActivityTcxFileWriter

@Component.Factory
@MergeComponent.Factory
interface Factory {
fun create(@BindsInstance application: Application): ActivityDataComponent
}
Expand Down
13 changes: 10 additions & 3 deletions data/eapps/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.squareup.anvil'
alias libs.plugins.ksp
alias libs.plugins.anvil
}

android {
Expand Down Expand Up @@ -32,6 +32,13 @@ android {
}
}

anvil {
useKsp(
true, // contributesAndFactoryGeneration
true, // componentMerging
)
}

dependencies {
implementation project(':data:api')

Expand All @@ -43,7 +50,7 @@ dependencies {
implementation(libs.kotlinx.coroutines.core)

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)

implementation(libs.okhttp)
implementation(libs.okhttplogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import akio.apps.myrun.data.eapps.api.StravaTokenRepository
import android.app.Application
import com.squareup.anvil.annotations.MergeComponent
import dagger.BindsInstance
import dagger.Component
import javax.inject.Singleton

abstract class ExternalAppDataScope private constructor()
Expand All @@ -24,7 +23,7 @@ interface ExternalAppDataComponent {
fun stravaSyncState(): StravaSyncState
fun stravaTokenRepository(): StravaTokenRepository

@Component.Factory
@MergeComponent.Factory
interface Factory {
fun create(@BindsInstance application: Application): ExternalAppDataComponent
}
Expand Down
4 changes: 2 additions & 2 deletions data/location-mapbox/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
alias libs.plugins.ksp
}

android {
Expand Down Expand Up @@ -43,7 +43,7 @@ dependencies {
implementation(libs.kotlinx.coroutines.core)

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)

testImplementation(libs.kotlintest)
}
13 changes: 10 additions & 3 deletions data/location/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.squareup.anvil'
alias libs.plugins.ksp
alias libs.plugins.anvil
}

android {
Expand Down Expand Up @@ -44,6 +44,13 @@ android {
}
}

anvil {
useKsp(
true, // contributesAndFactoryGeneration
true, // componentMerging
)
}

dependencies {
implementation(project(":data:api"))
implementation(project(":base:di"))
Expand All @@ -60,7 +67,7 @@ dependencies {
implementation(libs.kotlinx.coroutines.core)

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)

implementation(libs.playservices.location)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import akio.apps.myrun.data.location.api.SphericalUtil
import android.app.Application
import com.squareup.anvil.annotations.MergeComponent
import dagger.BindsInstance
import dagger.Component
import javax.inject.Singleton

abstract class LocationDataScope private constructor()
Expand All @@ -22,7 +21,7 @@ interface LocationDataComponent {
fun polyUtil(): PolyUtil
fun placeDataSource(): PlaceDataSource

@Component.Factory
@MergeComponent.Factory
interface Factory {
fun create(
@BindsInstance application: Application,
Expand Down
13 changes: 10 additions & 3 deletions data/route/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.squareup.anvil'
alias libs.plugins.ksp
alias libs.plugins.anvil
}

android {
Expand Down Expand Up @@ -32,10 +32,17 @@ android {
}
}

anvil {
useKsp(
true, // contributesAndFactoryGeneration
true, // componentMerging
)
}

dependencies {
implementation(project(":data:api"))
implementation(project(":base:di"))

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)
}
16 changes: 11 additions & 5 deletions data/tracking/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
// id "com.google.devtools.ksp"
id 'kotlin-kapt'
id 'com.squareup.anvil'
alias libs.plugins.ksp
alias libs.plugins.anvil
}

android {
Expand Down Expand Up @@ -39,6 +38,13 @@ android {
}
}

anvil {
useKsp(
true, // contributesAndFactoryGeneration
true, // componentMerging
)
}

dependencies {
implementation(project(":data:api"))
implementation(project(":base:di"))
Expand All @@ -50,12 +56,12 @@ dependencies {

implementation(libs.room.ktx)
implementation(libs.room.runtime)
kapt(libs.room.compiler)
ksp(libs.room.compiler)

implementation(libs.timber)

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)

implementation(libs.datastore)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import akio.apps.myrun.data.tracking.api.RouteTrackingState
import android.app.Application
import com.squareup.anvil.annotations.MergeComponent
import dagger.BindsInstance
import dagger.Component
import javax.inject.Singleton

abstract class TrackingDataScope private constructor()
Expand All @@ -22,7 +21,7 @@ interface TrackingDataComponent {
fun fitnessDataRepo(): FitnessDataRepository
fun locationPresentConfig(): LocationPresentConfiguration

@Component.Factory
@MergeComponent.Factory
interface Factory {
fun create(@BindsInstance application: Application): TrackingDataComponent
}
Expand Down
13 changes: 10 additions & 3 deletions data/user/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.squareup.anvil'
alias libs.plugins.ksp
alias libs.plugins.anvil
}

android {
Expand Down Expand Up @@ -33,6 +33,13 @@ android {
}
}

anvil {
useKsp(
true, // contributesAndFactoryGeneration
true, // componentMerging
)
}

dependencies {
implementation project(":data:api")

Expand All @@ -49,5 +56,5 @@ dependencies {
implementation(libs.kotlinx.coroutines.core)

implementation(libs.dagger)
kapt(libs.daggercompiler)
ksp(libs.daggercompiler)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import akio.apps.myrun.data.user.api.UserRecentActivityRepository
import android.app.Application
import com.squareup.anvil.annotations.MergeComponent
import dagger.BindsInstance
import dagger.Component
import javax.inject.Singleton

abstract class AuthenticationDataScope private constructor()
Expand All @@ -32,7 +31,7 @@ interface AuthenticationDataComponent {
fun userPreferences(): CurrentUserPreferences
fun userPreferencesRepo(): UserPreferencesRepository

@Component.Factory
@MergeComponent.Factory
interface Factory {
fun create(@BindsInstance application: Application): AuthenticationDataComponent
}
Expand Down
Loading

0 comments on commit 514aad4

Please sign in to comment.