generated from Kotlin/multiplatform-library-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60ac327
commit c35b864
Showing
9 changed files
with
195 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
benchmark/src/main/kotlin/ivy/di/benchmark/fixtures/modules/kodein/AndroidGraphKodein.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package ivy.di.benchmark.fixtures.modules.kodein | ||
|
||
import ivy.di.benchmark.fixtures.* | ||
import org.kodein.di.* | ||
|
||
val AndroidGraphKodein = DI.Module(name = "AndroidGraphKodein") { | ||
// Singletons | ||
bind<Context>() with singleton { Context() } | ||
bind<Backstack>() with singleton { Backstack("/") } | ||
bind<Navigation>() with singleton { Navigation(instance(), instance(), instance()) } | ||
bind<SessionManager>() with singleton { SessionManager(instance(), instance()) } | ||
bind<ArticlesUseCase>() with singleton { ArticlesUseCase(instance(), instance(), instance()) } | ||
bind<ContentScreen>() with singleton { ContentScreen(instance(), instance(), instance()) } | ||
bind<ArticlesScreen>() with singleton { ArticlesScreen(instance(), instance()) } | ||
bind<AuthorScreen>() with singleton { AuthorScreen(instance(), instance()) } | ||
|
||
// Factories | ||
bind<LocalStorage>() with provider { LocalStorage() } | ||
bind<ArticlesDataSource>() with factory { | ||
RemoteArticlesDataSource( | ||
httpClient = lazy { instance<HttpClient>() }, | ||
sessionManger = instance() | ||
) | ||
} | ||
bind<ArticlesRepository>() with singleton { ArticlesRepositoryImpl(instance(), instance()) } | ||
bind<AuthorDataSource>() with provider { AuthorDataSource(instance()) } | ||
bind<AuthorRepository>() with provider { AuthorRepository(instance()) } | ||
bind<ArticlesViewModel>() with provider { | ||
ArticlesViewModel(instance(), instance(), instance(), instance(), instance()) | ||
} | ||
bind<AuthorViewModel>() with provider { | ||
AuthorViewModel(instance(), instance(), instance(), instance(), instance(), instance()) | ||
} | ||
|
||
// App factory | ||
bind<App>() with provider { | ||
App(instance(), instance(), instance(), instance(), instance(), instance()) | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
benchmark/src/main/kotlin/ivy/di/benchmark/fixtures/modules/kodein/BeGraphKodein.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package ivy.di.benchmark.fixtures.modules.kodein | ||
|
||
import ivy.di.benchmark.fixtures.* | ||
import org.kodein.di.* | ||
|
||
val BeGraphKodein = DI.Module(name = "BeGraphKodein") { | ||
// UrlProvider | ||
bind<UrlProvider>() with provider { AwsUrlProvider() } | ||
|
||
// Environment | ||
bind<Environment>() with singleton { RealEnvironment() } | ||
|
||
// ServerConfig | ||
bind<ServerConfig>() with provider { ServerConfig(instance()) } | ||
|
||
// KtorApp | ||
bind<KtorApp>() with singleton { KtorApp() } | ||
|
||
// RateLimiter | ||
bind<RateLimiter>() with singleton { RateLimiter(instance()) } | ||
|
||
// Database | ||
bind<Database>() with singleton { Database(instance(), instance()) } | ||
|
||
// Auth-related bindings | ||
bind<AuthRepository>() with provider { AuthRepository(instance()) } | ||
bind<GoogleLoginUseCase>() with provider { GoogleLoginUseCase(instance(), instance()) } | ||
bind<AuthService>() with provider { AuthService(instance(), instance()) } | ||
bind<AuthApi>() with provider { AuthApi(instance(), instance(), instance()) } | ||
|
||
// Cars-related bindings | ||
bind<CarsRepository>() with provider { CarsRepository(instance(), instance()) } | ||
bind<CarsService>() with provider { CarsService(instance(), instance()) } | ||
bind<CarsApi>() with provider { CarsApi(instance()) } | ||
|
||
// Apis | ||
bind<Apis>() with provider { Apis(instance(), instance(), instance()) } | ||
|
||
// ServerApp | ||
bind<ServerApp>() with provider { ServerApp(instance(), instance(), instance(), instance()) } | ||
} |
12 changes: 12 additions & 0 deletions
12
benchmark/src/main/kotlin/ivy/di/benchmark/fixtures/modules/kodein/CommonGraphKodein.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ivy.di.benchmark.fixtures.modules.kodein | ||
|
||
import ivy.di.benchmark.fixtures.* | ||
import org.kodein.di.* | ||
|
||
val CommonGraphKodein = DI.Module(name = "CommonGraphKodein") { | ||
bind<DispatchersProvider>() with provider { RealDispatchersProvider() } | ||
bind<Logger>() with provider { LoggerImpl() } | ||
bind<Json>() with singleton { Json() } | ||
bind<Serialization>() with provider { KotlinXSerialization(instance()) } | ||
bind<HttpClient>() with singleton { HttpClient(instance(), instance(), instance()) } | ||
} |
43 changes: 43 additions & 0 deletions
43
benchmark/src/main/kotlin/ivy/di/benchmark/fixtures/modules/kodein/ComplexGraphKodein.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package ivy.di.benchmark.fixtures.modules.kodein | ||
|
||
import ivy.di.benchmark.fixtures.* | ||
import org.kodein.di.* | ||
|
||
val ComplexGraphKodein = DI.Module(name = "ComplexGraphKodein") { | ||
// Holder bindings | ||
bind<Holder1>() with factory { Holder1(instance(), instance()) } | ||
bind<Holder2>() with singleton { Holder2(instance(), instance(), instance()) } | ||
bind<Holder3>() with factory { Holder3(instance(), instance()) } | ||
bind<Holder4>() with singleton { Holder4(instance(), instance(), instance()) } | ||
bind<Holder5>() with factory { Holder5(instance(), instance(), instance(), instance()) } | ||
bind<Holder6>() with singleton { Holder6(instance(), instance(), instance(), instance(), instance()) } | ||
bind<Holder7>() with factory { | ||
Holder7(instance(), instance(), instance(), instance(), instance(), instance()) | ||
} | ||
bind<Holder8>() with singleton { | ||
Holder8(instance(), instance(), instance(), instance(), instance(), instance(), instance()) | ||
} | ||
bind<Holder9>() with factory { | ||
Holder9(instance(), instance(), instance(), instance(), instance(), instance(), instance(), instance()) | ||
} | ||
bind<Holder10>() with singleton { | ||
Holder10( | ||
instance(), instance(), instance(), instance(), instance(), | ||
instance(), instance(), instance(), instance(), | ||
) | ||
} | ||
|
||
// MultiHolder bindings | ||
bind<MultiHolder>() with factory { | ||
MultiHolderImpl( | ||
instance(), instance(), instance(), | ||
instance(), instance(), instance(), | ||
instance(), instance(), instance(), | ||
instance(), instance(), instance(), | ||
instance(), instance() | ||
) | ||
} | ||
bind<MultiHolderFinal>() with factory { | ||
MultiHolderFinal(instance(), instance(), instance(), instance(), instance()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters