Skip to content

Commit a95a3f3

Browse files
committed
Fix incorrect usage of qualified names in gen
1 parent 2998529 commit a95a3f3

2 files changed

Lines changed: 47 additions & 10 deletions

File tree

build.gradle.kts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111

1212
allprojects {
1313
group = "io.exoquery"
14-
version = "0.5.0"
14+
version = "0.6.0"
1515

1616
//val varintName = project.name
1717

@@ -151,3 +151,41 @@ allprojects {
151151
}
152152
}
153153
}
154+
155+
156+
tasks.register("publishLinuxLocal") {
157+
dependsOn(
158+
":${Release.Project.`decomat-core`}:publishToMavenLocal",
159+
":${Release.Project.`decomat-ksp`}:publishToMavenLocal"
160+
)
161+
}
162+
163+
164+
object Release {
165+
166+
object Project {
167+
val `decomat-core` = "decomat-core"
168+
val `decomat-ksp` = "decomat-ksp"
169+
}
170+
171+
val macBuildCommands =
172+
listOf(
173+
"iosX64",
174+
"iosArm64",
175+
"tvosX64",
176+
"tvosArm64",
177+
"watchosX64",
178+
"watchosArm32",
179+
"watchosArm64",
180+
"macosX64",
181+
"macosArm64",
182+
"iosSimulatorArm64"
183+
).map { "publish${it.capitalize()}PublicationToOssRepository" }
184+
185+
val windowsBuildCommands =
186+
listOf(
187+
"mingwX64"
188+
).map { "publish${it.capitalize()}PublicationToOssRepository" }
189+
190+
fun String.capitalize() = this.replaceFirstChar { it.uppercase() }
191+
}

decomat-ksp/src/main/kotlin/io/decomat/DecomatProcessor.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class DecomatProcessor(
252252

253253
val additionalImports =
254254
classFullNameListElem +
255-
members.mapNotNull { it.qualifiedClassName } +
255+
members.mapNotNull { it.importName } +
256256
// When elements themselves have things that need to be imported e.g. `data class Something(val content: List<OtherStuff>)` make sure to import `OtherStuff`
257257
members.flatMap {
258258
recurseGetArgs(it.field.type).map { it.declaration.qualifiedName?.asString() }.filterNotNull()
@@ -273,7 +273,12 @@ class DecomatProcessor(
273273

274274
}
275275
}
276-
data class Member(val className: String, val qualifiedClassName: String?, val field: PropertyHolder, val isGeneric: Boolean) {
276+
277+
/**
278+
* The field class-name is based on simple-name which has any generic parameters in it.
279+
* The import-name is based on the qualified name which does not have generics (which is perfect for imports)
280+
*/
281+
data class Member(val className: String, val importName: String?, val field: PropertyHolder, val isGeneric: Boolean) {
277282
val fieldName = field.name
278283
}
279284

@@ -373,12 +378,6 @@ class DecomatProcessor(
373378
is ModelType.None -> ""
374379
}
375380

376-
fun tryQualified(m: DecomatProcessor.Member): String =
377-
m.qualifiedClassName ?: run {
378-
logger.warn("Fully qualified name of `${m.field.type.toString()}` was null using regular name: ${m.className}")
379-
m.className
380-
}
381-
382381
val patLetters =
383382
when (modelType) {
384383
// e.g. the A in Pattern1<A, AP, FlatMap>
@@ -387,7 +386,7 @@ class DecomatProcessor(
387386
is ModelType.AB -> listOf("A", "B")
388387
// e.g. the A and String and B in Pattern2M<A, String, B, AP, BP, FlatMap>
389388
// I.e. the actual M-parameter is a concrete type per the data-class that XYZ_M class is being defined for
390-
is ModelType.AMB -> listOf("A", tryQualified(modelType.m), "B")
389+
is ModelType.AMB -> listOf("A", modelType.m.className, "B")
391390
is ModelType.None -> listOf()
392391
}
393392

0 commit comments

Comments
 (0)