Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build-on-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
# there anyway).
- name: Upload code coverage report
if: steps.codecov.outputs.available == 'true' || github.event_name == 'push'
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
package io.spine.dependency.local

import io.spine.dependency.Dependency
import io.spine.dependency.local.Compiler.DF_VERSION_ENV
import io.spine.dependency.local.Compiler.VERSION_ENV
Comment thread
alexander-yevsyukov marked this conversation as resolved.

/**
* Dependencies on the Spine Compiler modules.
Expand Down Expand Up @@ -72,7 +74,7 @@ object Compiler : Dependency() {
* The version of the Compiler dependencies.
*/
override val version: String
private const val fallbackVersion = "2.0.0-SNAPSHOT.056"
private const val fallbackVersion = "2.0.0-SNAPSHOT.057"

/**
* The distinct version of the Compiler used by other build tools.
Expand All @@ -81,7 +83,7 @@ object Compiler : Dependency() {
* transitive dependencies, this is the version used to build the project itself.
*/
val dogfoodingVersion: String
private const val fallbackDfVersion = "2.0.0-SNAPSHOT.056"
private const val fallbackDfVersion = "2.0.0-SNAPSHOT.057"

/**
* The artifact for the Compiler Gradle plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package io.spine.dependency.local
*/
@Suppress("ConstPropertyName", "unused")
object Logging {
const val version = "2.0.0-SNAPSHOT.417"
const val version = "2.0.0-SNAPSHOT.419"
Comment thread
alexander-yevsyukov marked this conversation as resolved.
const val group = Spine.group

const val loggingArtifact = "spine-logging"
Expand Down
20 changes: 13 additions & 7 deletions buildSrc/src/main/kotlin/io/spine/gradle/kotlin/KotlinConfig.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, TeamDev. All rights reserved.
* Copyright 2026, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,20 +55,26 @@ fun KotlinJvmProjectExtension.applyJvmToolchain(version: String) =
*/
@Suppress("unused")
fun KotlinCommonCompilerOptions.setFreeCompilerArgs() {
val optIns = mutableListOf(
"kotlin.contracts.ExperimentalContracts",
"kotlin.ExperimentalUnsignedTypes",
"kotlin.ExperimentalStdlibApi",
"kotlin.experimental.ExperimentalTypeInference",
)
if (this is KotlinJvmCompilerOptions) {
jvmDefault.set(JvmDefaultMode.NO_COMPATIBILITY)
// `kotlin.io.path` ships only in the JVM standard library, so for common
// and Native compilations this opt-in marker is unresolved and the compiler
// warns about it. Scope it to JVM compilations; multiplatform common and
// Native code cannot use the API anyway.
optIns.add("kotlin.io.path.ExperimentalPathApi")
}
freeCompilerArgs.addAll(
listOf(
"-Xskip-prerelease-check",
"-Xexpect-actual-classes",
"-Xcontext-parameters",
"-opt-in=" +
"kotlin.contracts.ExperimentalContracts," +
"kotlin.io.path.ExperimentalPathApi," +
"kotlin.ExperimentalUnsignedTypes," +
"kotlin.ExperimentalStdlibApi," +
"kotlin.experimental.ExperimentalTypeInference",
"-opt-in=" + optIns.joinToString(separator = ","),
)
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, TeamDev. All rights reserved.
* Copyright 2026, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -87,6 +87,15 @@ abstract class AbstractContextDataProviderSpec {
private companion object {
private val FOO = MetadataKey.single<String>("foo")
private val BAR = MetadataKey.repeated<String>("bar")

/**
* A custom [MetadataKey] created by subclassing rather than via the factory
* functions, reproducing the scenario from
* [issue #70](https://github.com/SpineEventEngine/logging/issues/70).
*/
private val CUSTOM =
object : MetadataKey<String>("custom", String::class, canRepeat = false) {}

private val SUB_TASK = ScopeType.create("sub task")
private val BATCH_JOB = ScopeType.create("batch job")
}
Expand Down Expand Up @@ -157,6 +166,30 @@ abstract class AbstractContextDataProviderSpec {
checkCallbackWasExecuted()
}

/**
* Verifies that a custom [MetadataKey] — created by subclassing rather than via
* the factory functions — can be attached to a context and is delivered to the
* context metadata.
*
* This is a regression test for
* [issue #70](https://github.com/SpineEventEngine/logging/issues/70), where
* passing a custom key to `withMetadata` used to throw a `ClassCastException`
* on the JVM.
*/
@Test
fun `with a custom metadata key`() {
val value = "custom-value"
contextMetadata.shouldBeEmpty()
context.newContext()
.withMetadata(CUSTOM, value)
.call {
contextMetadata.shouldUniquelyContain(CUSTOM, value)
markCallbackExecuted()
}
contextMetadata.shouldBeEmpty()
checkCallbackWasExecuted()
}

@Test
fun `with a log level map`() {
val defaultLevel = TLevel.FINE
Expand Down
Loading
Loading