Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ repositories {
}

dependencies {
val kotlinVersion = "2.3.20"
val kotlinVersion = "2.3.0"

implementation("org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:${kotlinVersion}")
implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin.plugin.allopen:org.jetbrains.kotlin.plugin.allopen.gradle.plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin.plugin.noarg:org.jetbrains.kotlin.plugin.noarg.gradle.plugin:$kotlinVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ kotlin {
"com.github.avrokotlin.avro4k.ExperimentalAvro4kApi",
)
freeCompilerArgs.add("-Xcontext-parameters")
jvmToolchain(11)
}

jvmToolchain(11)
}

tasks.withType<Test>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
kotlin("multiplatform")
id("org.jetbrains.dokka")
id("org.jetbrains.kotlinx.binary-compatibility-validator")
id("com.diffplug.spotless")
}

apiValidation {
nonPublicMarkers += "com.github.avrokotlin.avro4k.InternalAvro4kApi"
}

java {
withSourcesJar()
}

kotlin {
explicitApi()

compilerOptions {
optIn = listOf(
"com.github.avrokotlin.avro4k.InternalAvro4kApi",
"com.github.avrokotlin.avro4k.ExperimentalAvro4kApi",
)
freeCompilerArgs = listOf(
"-Xcontext-parameters",
"-Xexpect-actual-classes",
)
}

jvmToolchain(11)
}

tasks.withType<Test>().configureEach {
useJUnitPlatform()
}

spotless {
val ktlintVersion = extensions.getByType<VersionCatalogsExtension>().named("libs").findVersion("ktlint").get().toString()
kotlin {
ktlint(ktlintVersion).setEditorConfigPath(rootProject.file(".editorconfig"))
}
kotlinGradle {
ktlint(ktlintVersion).setEditorConfigPath(rootProject.file(".editorconfig"))
}
}

repositories {
mavenCentral()
}
61 changes: 32 additions & 29 deletions buildSrc/src/main/kotlin/library-publish-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,43 @@ mavenPublishing {
}
}

mavenPublishing {
coordinates(
artifactId = "avro4k-${project.name}",
)
pom {
val projectUrl = "https://github.com/avro-kotlin/avro4k"
name = project.name
description = project.description?.ifEmpty { null } ?: error("Missing ${project.name} project description")
url = projectUrl

scm {
connection = "scm:git:$projectUrl"
developerConnection = "scm:git:$projectUrl"
// Needed to wrap in afterEvaluate as the project.description is not evaluated early enough in kmp I don't know why
afterEvaluate {
mavenPublishing {
coordinates(
artifactId = "avro4k-${project.name}",
)
pom {
val projectUrl = "https://github.com/avro-kotlin/avro4k"
name = project.name
description = project.description?.ifEmpty { null } ?: error("Missing ${project.name} project description")
url = projectUrl
}

licenses {
license {
name = "Apache-2.0"
url = "https://opensource.org/licenses/Apache-2.0"
scm {
connection = "scm:git:$projectUrl"
developerConnection = "scm:git:$projectUrl"
url = projectUrl
}
}

developers {
developer {
id = "thake"
name = "Thorsten Hake"
email = "mail@thorsten-hake.com"
licenses {
license {
name = "Apache-2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
developer {
id = "chuckame"
name = "Antoine Michaud"
email = "contact@antoine-michaud.fr"

developers {
developer {
id = "thake"
name = "Thorsten Hake"
email = "mail@thorsten-hake.com"
}
developer {
id = "chuckame"
name = "Antoine Michaud"
email = "contact@antoine-michaud.fr"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import com.github.avrokotlin.avro4k.AvroAlias
import com.github.avrokotlin.avro4k.AvroDecoder
import com.github.avrokotlin.avro4k.AvroEncoder
import com.github.avrokotlin.avro4k.MissingFieldsEncodingException
import com.github.avrokotlin.avro4k.internal.Cache
import com.github.avrokotlin.avro4k.internal.WeakKeyCache
import com.github.avrokotlin.avro4k.internal.WeakIdentityKeyCache
import com.github.avrokotlin.avro4k.internal.aliases
import com.github.avrokotlin.avro4k.internal.isNamedSchema
import com.github.avrokotlin.avro4k.namedSchemaNotFoundInUnionError
Expand Down Expand Up @@ -203,7 +202,7 @@ internal object GenericFixedKSerializer : AvroSerializer<GenericFixed>(GenericFi
internal class GenericRecordKSerializer(
private val anySerializer: AnySerializer,
) : AvroSerializer<IndexedRecord>(IndexedRecord::class.qualifiedName!!) {
private val cache: Cache<Schema, SerialDescriptor> = WeakKeyCache()
private val cache = WeakIdentityKeyCache<Schema, SerialDescriptor>()

override fun serializeAvro(encoder: AvroEncoder, value: IndexedRecord) {
with(encoder) {
Expand Down
Loading