Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ dependencies {
// this allow us to access libs.anylibrary using type-safe accessors
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))

implementation(libs.koin.compiler.plugin)
implementation(libs.android.gradle.plugin)
implementation(libs.kotlin.gradle.plugin)
implementation(libs.detekt.gradle.plugin)
implementation(libs.serialization)
implementation(libs.com.google.devtools.ksp.gradle.plugin)
implementation(libs.popcorn.guineapig)
}

gradlePlugin {
plugins {
create("koinConvention") {
id = "com.streamplayer.koin-compiler-setup"
implementationClass = "KoinCompilerSetupPlugin"
}
}
}
31 changes: 31 additions & 0 deletions build-logic/src/main/java/KoinCompilerSetupPlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import gradle.kotlin.dsl.accessors._b237334f7e941d84ee6a2fb3c1888ffb.commonMainImplementation
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.the
import org.koin.compiler.plugin.KoinGradleExtension

// Ref: https://github.com/InsertKoinIO/koin-compiler-plugin/blob/main/docs/CASE_STUDY_NOW_IN_ANDROID.md#the-convention-plugin
class KoinCompilerSetupPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
// Apply Koin Compiler Plugin (replaces KSP)
pluginManager.apply("io.insert-koin.compiler.plugin")

// Configure logging
extensions.configure<KoinGradleExtension> {
userLogs.set(true)
compileSafety.set(true)
}

val libs = the<LibrariesForLibs>()

dependencies {
commonMainImplementation(libs.koin.core)
commonMainImplementation(libs.koin.annotations)
}
}
}
}

This file was deleted.

1 change: 1 addition & 0 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotzilla)
id("com.streamplayer.koin-compiler-setup")
}

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.codandotv.streamplayerapp.core_shared.qualifier.QualifierDispatcherIO
import com.codandotv.streamplayerapp.feature_list_streams.list.di.ListStreamModule
import com.codandotv.streamplayerapp.feature_news.di.NewsScreenModule
import com.codandotv.streamplayerapp.feature_search.di.SearchModule
import com.codandotv.streamplayerapp.feature_search.presentation.widgets.StreamsError
import com.codandotv.streamplayerapp.profile.di.ProfilePickerStreamModule
import io.kotzilla.generated.monitoring
import kotlinx.coroutines.Dispatchers
Expand All @@ -16,7 +15,7 @@ import org.koin.core.KoinApplication
import org.koin.core.context.startKoin
import org.koin.core.lazyModules
import org.koin.dsl.module
import org.koin.ksp.generated.module
import org.koin.plugin.module.dsl.modules

fun streamPlayerApplication(platformBlock: KoinApplication.() -> Unit): KoinApplication {
return startKoin {
Expand All @@ -29,17 +28,17 @@ fun streamPlayerApplication(platformBlock: KoinApplication.() -> Unit): KoinAppl
Dispatchers.IO
}
},
NetworkModule().module,
LocalStorageModule.module,
SyncModule.module,

// region feature_modules
ListStreamModule.module,
SearchModule().module,
NewsScreenModule().module,
ProfilePickerStreamModule().module
// endregion
)
modules<NetworkModule>()
modules<ProfilePickerStreamModule>()
modules<SearchModule>()
modules<NewsScreenModule>()

monitoring {
onConfig {
Expand Down
2 changes: 1 addition & 1 deletion core-networking/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.buildkonfig.plugin)
id("com.streamplayer.koin-annotations-setup")
id("com.streamplayer.koin-compiler-setup")
}

buildkonfig {
Expand Down
2 changes: 1 addition & 1 deletion feature-news/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id("com.streamplayer.kmp-library")
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.compose.compiler)
id("com.streamplayer.koin-annotations-setup")
id("com.streamplayer.koin-compiler-setup")
}

kotlin {
Expand Down
2 changes: 1 addition & 1 deletion feature-profile/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id("com.streamplayer.kmp-library")
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.compose.compiler)
id("com.streamplayer.koin-annotations-setup")
id("com.streamplayer.koin-compiler-setup")
}

kotlin {
Expand Down
2 changes: 1 addition & 1 deletion feature-search/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id("com.streamplayer.kmp-library")
alias(libs.plugins.jetbrains.compose)
alias(libs.plugins.compose.compiler)
id("com.streamplayer.koin-annotations-setup")
id("com.streamplayer.koin-compiler-setup")
}

kotlin {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ koin-annotations = "2.3.1"
ksp = "2.3.5"
kotzilla = "2.1.3"
lifecycle-viewmodel-compose-version = "2.9.6"
koin-compiler-plugin = "1.0.0-RC2"

dokka = "1.9.10"
detekt = "1.23.6"
Expand Down Expand Up @@ -91,6 +92,7 @@ koin-ksp-compiler = { module = "io.insert-koin:koin-ksp-compiler", version.ref =
koin_compose = { module = "io.insert-koin:koin-compose", version.ref = "koin" }
koin_compose_viewmodel = { module = "io.insert-koin:koin-compose-viewmodel", version.ref = "koin" }
koin_core_coroutines = { module = "io.insert-koin:koin-core-coroutines", version.ref = "koin" }
koin-compiler-plugin = { group = "io.insert-koin", name = "koin-compiler-gradle-plugin", version.ref = "koin-compiler-plugin" }

#Networking
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
Expand Down
Loading