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
12 changes: 3 additions & 9 deletions base/src/main/kotlin/io/spine/protobuf/ProtoConverter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ internal abstract class ProtoConverter<M : Message, T : Any> : Converter<M, T>()
converter = BytesConverter()
} else if (isProtoEnum(type)) {
@Suppress("UNCHECKED_CAST")
val enumType = asProtoEnum(type) as Class<out Enum<out ProtocolMessageEnum>>
converter = EnumConverter(enumType)
val enumType = type as Class<out ProtocolMessageEnum>
@Suppress("UNCHECKED_CAST")
converter = EnumConverter(enumType as Class<Nothing>)
} else if (List::class.java.isAssignableFrom(type)) {
converter = ListConverter()
} else if (Map::class.java.isAssignableFrom(type)) {
Expand All @@ -108,13 +109,6 @@ internal abstract class ProtoConverter<M : Message, T : Any> : Converter<M, T>()
return Enum::class.java.isAssignableFrom(type)
&& ProtocolMessageEnum::class.java.isAssignableFrom(type)
}

@Suppress("UNCHECKED_CAST") // Checked at runtime.
private fun <T : Any> asProtoEnum(
type: Class<T>
): Class<out Enum<*>> {
return type as Class<out Enum<*>>
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion base/src/main/kotlin/io/spine/string/CharSequenceExts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private fun CharSequence.doReplace(replacementFn: (s: Separator) -> String): Str
if (prevEntry == null) {
append(s.substring(0, range.first))
} else {
append(s.substring(prevEntry!!.key.last + 1, range.first))
append(s.substring(prevEntry.key.last + 1, range.first))
}
val replacement = replacementFn.invoke(separator)
append(replacement)
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ val grGitVersion = "4.1.1"
* This version may change from the [version of Kotlin][io.spine.dependency.lib.Kotlin.version]
* used by the project.
*/
val kotlinEmbeddedVersion = "2.2.21"
val kotlinEmbeddedVersion = "2.3.10"

/**
* The version of Guava used in `buildSrc`.
*
* Always use the same version as the one specified in [io.spine.dependency.lib.Guava].
* Otherwise, when testing Gradle plugins, clashes may occur.
*/
val guavaVersion = "33.4.8-jre"
val guavaVersion = "33.5.0-jre"

/**
* The version of ErrorProne Gradle plugin.
Expand All @@ -103,7 +103,7 @@ val errorPronePluginVersion = "4.2.0"
* @see <a href="https://github.com/google/protobuf-gradle-plugin/releases">
* Protobuf Gradle Plugins Releases</a>
*/
val protobufPluginVersion = "0.9.5"
val protobufPluginVersion = "0.9.6"

/**
* The version of Dokka Gradle Plugins.
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object Kotlin : DependencyWithBom() {
* depend on Gradle and the version of embedded Kotlin.
*/
@Suppress("MemberVisibilityCanBePrivate") // used directly from the outside.
const val runtimeVersion = "2.2.21"
const val runtimeVersion = "2.3.10"

override val version = runtimeVersion
override val group = "org.jetbrains.kotlin"
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package io.spine.dependency.lib
)
object Protobuf {
const val group = "com.google.protobuf"
const val version = "4.33.2"
const val version = "4.34.0"

/**
* The Java library with Protobuf data types.
Expand Down Expand Up @@ -64,7 +64,7 @@ object Protobuf {
*
* When changing the version, also change the version used in the `build.gradle.kts`.
*/
const val version = "0.9.5"
const val version = "0.9.6"
const val id = "com.google.protobuf"
const val lib = "$group:protobuf-gradle-plugin:$version"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ package io.spine.gradle.kotlin

import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode

/**
* Sets [Java toolchain](https://kotlinlang.org/docs/gradle.html#gradle-java-toolchains-support)
Expand All @@ -53,10 +55,12 @@ fun KotlinJvmProjectExtension.applyJvmToolchain(version: String) =
*/
@Suppress("unused")
fun KotlinCommonCompilerOptions.setFreeCompilerArgs() {
if (this is KotlinJvmCompilerOptions) {
jvmDefault.set(JvmDefaultMode.ENABLE)
}
freeCompilerArgs.addAll(
listOf(
"-Xskip-prerelease-check",
"-Xjvm-default=all",
"-Xinline-classes",
"-Xexpect-actual-classes",
"-Xcontext-parameters",
Expand Down
17 changes: 7 additions & 10 deletions buildSrc/src/main/kotlin/io/spine/gradle/testing/Logging.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ package io.spine.gradle.testing

import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.TestDescriptor
import org.gradle.api.tasks.testing.TestListener
import org.gradle.api.tasks.testing.TestResult
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.kotlin.dsl.KotlinClosure2

/**
* Configures logging of this [Test] task.
Expand Down Expand Up @@ -70,19 +70,16 @@ fun Test.configureLogging() {
>> $skippedTestCount skipped
"""

afterSuite(

// `GroovyInteroperability` is employed as `afterSuite()` has no equivalent in Kotlin DSL.
// See issue: https://github.com/gradle/gradle/issues/5431

KotlinClosure2<TestDescriptor, TestResult, Unit>({ descriptor, result ->
val listener = object : TestListener {

override fun afterSuite(descriptor: TestDescriptor, result: TestResult) {
// If the descriptor has no parent, then it is the root test suite,
// i.e. it includes the info about all the run tests.

if (descriptor.parent == null) {
logger.lifecycle(result.summary())
}
})
)
}
}

addTestListener(listener)
}
Loading
Loading