From e0e48bf469f813531b60f0beb7049d767caa31e3 Mon Sep 17 00:00:00 2001 From: Prashan Dharmasena Date: Thu, 23 May 2024 15:47:13 -0400 Subject: [PATCH] Fix publishToMavenLocal - need to create expect/actual for kotlin-inject component creation methods for every final platform. (See kotlin-inject KMP examples.) --- .../di/AbacusComponent.kt | 15 +++++++++- .../kotlin/di/AbacusComponent.ios.kt | 28 +++++++++++++++++++ .../kotlin/di/AbacusComponent.ios.kt | 28 +++++++++++++++++++ .../di/AbacusComponent.js.kt | 28 +++++++++++++++++++ src/jvmMain/kotlin/di/AbacusComponent.jvm.kt | 28 +++++++++++++++++++ 5 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 src/iosArm64Main/kotlin/di/AbacusComponent.ios.kt create mode 100644 src/iosSimulatorArm64Main/kotlin/di/AbacusComponent.ios.kt create mode 100644 src/jsMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.js.kt create mode 100644 src/jvmMain/kotlin/di/AbacusComponent.jvm.kt diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt b/src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt index a6fe3de2e..1867ca032 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt @@ -14,6 +14,7 @@ import kotlin.annotation.AnnotationTarget.CLASS import kotlin.annotation.AnnotationTarget.FUNCTION import kotlin.annotation.AnnotationTarget.PROPERTY_GETTER import kotlin.js.JsExport +import kotlin.reflect.KClass // kotlin-inject handles qualifiers via typealiases (though Dagger-style @Qualifier annotations are coming soon) typealias DeploymentUri = String @@ -34,7 +35,7 @@ object AbacusFactory { stateNotification: StateNotificationProtocol? = null, dataNotification: DataNotificationProtocol? = null, presentationProtocol: PresentationProtocol? = null, - ): AbacusComponent = AbacusComponent::class.create( + ): AbacusComponent = createAbacusComponent( deploymentUri, deployment, appConfigs, @@ -61,3 +62,15 @@ abstract class AbacusComponent( ) { abstract val stateManager: AsyncAbacusStateManagerV2 } + + +internal expect fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent \ No newline at end of file diff --git a/src/iosArm64Main/kotlin/di/AbacusComponent.ios.kt b/src/iosArm64Main/kotlin/di/AbacusComponent.ios.kt new file mode 100644 index 000000000..f44cb97f6 --- /dev/null +++ b/src/iosArm64Main/kotlin/di/AbacusComponent.ios.kt @@ -0,0 +1,28 @@ +package exchange.dydx.abacus.di + +import exchange.dydx.abacus.protocols.DataNotificationProtocol +import exchange.dydx.abacus.protocols.PresentationProtocol +import exchange.dydx.abacus.protocols.StateNotificationProtocol +import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2 +import exchange.dydx.abacus.utils.IOImplementations +import exchange.dydx.abacus.utils.UIImplementations + +internal actual fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent = AbacusComponent::class.create( + deploymentUri, + deployment, + appConfigs, + ioImplementations, + uiImplementations, + stateNotification, + dataNotification, + presentationProtocol, +) \ No newline at end of file diff --git a/src/iosSimulatorArm64Main/kotlin/di/AbacusComponent.ios.kt b/src/iosSimulatorArm64Main/kotlin/di/AbacusComponent.ios.kt new file mode 100644 index 000000000..f44cb97f6 --- /dev/null +++ b/src/iosSimulatorArm64Main/kotlin/di/AbacusComponent.ios.kt @@ -0,0 +1,28 @@ +package exchange.dydx.abacus.di + +import exchange.dydx.abacus.protocols.DataNotificationProtocol +import exchange.dydx.abacus.protocols.PresentationProtocol +import exchange.dydx.abacus.protocols.StateNotificationProtocol +import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2 +import exchange.dydx.abacus.utils.IOImplementations +import exchange.dydx.abacus.utils.UIImplementations + +internal actual fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent = AbacusComponent::class.create( + deploymentUri, + deployment, + appConfigs, + ioImplementations, + uiImplementations, + stateNotification, + dataNotification, + presentationProtocol, +) \ No newline at end of file diff --git a/src/jsMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.js.kt b/src/jsMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.js.kt new file mode 100644 index 000000000..f44cb97f6 --- /dev/null +++ b/src/jsMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.js.kt @@ -0,0 +1,28 @@ +package exchange.dydx.abacus.di + +import exchange.dydx.abacus.protocols.DataNotificationProtocol +import exchange.dydx.abacus.protocols.PresentationProtocol +import exchange.dydx.abacus.protocols.StateNotificationProtocol +import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2 +import exchange.dydx.abacus.utils.IOImplementations +import exchange.dydx.abacus.utils.UIImplementations + +internal actual fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent = AbacusComponent::class.create( + deploymentUri, + deployment, + appConfigs, + ioImplementations, + uiImplementations, + stateNotification, + dataNotification, + presentationProtocol, +) \ No newline at end of file diff --git a/src/jvmMain/kotlin/di/AbacusComponent.jvm.kt b/src/jvmMain/kotlin/di/AbacusComponent.jvm.kt new file mode 100644 index 000000000..f44cb97f6 --- /dev/null +++ b/src/jvmMain/kotlin/di/AbacusComponent.jvm.kt @@ -0,0 +1,28 @@ +package exchange.dydx.abacus.di + +import exchange.dydx.abacus.protocols.DataNotificationProtocol +import exchange.dydx.abacus.protocols.PresentationProtocol +import exchange.dydx.abacus.protocols.StateNotificationProtocol +import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2 +import exchange.dydx.abacus.utils.IOImplementations +import exchange.dydx.abacus.utils.UIImplementations + +internal actual fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent = AbacusComponent::class.create( + deploymentUri, + deployment, + appConfigs, + ioImplementations, + uiImplementations, + stateNotification, + dataNotification, + presentationProtocol, +) \ No newline at end of file