Skip to content

Commit

Permalink
fix: build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
y9san9 committed Dec 22, 2023
1 parent 9e84c30 commit c945187
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 76 deletions.
8 changes: 4 additions & 4 deletions android/src/main/kotlin/app/meetacy/di/android/AndroidDI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import app.meetacy.di.global.GlobalDI
import app.meetacy.di.global.annotation.GlobalApi
import app.meetacy.di.global.di

val di: DI get() {
public val di: DI get() {
return try {
di
} catch (_: IllegalStateException) {
error("DI is not initialized, call AndroidDI.init(di)")
}
}

val DI.application: Application by Dependency
public val DI.application: Application by Dependency

@AndroidGlobalApi
object AndroidDI {
public object AndroidDI {
@OptIn(GlobalApi::class)
fun init(
public fun init(
application: Application,
di: DI
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ package app.meetacy.di.android.annotation
"another option, but to use a Global singleton",
level = RequiresOptIn.Level.WARNING
)
annotation class AndroidGlobalApi()
public annotation class AndroidGlobalApi()
26 changes: 0 additions & 26 deletions build-logic/src/main/kotlin/kmp-library-convention.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,4 @@ kotlin {
iosArm64()
iosX64()
iosSimulatorArm64()

sourceSets {
val commonMain by getting
val commonTest by getting

val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting

val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}

val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import androidx.compose.runtime.DisallowComposableCalls
import app.meetacy.di.DI

@Composable
inline fun <T> DI.remember(crossinline calculation: @DisallowComposableCalls DI.() -> T): T {
public inline fun <T> DI.remember(crossinline calculation: @DisallowComposableCalls DI.() -> T): T {
return androidx.compose.runtime.remember { calculation() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,53 @@ import app.meetacy.di.factory.factory0
import kotlinx.coroutines.CoroutineScope
import kotlin.reflect.typeOf

val DI.viewModelScope: CoroutineScope by Dependency
public val DI.viewModelScope: CoroutineScope by Dependency

@Composable
inline fun <reified R : Any> DI.viewModel(name: String? = null) = viewModel { create<R>(name) }
public inline fun <reified R : Any> DI.viewModel(name: String? = null): R = viewModel { create<R>(name) }

@Composable
inline fun <reified T1, reified R : Any> DI.viewModel(
public inline fun <reified T1, reified R : Any> DI.viewModel(
arg1: T1,
name: String? = null
): R = viewModel { create<T1, R>(arg1, name) }

@Composable
inline fun <reified T1, reified T2, reified R : Any> DI.viewModel(
public inline fun <reified T1, reified T2, reified R : Any> DI.viewModel(
arg1: T1,
arg2: T2,
name: String? = null
): R = viewModel { app.meetacy.di.factory.create<T1, T2, R>(arg1, arg2, name) }
): R = viewModel { create<T1, T2, R>(arg1, arg2, name) }

@Composable
inline fun <reified T1, reified T2, reified T3, reified R : Any> DI.viewModel(
public inline fun <reified T1, reified T2, reified T3, reified R : Any> DI.viewModel(
arg1: T1,
arg2: T2,
arg3: T3,
name: String? = null
): R = viewModel { app.meetacy.di.factory.create<T1, T2, T3, R>(arg1, arg2, arg3, name) }
): R = viewModel { create<T1, T2, T3, R>(arg1, arg2, arg3, name) }

@Composable
inline fun <reified T1, reified T2, reified T3, reified T4, reified R : Any> DI.viewModel(
public inline fun <reified T1, reified T2, reified T3, reified T4, reified R : Any> DI.viewModel(
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
name: String? = null
): R = viewModel { app.meetacy.di.factory.create<T1, T2, T3, T4, R>(arg1, arg2, arg3, arg4, name) }
): R = viewModel { create<T1, T2, T3, T4, R>(arg1, arg2, arg3, arg4, name) }

@Composable
inline fun <reified T1, reified T2, reified T3, reified T4, reified T5, reified R : Any> DI.viewModel(
public inline fun <reified T1, reified T2, reified T3, reified T4, reified T5, reified R : Any> DI.viewModel(
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
name: String? = null
): R = viewModel { app.meetacy.di.factory.create<T1, T2, T3, T4, T5, R>(arg1, arg2, arg3, arg4, arg5, name) }
): R = viewModel { create<T1, T2, T3, T4, T5, R>(arg1, arg2, arg3, arg4, arg5, name) }

@Composable
inline fun <reified T : Any> DI.viewModel(crossinline factory: DI.() -> T): T {
public inline fun <reified T : Any> DI.viewModel(crossinline factory: DI.() -> T): T {
return androidx.lifecycle.viewmodel.compose.viewModel<DIViewModel<T>>(key = "${typeOf<T>()}") unused@ {
val vm = object : DIViewModel<T>() {}

Expand All @@ -76,7 +76,3 @@ inline fun <reified T : Any> DI.viewModel(crossinline factory: DI.() -> T): T {
internal open class DIViewModel<T : Any> : ViewModel() {
lateinit var underlying: T
}

fun DIBuilder.users() {
val userViewModel by factory0(fun DI.() = 0)
}
26 changes: 0 additions & 26 deletions core/src/commonMain/kotlin/app/meetacy/di/internal/Parametrize.kt

This file was deleted.

4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]

kotlin = "1.9.22"
kotlin = "1.9.21"
androidGradle = "7.3.0"
composeRuntime = "1.3.3"
composeCompiler = "1.4.4"
composeCompiler = "1.5.6"
lifecycle = "2.6.1"

mdi = "0.0.26"
Expand Down

0 comments on commit c945187

Please sign in to comment.