Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
- Fix default arguments missing in annotation argument parser
- Fix exception in ksp processor
- Fix failing test
- Enable automatic release
  • Loading branch information
DRSchlaubi committed Jun 30, 2024
1 parent 893e296 commit daabd5d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
5 changes: 1 addition & 4 deletions buildSrc/src/main/kotlin/kord-publishing.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.KotlinMultiplatform
import org.intellij.lang.annotations.Language
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataTarget
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget

plugins {
org.jetbrains.dokka
Expand Down Expand Up @@ -50,7 +47,7 @@ tasks {
}

mavenPublishing {
publishToMavenCentral()
publishToMavenCentral(automaticRelease = true)
if (!System.getenv("ORG_GRADLE_PROJECT_signingInMemoryKey").isNullOrBlank()) {
signAllPublications()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ private fun KSTypeReference.dataClassType(rootType: KSClassDeclaration): TypeNam

else -> {
val declaration = resolvedType.declaration
if (resolvedType.isMappedAnnotation(rootType)
|| (resolvedType.declaration as? KSClassDeclaration)?.classKind == ClassKind.ENUM_CLASS
) {
ClassName("", declaration.simpleName.asString())
} else {
KSAnnotation::class.asClassName()
when {
resolvedType.isMappedAnnotation(rootType) -> ClassName("", declaration.simpleName.asString())
(resolvedType.declaration as? KSClassDeclaration)?.classKind == ClassKind.ENUM_CLASS -> (declaration as KSClassDeclaration).toClassName()
else -> KSAnnotation::class.asClassName()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ksp/src/main/kotlin/annotations/AnnotationArguments.kt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,6 @@ public class AnnotationArguments<A : Annotation> private constructor(
* @see AnnotationArguments
*/
public fun <A : Annotation> KSAnnotation.arguments(): AnnotationArguments<A> =
AnnotationArguments(arguments.associateBy { it.name!!.asString() })
AnnotationArguments(defaultArguments.associateBy { it.name!!.asString() } + arguments.associateBy { it.name!!.asString() })
}
}
1 change: 1 addition & 0 deletions ksp/src/test/kotlin/MockAnnotation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ private fun mockValueArgumentInternal(name: String, value: Any?, origin: Origin

fun mockAnnotation() = mockk<KSAnnotation> {
every { arguments } returns _arguments
every { defaultArguments } returns _arguments
}

0 comments on commit daabd5d

Please sign in to comment.