Skip to content

Commit

Permalink
Use ksp for hilt
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdanielczyk committed Aug 30, 2023
1 parent 818bc03 commit bc76424
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 30 deletions.
4 changes: 2 additions & 2 deletions build-logic/src/main/kotlin/rlad.android.hilt.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
kotlin("kapt")
id("dagger.hilt.android.plugin")
id("com.google.devtools.ksp")
}

dependencies {
add("implementation", libs.hilt.android)
add("kapt", libs.hilt.compiler)
add("ksp", libs.hilt.compiler)
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ internal interface ArticModule {
}

@Binds
fun ArticLocalDataSource.bindCommonLocalDataSource(): CommonLocalDataSource<ArtworkEntity>
fun bindCommonLocalDataSource(impl: ArticLocalDataSource): CommonLocalDataSource<ArtworkEntity>

@Binds
fun ArticRemoteDataSource.bindCommonRemoteDataSource(): CommonRemoteDataSource<ServerArtworksRoot, ServerArtwork>
fun bindCommonRemoteDataSource(impl: ArticRemoteDataSource): CommonRemoteDataSource<ServerArtworksRoot, ServerArtwork>

@Binds
fun ArticModelMapper.bindModelMapper(): ModelMapper<ArtworkEntity, ServerArtwork>
fun bindModelMapper(impl: ArticModelMapper): ModelMapper<ArtworkEntity, ServerArtwork>

@Binds
@IntoMap
@DataSourceKey(DataSource.ARTIC)
fun CommonRepositoryImpl<ArtworkEntity, ServerArtwork, ServerArtworksRoot>.bindCommonRepository(): CommonRepository
fun bindCommonRepository(impl: CommonRepositoryImpl<ArtworkEntity, ServerArtwork, ServerArtworksRoot>): CommonRepository

@Binds
@IntoMap
@DataSourceKey(DataSource.ARTIC)
fun ArticDataSourceConfiguration.bindDataSourceConfiguration(): DataSourceConfiguration
fun bindDataSourceConfiguration(impl: ArticDataSourceConfiguration): DataSourceConfiguration
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,26 @@ internal interface CommonModule {
}

@Binds
fun AppSettingsRepositoryImpl.bindAppSettingsRepository(): AppSettingsRepository
fun bindAppSettingsRepository(impl: AppSettingsRepositoryImpl): AppSettingsRepository

@Binds
fun GetAvailableDataSourcesUseCaseImpl.bindGetAvailableDataSourcesUseCase(): GetAvailableDataSourcesUseCase
fun bindGetAvailableDataSourcesUseCase(impl: GetAvailableDataSourcesUseCaseImpl): GetAvailableDataSourcesUseCase

@Binds
fun GetItemByIdUseCaseImpl.bindGetItemByIdUseCase(): GetItemByIdUseCase
fun bindGetItemByIdUseCase(impl: GetItemByIdUseCaseImpl): GetItemByIdUseCase

@Binds
fun GetItemsUseCaseImpl.bindGetItemsUseCase(): GetItemsUseCase
fun bindGetItemsUseCase(impl: GetItemsUseCaseImpl): GetItemsUseCase

@Binds
fun GetCommonRepositoryUseCaseImpl.bindGetCommonRepositoryUseCase(): GetCommonRepositoryUseCase
fun bindGetCommonRepositoryUseCase(impl: GetCommonRepositoryUseCaseImpl): GetCommonRepositoryUseCase

@Binds
fun GetSelectedDataSourceUseCaseImpl.bindGetSelectedDataSourceUseCase(): GetSelectedDataSourceUseCase
fun bindGetSelectedDataSourceUseCase(impl: GetSelectedDataSourceUseCaseImpl): GetSelectedDataSourceUseCase

@Binds
fun GetAllDataSourcesUseCaseImpl.bindGetAllDataSourcesUseCase(): GetAllDataSourcesUseCase
fun bindGetAllDataSourcesUseCase(impl: GetAllDataSourcesUseCaseImpl): GetAllDataSourcesUseCase

@Binds
fun PagingDataRepositoryImpl.bindPagingDataRepository(): PagingDataRepository
fun bindPagingDataRepository(impl: PagingDataRepositoryImpl): PagingDataRepository
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ internal interface GiphyModule {
}

@Binds
fun GiphyLocalDataSource.bindCommonLocalDataSource(): CommonLocalDataSource<GifEntity>
fun bindCommonLocalDataSource(impl: GiphyLocalDataSource): CommonLocalDataSource<GifEntity>

@Binds
fun GiphyRemoteDataSource.bindCommonRemoteDataSource(): CommonRemoteDataSource<ServerGifsRoot, ServerGif>
fun bindCommonRemoteDataSource(impl: GiphyRemoteDataSource): CommonRemoteDataSource<ServerGifsRoot, ServerGif>

@Binds
fun GiphyModelMapper.bindModelMapper(): ModelMapper<GifEntity, ServerGif>
fun bindModelMapper(impl: GiphyModelMapper): ModelMapper<GifEntity, ServerGif>

@Binds
@IntoMap
@DataSourceKey(DataSource.GIPHY)
fun CommonRepositoryImpl<GifEntity, ServerGif, ServerGifsRoot>.bindCommonRepository(): CommonRepository
fun bindCommonRepository(impl: CommonRepositoryImpl<GifEntity, ServerGif, ServerGifsRoot>): CommonRepository

@Binds
@IntoMap
@DataSourceKey(DataSource.GIPHY)
fun GiphyDataSourceConfiguration.bindDataSourceConfiguration(): DataSourceConfiguration
fun bindDataSourceConfiguration(impl: GiphyDataSourceConfiguration): DataSourceConfiguration
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ internal interface RickAndMortyModule {
}

@Binds
fun RickAndMortyLocalDataSource.bindCommonLocalDataSource(): CommonLocalDataSource<CharacterEntity>
fun bindCommonLocalDataSource(impl: RickAndMortyLocalDataSource): CommonLocalDataSource<CharacterEntity>

@Binds
fun RickAndMortyRemoteDataSource.bindCommonRemoteDataSource(): CommonRemoteDataSource<ServerGetCharacters, ServerCharacter>
fun bindCommonRemoteDataSource(impl: RickAndMortyRemoteDataSource): CommonRemoteDataSource<ServerGetCharacters, ServerCharacter>

@Binds
fun RickAndMortyModelMapper.bindModelMapper(): ModelMapper<CharacterEntity, ServerCharacter>
fun bindModelMapper(impl: RickAndMortyModelMapper): ModelMapper<CharacterEntity, ServerCharacter>

@Binds
@IntoMap
@DataSourceKey(DataSource.RICKANDMORTY)
fun CommonRepositoryImpl<CharacterEntity, ServerCharacter, ServerGetCharacters>.bindCommonRepository(): CommonRepository
fun bindCommonRepository(impl: CommonRepositoryImpl<CharacterEntity, ServerCharacter, ServerGetCharacters>): CommonRepository

@Binds
@IntoMap
@DataSourceKey(DataSource.RICKANDMORTY)
fun RickAndMortyDataSourceConfiguration.bindDataSourceConfiguration(): DataSourceConfiguration
fun bindDataSourceConfiguration(impl: RickAndMortyDataSourceConfiguration): DataSourceConfiguration
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import dagger.multibindings.IntoSet
internal interface DetailsModule {

@Binds
fun DetailsNavigatorImpl.bindDetailsNavigator(): DetailsNavigator
fun bindDetailsNavigator(impl: DetailsNavigatorImpl): DetailsNavigator

@Binds
@IntoSet
fun DetailsNavigatorImpl.bindNavigator(): Navigator
fun bindNavigator(impl: DetailsNavigatorImpl): Navigator
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ internal interface SearchModule {

@Binds
@IntoSet
fun SearchNavigatorImpl.bindNavigator(): Navigator
fun bindNavigator(impl: SearchNavigatorImpl): Navigator
}
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ org.gradle.configureondemand=true
org.gradle.configuration-cache=true
org.gradle.caching=true
org.gradle.parallel=true
kapt.incremental.apt=true

android.useAndroidX=true

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ androidxLifecycle = "2.6.1"
androidxPaging = "3.2.0"
androidxRoom = "2.5.2"
coil = "2.4.0"
hilt = "2.47"
hilt = "2.48"
kotlin = "1.9.10"
kotlinxCoroutines = "1.7.3"
ksp = "1.9.10-1.0.13"
Expand Down

0 comments on commit bc76424

Please sign in to comment.