diff --git a/compiler/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/generator/DefinitionGenerationExt.kt b/compiler/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/generator/DefinitionGenerationExt.kt index baa1ef8..2714171 100644 --- a/compiler/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/generator/DefinitionGenerationExt.kt +++ b/compiler/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/generator/DefinitionGenerationExt.kt @@ -28,8 +28,9 @@ fun OutputStream.generateDefinition(def: KoinMetaData.Definition, label: () -> S val ctor = generateConstructor(def.parameters) val binds = generateBindings(def.bindings) val qualifier = def.qualifier.generateQualifier() - val createAtStart = if (def.isType(SINGLE) && def.isCreatedAtStart == true) CREATED_AT_START else "" - + val createAtStart = if (def.isType(SINGLE) && def.isCreatedAtStart == true) { + if (qualifier == "") CREATED_AT_START else ",$CREATED_AT_START" + } else "" val space = if (def.isScoped()) NEW_LINE + "\t" else NEW_LINE appendText("$space${def.keyword.keyword}($qualifier$createAtStart) { ${param}${label()}$ctor } $binds") } @@ -46,7 +47,7 @@ fun OutputStream.generateClassDeclarationDefinition(def: KoinMetaData.Definition generateDefinition(def) { "${def.packageName}.${def.className}" } } -const val CREATED_AT_START = ",createdAtStart=true" +const val CREATED_AT_START = "createdAtStart=true" private fun List.generateParamFunction(): String { return if (any { it is KoinMetaData.ConstructorParameter.ParameterInject }) "params -> " else "" diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 471e0d1..24ad1ef 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -2,7 +2,7 @@ ext { // Koin koin_ksp_version = "1.2.2" - koin_version = '3.4.2' + koin_version = '3.4.1' // Kotlin kotlin_version = '1.8.21' diff --git a/sandbox/gradle.properties b/sandbox/gradle.properties index 1489a7e..a667c4e 100644 --- a/sandbox/gradle.properties +++ b/sandbox/gradle.properties @@ -2,7 +2,7 @@ kotlin.code.style=official kotlinVersion=1.8.21 koinVersion=3.4.1 koinAndroidVersion=3.4.1 -koinKspVersion=1.2.1 +koinKspVersion=1.2.2 kspVersion=1.8.21-1.0.11 androidGradleVersion=4.3.1 appcompatVersion=1.6.1 diff --git a/sandbox/other-ksp/src/main/kotlin/org/koin/example/newmodule/mymodule/MyModule.kt b/sandbox/other-ksp/src/main/kotlin/org/koin/example/newmodule/mymodule/MyModule.kt index 2824d20..a681a02 100644 --- a/sandbox/other-ksp/src/main/kotlin/org/koin/example/newmodule/mymodule/MyModule.kt +++ b/sandbox/other-ksp/src/main/kotlin/org/koin/example/newmodule/mymodule/MyModule.kt @@ -5,7 +5,7 @@ import org.koin.core.annotation.Module import org.koin.core.annotation.Single import org.koin.example.`interface`.MyInterfaceExt -@Single +@Single(createdAtStart = true) public class MyOtherComponent3(public val i : MyInterfaceExt) @Module