From 7d5a0761714e0cd9c68e0e66acdd8a692b23261b Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 9 Jan 2025 14:45:03 +0100 Subject: [PATCH] fix: Also annotate primary constructor --- .../src/syntax/kotlin/KotlinStruct.ts | 9 +++++--- .../kotlin/com/margelo/nitro/image/Car.kt | 21 +++++++++++-------- .../com/margelo/nitro/image/ImageSize.kt | 11 ++++++---- .../com/margelo/nitro/image/JsStyleStruct.kt | 11 ++++++---- .../kotlin/com/margelo/nitro/image/Person.kt | 11 ++++++---- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/packages/nitrogen/src/syntax/kotlin/KotlinStruct.ts b/packages/nitrogen/src/syntax/kotlin/KotlinStruct.ts index 2bb612920..ed8c5d4a4 100644 --- a/packages/nitrogen/src/syntax/kotlin/KotlinStruct.ts +++ b/packages/nitrogen/src/syntax/kotlin/KotlinStruct.ts @@ -61,9 +61,12 @@ import com.margelo.nitro.core.* */ @DoNotStrip @Keep -data class ${structType.structName}( - ${indent(values.join(',\n'), ' ')} -) { +data class ${structType.structName} + @DoNotStrip + @Keep + constructor( + ${indent(values.join(',\n'), ' ')} + ) { ${indent(secondaryConstructor, ' ')} } `.trim() diff --git a/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/Car.kt b/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/Car.kt index c16c5a830..b5adf5281 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/Car.kt +++ b/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/Car.kt @@ -16,14 +16,17 @@ import com.margelo.nitro.core.* */ @DoNotStrip @Keep -data class Car( - val year: Double, - val make: String, - val model: String, - val power: Double, - val powertrain: Powertrain, - val driver: Person?, - val isFast: Boolean? -) { +data class Car + @DoNotStrip + @Keep + constructor( + val year: Double, + val make: String, + val model: String, + val power: Double, + val powertrain: Powertrain, + val driver: Person?, + val isFast: Boolean? + ) { /* main constructor */ } diff --git a/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/ImageSize.kt b/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/ImageSize.kt index b4242d910..2b70d2a91 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/ImageSize.kt +++ b/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/ImageSize.kt @@ -16,9 +16,12 @@ import com.margelo.nitro.core.* */ @DoNotStrip @Keep -data class ImageSize( - val width: Double, - val height: Double -) { +data class ImageSize + @DoNotStrip + @Keep + constructor( + val width: Double, + val height: Double + ) { /* main constructor */ } diff --git a/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/JsStyleStruct.kt b/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/JsStyleStruct.kt index 19ccdd788..bda4f31d2 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/JsStyleStruct.kt +++ b/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/JsStyleStruct.kt @@ -16,10 +16,13 @@ import com.margelo.nitro.core.* */ @DoNotStrip @Keep -data class JsStyleStruct( - val value: Double, - val onChanged: (num: Double) -> Unit -) { +data class JsStyleStruct + @DoNotStrip + @Keep + constructor( + val value: Double, + val onChanged: (num: Double) -> Unit + ) { @DoNotStrip @Keep @Suppress("unused") diff --git a/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/Person.kt b/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/Person.kt index aafa9f5c6..b475a751b 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/Person.kt +++ b/packages/react-native-nitro-image/nitrogen/generated/android/kotlin/com/margelo/nitro/image/Person.kt @@ -16,9 +16,12 @@ import com.margelo.nitro.core.* */ @DoNotStrip @Keep -data class Person( - val name: String, - val age: Double -) { +data class Person + @DoNotStrip + @Keep + constructor( + val name: String, + val age: Double + ) { /* main constructor */ }