diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index a13b191195..b2955de38a 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -16,4 +16,4 @@ jobs: uses: actions/checkout@v4 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/actions/wrapper-validation@v4 diff --git a/buildSrc/src/main/kotlin/DependencyResolution.kt b/buildSrc/src/main/kotlin/DependencyResolution.kt index 25ae2b431c..d81c3b9613 100644 --- a/buildSrc/src/main/kotlin/DependencyResolution.kt +++ b/buildSrc/src/main/kotlin/DependencyResolution.kt @@ -46,6 +46,7 @@ import io.spine.dependency.lib.Okio import io.spine.dependency.lib.Plexus import io.spine.dependency.lib.Protobuf import io.spine.dependency.lib.Slf4J +import io.spine.dependency.local.Base import io.spine.dependency.local.Spine import io.spine.dependency.test.Hamcrest import io.spine.dependency.test.JUnit @@ -186,7 +187,7 @@ fun ModuleDependency.excludeSpineBase() { fun Project.forceSpineBase() { configurations.all { resolutionStrategy { - force(Spine.base) + force(Base.lib) } } } @@ -200,7 +201,7 @@ fun Project.forceBaseInProtoTasks() { configurations.configureEach { if (name.lowercased().contains("proto")) { resolutionStrategy { - force(Spine.baseForBuildScript) + force(Base.libForBuildScript) } } } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt b/buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt index 7ce19e043d..f8320d0d5b 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt @@ -31,17 +31,20 @@ package io.spine.dependency.build object ErrorProne { // https://github.com/google/error-prone private const val version = "2.23.0" + + const val group = "com.google.errorprone" + // https://github.com/tbroyer/gradle-errorprone-plugin/blob/v0.8/build.gradle.kts private const val javacPluginVersion = "9+181-r4173-1" val annotations = listOf( - "com.google.errorprone:error_prone_annotations:$version", - "com.google.errorprone:error_prone_type_annotations:$version" + "$group:error_prone_annotations:$version", + "$group:error_prone_type_annotations:$version" ) - const val core = "com.google.errorprone:error_prone_core:$version" - const val checkApi = "com.google.errorprone:error_prone_check_api:$version" - const val testHelpers = "com.google.errorprone:error_prone_test_helpers:$version" - const val javacPlugin = "com.google.errorprone:javac:$javacPluginVersion" + const val core = "$group:error_prone_core:$version" + const val checkApi = "$group:error_prone_check_api:$version" + const val testHelpers = "$group:error_prone_test_helpers:$version" + const val javacPlugin = "$group:javac:$javacPluginVersion" // https://github.com/tbroyer/gradle-errorprone-plugin/releases object GradlePlugin { diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Asm.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Asm.kt index 3975683d9d..b64a5f9232 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Asm.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Asm.kt @@ -30,13 +30,14 @@ package io.spine.dependency.lib @Suppress("unused", "ConstPropertyName") object Asm { private const val version = "9.6" - const val lib = "org.ow2.asm:asm:$version" + const val group = "org.ow2.asm" + const val lib = "$group:asm:$version" // We use the following artifacts only to force the versions // of the dependencies which are transitive for us. // - const val tree = "org.ow2.asm:asm-tree:$version" - const val analysis = "org.ow2.asm:asm-analysis:$version" - const val util = "org.ow2.asm:asm-util:$version" - const val commons = "org.ow2.asm:asm-commons:$version" + const val tree = "$group:asm-tree:$version" + const val analysis = "$group:asm-analysis:$version" + const val util = "$group:asm-util:$version" + const val commons = "$group:asm-commons:$version" } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt index 9449f120ff..f494979fa0 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt @@ -31,20 +31,21 @@ package io.spine.dependency.lib object Grpc { @Suppress("MemberVisibilityCanBePrivate") const val version = "1.59.0" - const val api = "io.grpc:grpc-api:$version" - const val auth = "io.grpc:grpc-auth:$version" - const val core = "io.grpc:grpc-core:$version" - const val context = "io.grpc:grpc-context:$version" - const val inProcess = "io.grpc:grpc-inprocess:$version" - const val stub = "io.grpc:grpc-stub:$version" - const val okHttp = "io.grpc:grpc-okhttp:$version" - const val protobuf = "io.grpc:grpc-protobuf:$version" - const val protobufLite = "io.grpc:grpc-protobuf-lite:$version" - const val netty = "io.grpc:grpc-netty:$version" - const val nettyShaded = "io.grpc:grpc-netty-shaded:$version" + const val group = "io.grpc" + const val api = "$group:grpc-api:$version" + const val auth = "$group:grpc-auth:$version" + const val core = "$group:grpc-core:$version" + const val context = "$group:grpc-context:$version" + const val inProcess = "$group:grpc-inprocess:$version" + const val stub = "$group:grpc-stub:$version" + const val okHttp = "$group:grpc-okhttp:$version" + const val protobuf = "$group:grpc-protobuf:$version" + const val protobufLite = "$group:grpc-protobuf-lite:$version" + const val netty = "$group:grpc-netty:$version" + const val nettyShaded = "$group:grpc-netty-shaded:$version" object ProtocPlugin { const val id = "grpc" - const val artifact = "io.grpc:protoc-gen-grpc-java:$version" + const val artifact = "$group:protoc-gen-grpc-java:$version" } } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt index 78dd2a5840..561c792b15 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt @@ -38,6 +38,7 @@ package io.spine.dependency.lib @Suppress("unused", "ConstPropertyName") object Guava { private const val version = "32.1.3-jre" - const val lib = "com.google.guava:guava:$version" - const val testLib = "com.google.guava:guava-testlib:$version" + const val group = "com.google.guava" + const val lib = "$group:guava:$version" + const val testLib = "$group:guava-testlib:$version" } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaPoet.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaPoet.kt index e17a18066a..b493c15a38 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaPoet.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaPoet.kt @@ -30,5 +30,8 @@ package io.spine.dependency.lib @Suppress("unused", "ConstPropertyName") object JavaPoet { private const val version = "1.13.0" - const val lib = "com.squareup:javapoet:$version" + const val group = "com.squareup" + const val artifact = "javapoet" + const val module = "$group:$artifact" + const val lib = "$module:$version" } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaX.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaX.kt index 4db379b6b8..e4bff56e97 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaX.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaX.kt @@ -30,7 +30,8 @@ package io.spine.dependency.lib object JavaX { // This artifact, which used to be a part of J2EE, moved under the Eclipse EE4J project. // https://github.com/eclipse-ee4j/common-annotations-api - const val annotations = "javax.annotation:javax.annotation-api:1.3.2" + const val annotationGroup = "javax.annotation" + const val annotations = "$annotationGroup:javax.annotation-api:1.3.2" const val servletApi = "javax.servlet:javax.servlet-api:3.1.0" } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinX.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinX.kt index 5b6572c305..ff02a1e3dd 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinX.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinX.kt @@ -34,8 +34,9 @@ object KotlinX { object Coroutines { // https://github.com/Kotlin/kotlinx.coroutines - const val version = "1.7.3" + const val version = "1.9.0" const val core = "$group:kotlinx-coroutines-core:$version" const val jdk8 = "$group:kotlinx-coroutines-jdk8:$version" + const val test = "$group:kotlinx-coroutines-test:$version" } } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt index 6794c1a5c7..083c6f93fc 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt @@ -32,7 +32,7 @@ package io.spine.dependency.lib "ConstPropertyName" /* https://bit.ly/kotlin-prop-names */ ) object Protobuf { - private const val group = "com.google.protobuf" + const val group = "com.google.protobuf" const val version = "3.25.1" /** diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Roaster.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Roaster.kt index 2bf9b5c986..6b92054b29 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Roaster.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Roaster.kt @@ -39,6 +39,7 @@ object Roaster { */ private const val version = "2.28.0.Final" - const val api = "org.jboss.forge.roaster:roaster-api:$version" - const val jdt = "org.jboss.forge.roaster:roaster-jdt:$version" + const val group = "org.jboss.forge.roaster" + const val api = "$group:roaster-api:$version" + const val jdt = "$group:roaster-jdt:$version" } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/ArtifactVersion.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/ArtifactVersion.kt index 3cc5d3e0fd..6b36b6dd9b 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ArtifactVersion.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ArtifactVersion.kt @@ -37,15 +37,23 @@ object ArtifactVersion { * * @see spine-base */ - const val base = "2.0.0-SNAPSHOT.220" - const val baseForBuildScript = "2.0.0-SNAPSHOT.220" + @Deprecated(message = "Please use `Base.version`.", ReplaceWith("Base.version")) + const val base = Base.version + + @Suppress("unused") + @Deprecated( + message = "Please use `Base.versionForBuildScript`.", + ReplaceWith("Base.versionForBuildScript") + ) + const val baseForBuildScript = Base.versionForBuildScript /** * The version of [Spine.reflect]. * * @see spine-reflect */ - const val reflect = "2.0.0-SNAPSHOT.190" + @Deprecated(message = "Please use `Reflect.version`.", ReplaceWith("Reflect.version")) + const val reflect = Reflect.version /** * The version of [Logging]. @@ -58,7 +66,8 @@ object ArtifactVersion { * * @see spine-testlib */ - const val testlib = "2.0.0-SNAPSHOT.184" + @Deprecated(message = "Please use `TestLib.version`.", ReplaceWith("TestLib.version")) + const val testlib = TestLib.version /** * The version of `core-java`. @@ -71,41 +80,51 @@ object ArtifactVersion { * * @see spine-model-compiler */ - const val mc = "2.0.0-SNAPSHOT.133" + @Deprecated( + message = "Please use `ModelCompiler.version` instead.", + ReplaceWith("ModelCompiler.version") + ) + const val mc = ModelCompiler.version /** * The version of [Spine.baseTypes]. * * @see spine-base-types */ - const val baseTypes = "2.0.0-SNAPSHOT.126" + @Deprecated(message = "Please use `BaseTypes.version`.", ReplaceWith("BaseTypes.version")) + const val baseTypes = BaseTypes.version /** * The version of [Spine.time]. * * @see spine-time */ - const val time = "2.0.0-SNAPSHOT.135" + @Deprecated(message = "Please use `Time.version`.", ReplaceWith("Time.version")) + const val time = Time.version /** * The version of [Spine.change]. * * @see spine-change */ - const val change = "2.0.0-SNAPSHOT.118" + @Deprecated(message = "Please use `Change.version`.", ReplaceWith("Change.version")) + const val change = Change.version /** * The version of [Spine.text]. * * @see spine-text */ - const val text = "2.0.0-SNAPSHOT.6" + @Deprecated(message = "Please use `Text.version`.", ReplaceWith("Text.version")) + const val text = Text.version /** * The version of [Spine.toolBase]. * * @see spine-tool-base */ + @Suppress("unused") + @Deprecated(message = "Please use `ToolBase.version`.", ReplaceWith("ToolBase.version")) const val toolBase = ToolBase.version /** diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt new file mode 100644 index 0000000000..3d6f52a4ab --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.dependency.local + +/** + * Spine Base module. + * + * @see spine-base + */ +@Suppress("ConstPropertyName") +object Base { + const val version = "2.0.0-SNAPSHOT.231" + const val versionForBuildScript = "2.0.0-SNAPSHOT.231" + const val group = Spine.group + const val artifact = "spine-base" + const val lib = "$group:$artifact:$version" + const val libForBuildScript = "$group:$artifact:$versionForBuildScript" +} diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/BaseTypes.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/BaseTypes.kt new file mode 100644 index 0000000000..878489b874 --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/BaseTypes.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.dependency.local + +/** + * Spine Base module. + * + * @see spine-base-types + */ +@Suppress("ConstPropertyName") +object BaseTypes { + const val version = "2.0.0-SNAPSHOT.126" + const val group = Spine.group + const val artifact = "spine-base-types" + const val lib = "$group:$artifact:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Change.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Change.kt new file mode 100644 index 0000000000..e242e90b2e --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Change.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.dependency.local + +/** + * Spine Reflect library. + * + * @see spine-change + */ +@Suppress("ConstPropertyName") +object Change { + const val version = "2.0.0-SNAPSHOT.118" + const val group = Spine.group + const val artifact = "spine-change" + const val lib = "$group:$artifact:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJava.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJava.kt index 0b3682c983..871682f1f8 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJava.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJava.kt @@ -34,9 +34,15 @@ package io.spine.dependency.local @Suppress("ConstPropertyName", "unused") object CoreJava { const val group = Spine.group - const val version = "2.0.0-SNAPSHOT.177" - const val core = "$group:spine-core:$version" - const val client = "$group:spine-client:$version" - const val server = "$group:spine-server:$version" + const val version = "2.0.0-SNAPSHOT.182" + + const val coreArtifact = "spine-core" + const val clientArtifact = "spine-client" + const val serverArtifact = "spine-server" + + const val core = "$group:$coreArtifact:$version" + const val client = "$group:$clientArtifact:$version" + const val server = "$group:$serverArtifact:$version" + const val testUtilServer = "${Spine.toolsGroup}:spine-testutil-server:$version" } diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt index 4afa43c13c..ab7efb1b7a 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt @@ -33,9 +33,12 @@ package io.spine.dependency.local */ @Suppress("ConstPropertyName", "unused") object Logging { - const val version = "2.0.0-SNAPSHOT.240" + const val version = "2.0.0-SNAPSHOT.242" const val group = Spine.group - const val lib = "$group:spine-logging:$version" + + const val loggingArtifact = "spine-logging" + + const val lib = "$group:$loggingArtifact:$version" const val libJvm = "$group:spine-logging-jvm:$version" const val log4j2Backend = "$group:spine-logging-log4j2-backend:$version" diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt index 4eded11e0e..304ea7a1a3 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt @@ -42,12 +42,12 @@ object McJava { /** * The version used to in the build classpath. */ - const val dogfoodingVersion = "2.0.0-SNAPSHOT.257" + const val dogfoodingVersion = "2.0.0-SNAPSHOT.259" /** * The version to be used for integration tests. */ - const val version = "2.0.0-SNAPSHOT.257" + const val version = "2.0.0-SNAPSHOT.259" /** * The ID of the Gradle plugin. diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/ModelCompiler.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/ModelCompiler.kt new file mode 100644 index 0000000000..c1ca804e82 --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ModelCompiler.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.dependency.local + +/** + * Spine Model Compiler Gradle API. + * + * @see spine-model-compiler + */ +@Suppress("ConstPropertyName") +object ModelCompiler { + const val version = "2.0.0-SNAPSHOT.133" + const val group = Spine.toolsGroup + const val artifact = "spine-model-compiler" + const val lib = "$group:$artifact:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt index d7841c1a43..7f6a1ed77a 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt @@ -73,7 +73,7 @@ object ProtoData { * The version of ProtoData dependencies. */ val version: String - private const val fallbackVersion = "0.69.0" + private const val fallbackVersion = "0.70.3" /** * The distinct version of ProtoData used by other build tools. @@ -82,7 +82,7 @@ object ProtoData { * transitional dependencies, this is the version used to build the project itself. */ val dogfoodingVersion: String - private const val fallbackDfVersion = "0.69.0" + private const val fallbackDfVersion = "0.70.3" /** * The artifact for the ProtoData Gradle plugin. @@ -115,8 +115,10 @@ object ProtoData { val cliApi get() = "$group:protodata-cli-api:$version" + val javaModule = "$group:protodata-java" + fun java(version: String): String = - "$group:protodata-java:$version" + "$javaModule:$version" val java get() = java(version) diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Reflect.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Reflect.kt new file mode 100644 index 0000000000..64fd3bf427 --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Reflect.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.dependency.local + +/** + * Spine Reflect library. + * + * @see spine-reflect + */ +@Suppress("ConstPropertyName") +object Reflect { + const val version = "2.0.0-SNAPSHOT.191" + const val group = Spine.group + const val artifact = "spine-reflect" + const val lib = "$group:$artifact:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Spine.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Spine.kt index fb69374c86..bdf6d15586 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/Spine.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Spine.kt @@ -35,30 +35,59 @@ object Spine { const val group = "io.spine" const val toolsGroup = "io.spine.tools" - const val base = "$group:spine-base:${ArtifactVersion.base}" - const val baseForBuildScript = "$group:spine-base:${ArtifactVersion.baseForBuildScript}" + @Deprecated(message = "Please use `Base.lib`.", ReplaceWith("Base.lib")) + const val base = Base.lib - const val reflect = "$group:spine-reflect:${ArtifactVersion.reflect}" - const val baseTypes = "$group:spine-base-types:${ArtifactVersion.baseTypes}" - const val time = "$group:spine-time:${ArtifactVersion.time}" - const val change = "$group:spine-change:${ArtifactVersion.change}" - const val text = "$group:spine-text:${ArtifactVersion.text}" + @Deprecated( + message = "Please use `Base.libForBuildScript`.", + ReplaceWith("Base.libForBuildScript") + ) + const val baseForBuildScript = Base.libForBuildScript + + @Deprecated(message = "Please use `Reflect.lib`.", ReplaceWith("Reflect.lib")) + const val reflect = Reflect.lib + + @Deprecated(message = "Please use `BaseTypes.lib`.", ReplaceWith("BaseTypes.lib")) + const val baseTypes = BaseTypes.lib + + @Deprecated(message = "Please use `Time.lib`.", ReplaceWith("Time.lib")) + const val time = Time.lib + + @Deprecated(message = "Please use `Time.lib`.", ReplaceWith("Time.lib")) + const val change = Change.lib + + @Deprecated(message = "Please use `Text.lib`.", ReplaceWith("Text.lib")) + const val text = Text.lib + + @Deprecated(message = "Please use `TestLib.lib`.", ReplaceWith("TestLib.lib")) + const val testlib = TestLib.lib - const val testlib = "$toolsGroup:spine-testlib:${ArtifactVersion.testlib}" - const val testUtilTime = "$toolsGroup:spine-testutil-time:${ArtifactVersion.time}" + @Deprecated(message = "Please use `Time.testLib`.", ReplaceWith("Time.testLib")) + const val testUtilTime = Time.testLib @Deprecated(message = "Please use `ToolBase.psiJava` instead`.") - const val psiJava = "$toolsGroup:spine-psi-java:${ArtifactVersion.toolBase}" + const val psiJava = "$toolsGroup:spine-psi-java:${ToolBase.version}" + @Deprecated(message = "Please use `ToolBase.psiJava` instead`.") - const val psiJavaBundle = "$toolsGroup:spine-psi-java-bundle:${ArtifactVersion.toolBase}" + const val psiJavaBundle = "$toolsGroup:spine-psi-java-bundle:${ToolBase.version}" + @Deprecated(message = "Please use `ToolBase.lib` instead`.") - const val toolBase = "$toolsGroup:spine-tool-base:${ArtifactVersion.toolBase}" + const val toolBase = "$toolsGroup:spine-tool-base:${ToolBase.version}" + @Deprecated(message = "Please use `ToolBase.pluginBase` instead`.") - const val pluginBase = "$toolsGroup:spine-plugin-base:${ArtifactVersion.toolBase}" - @Deprecated(message = "Please use `ToolBase.pluginTestlib` instead`.") - const val pluginTestlib = "$toolsGroup:spine-plugin-testlib:${ArtifactVersion.toolBase}" + const val pluginBase = "$toolsGroup:spine-plugin-base:${ToolBase.version}" + + @Deprecated( + message = "Please use `ToolBase.pluginTestlib` instead`.", + ReplaceWith("ToolBase.pluginTestlib") + ) + const val pluginTestlib = ToolBase.pluginTestlib - const val modelCompiler = "$toolsGroup:spine-model-compiler:${ArtifactVersion.mc}" + @Deprecated( + message = "Please use `ModelCompiler.lib` instead.", + ReplaceWith("ModelCompiler.lib") + ) + const val modelCompiler = ModelCompiler.lib @Deprecated( message = "Please use top level `McJava` object instead.", diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/TestLib.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/TestLib.kt new file mode 100644 index 0000000000..c0dd1c22ed --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/TestLib.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.dependency.local + +/** + * Spine TestLib library. + * + * @see spine-testlib + */ +@Suppress("ConstPropertyName") +object TestLib { + const val version = "2.0.0-SNAPSHOT.184" + const val group = Spine.toolsGroup + const val artifact = "spine-testlib" + const val lib = "$group:$artifact:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Text.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Text.kt new file mode 100644 index 0000000000..50eed3a88a --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Text.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.dependency.local + +/** + * Spine Reflect library. + * + * @see spine-text + */ +@Suppress("ConstPropertyName") +object Text { + const val version = "2.0.0-SNAPSHOT.6" + const val group = Spine.group + const val artifact = "spine-text" + const val lib = "$group:$artifact:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Time.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Time.kt new file mode 100644 index 0000000000..489e58e852 --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Time.kt @@ -0,0 +1,43 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.dependency.local + +/** + * Spine Time library. + * + * @see spine-time + */ +@Suppress("ConstPropertyName") +object Time { + const val version = "2.0.0-SNAPSHOT.135" + const val group = Spine.group + const val artifact = "spine-time" + const val lib = "$group:$artifact:$version" + + //TODO:2024-11-29:alexander.yevsyukov: Change the artifact name to `spine-time-testlib`. + const val testLib = "${Spine.toolsGroup}:spine-testutil-time:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt index d19a1aaa42..ca15c2c1da 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt @@ -34,7 +34,7 @@ package io.spine.dependency.local @Suppress("ConstPropertyName", "unused") object ToolBase { const val group = Spine.toolsGroup - const val version = "2.0.0-SNAPSHOT.233" + const val version = "2.0.0-SNAPSHOT.234" const val lib = "$group:spine-tool-base:$version" const val pluginBase = "$group:spine-plugin-base:$version" diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt index 81cc7bb575..becd2c74ab 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt @@ -31,21 +31,24 @@ package io.spine.dependency.local * * See [`SpineEventEngine/validation`](https://github.com/SpineEventEngine/validation/). */ -@Suppress("unused", "ConstPropertyName") +@Suppress("ConstPropertyName") object Validation { /** * The version of the Validation library artifacts. */ - const val version = "2.0.0-SNAPSHOT.172" + const val version = "2.0.0-SNAPSHOT.178" const val group = "io.spine.validation" private const val prefix = "spine-validation" - const val runtime = "$group:$prefix-java-runtime:$version" + const val runtimeModule = "$group:$prefix-java-runtime" + const val runtime = "$runtimeModule:$version" const val java = "$group:$prefix-java:$version" + const val javaBundleModule = "$group:$prefix-java-bundle" + /** Obtains the artifact for the `java-bundle` artifact of the given version. */ - fun javaBundle(version: String) = "$group:$prefix-java-bundle:$version" + fun javaBundle(version: String) = "$javaBundleModule:$version" val javaBundle = javaBundle(version) diff --git a/buildSrc/src/main/kotlin/jvm-module.gradle.kts b/buildSrc/src/main/kotlin/jvm-module.gradle.kts index 76a70de6be..9e5567e0a2 100644 --- a/buildSrc/src/main/kotlin/jvm-module.gradle.kts +++ b/buildSrc/src/main/kotlin/jvm-module.gradle.kts @@ -32,7 +32,8 @@ import io.spine.dependency.lib.Guava import io.spine.dependency.lib.JavaX import io.spine.dependency.lib.Protobuf import io.spine.dependency.local.Logging -import io.spine.dependency.local.Spine +import io.spine.dependency.local.Reflect +import io.spine.dependency.local.TestLib import io.spine.dependency.test.JUnit import io.spine.dependency.test.Jacoco import io.spine.dependency.test.Kotest @@ -144,7 +145,7 @@ fun Module.addDependencies() = dependencies { testImplementation(JUnit.pioneer) JUnit.api.forEach { testImplementation(it) } - testImplementation(Spine.testlib) + testImplementation(TestLib.lib) testImplementation(Kotest.frameworkEngine) testImplementation(Kotest.datatest) testImplementation(Kotest.runnerJUnit5Jvm) @@ -161,7 +162,7 @@ fun Module.forceConfigurations() { JUnit.bom, JUnit.runner, Dokka.BasePlugin.lib, - Spine.reflect + Reflect.lib, ) } } diff --git a/client/src/main/java/io/spine/client/TargetMixin.java b/client/src/main/java/io/spine/client/TargetMixin.java index 8119947a63..2116bf8da8 100644 --- a/client/src/main/java/io/spine/client/TargetMixin.java +++ b/client/src/main/java/io/spine/client/TargetMixin.java @@ -63,7 +63,7 @@ default Class messageClass() { * Obtains the descriptor of the target type. */ default Descriptor messageDescriptor() { - var result = type().toTypeName() + var result = type().typeName() .messageDescriptor(); return result; } diff --git a/config b/config index 9647c1732e..86f3cacae0 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit 9647c1732e7bfdd3b6ad0c0039d0cdf57681cf23 +Subproject commit 86f3cacae06a1843e7276208f3a2fd81fe1f7ae2 diff --git a/dependencies.md b/dependencies.md index 6ff97d1d87..93e7de672e 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine:spine-client:2.0.0-SNAPSHOT.183` +# Dependencies of `io.spine:spine-client:2.0.0-SNAPSHOT.190` ## Runtime 1. **Group** : com.google.android. **Name** : annotations. **Version** : 4.1.1.4. @@ -23,10 +23,6 @@ * **Project URL:** [https://errorprone.info/error_prone_annotations](https://errorprone.info/error_prone_annotations) * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group** : com.google.errorprone. **Name** : error_prone_type_annotations. **Version** : 2.23.0. - * **Project URL:** [https://errorprone.info/error_prone_type_annotations](https://errorprone.info/error_prone_type_annotations) - * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) - 1. **Group** : com.google.guava. **Name** : failureaccess. **Version** : 1.0.1. * **Project URL:** [https://github.com/google/guava/](https://github.com/google/guava/) * **License:** [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -89,10 +85,6 @@ * **Project URL:** [https://github.com/perfmark/perfmark](https://github.com/perfmark/perfmark) * **License:** [Apache 2.0](https://opensource.org/licenses/Apache-2.0) -1. **Group** : javax.annotation. **Name** : javax.annotation-api. **Version** : 1.3.2. - * **Project URL:** [http://jcp.org/en/jsr/detail?id=250](http://jcp.org/en/jsr/detail?id=250) - * **License:** [CDDL + GPLv2 with classpath exception](https://github.com/javaee/javax.annotation/blob/master/LICENSE) - 1. **Group** : org.checkerframework. **Name** : checker-qual. **Version** : 3.40.0. * **Project URL:** [https://checkerframework.org/](https://checkerframework.org/) * **License:** [The MIT License](http://opensource.org/licenses/MIT) @@ -854,12 +846,12 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri Dec 13 20:09:56 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-core:2.0.0-SNAPSHOT.183` +# Dependencies of `io.spine:spine-core:2.0.0-SNAPSHOT.190` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -874,10 +866,6 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice * **Project URL:** [https://errorprone.info/error_prone_annotations](https://errorprone.info/error_prone_annotations) * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group** : com.google.errorprone. **Name** : error_prone_type_annotations. **Version** : 2.23.0. - * **Project URL:** [https://errorprone.info/error_prone_type_annotations](https://errorprone.info/error_prone_type_annotations) - * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) - 1. **Group** : com.google.guava. **Name** : failureaccess. **Version** : 1.0.1. * **Project URL:** [https://github.com/google/guava/](https://github.com/google/guava/) * **License:** [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -904,10 +892,6 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice 1. **Group** : com.google.protobuf. **Name** : protobuf-kotlin. **Version** : 3.25.1. * **License:** [BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -1. **Group** : javax.annotation. **Name** : javax.annotation-api. **Version** : 1.3.2. - * **Project URL:** [http://jcp.org/en/jsr/detail?id=250](http://jcp.org/en/jsr/detail?id=250) - * **License:** [CDDL + GPLv2 with classpath exception](https://github.com/javaee/javax.annotation/blob/master/LICENSE) - 1. **Group** : org.checkerframework. **Name** : checker-qual. **Version** : 3.40.0. * **Project URL:** [https://checkerframework.org/](https://checkerframework.org/) * **License:** [The MIT License](http://opensource.org/licenses/MIT) @@ -1665,12 +1649,12 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri Dec 13 20:09:56 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-server:2.0.0-SNAPSHOT.183` +# Dependencies of `io.spine:spine-server:2.0.0-SNAPSHOT.190` ## Runtime 1. **Group** : com.google.android. **Name** : annotations. **Version** : 4.1.1.4. @@ -1693,10 +1677,6 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice * **Project URL:** [https://errorprone.info/error_prone_annotations](https://errorprone.info/error_prone_annotations) * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group** : com.google.errorprone. **Name** : error_prone_type_annotations. **Version** : 2.23.0. - * **Project URL:** [https://errorprone.info/error_prone_type_annotations](https://errorprone.info/error_prone_type_annotations) - * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) - 1. **Group** : com.google.guava. **Name** : failureaccess. **Version** : 1.0.1. * **Project URL:** [https://github.com/google/guava/](https://github.com/google/guava/) * **License:** [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -1759,10 +1739,6 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice * **Project URL:** [https://github.com/perfmark/perfmark](https://github.com/perfmark/perfmark) * **License:** [Apache 2.0](https://opensource.org/licenses/Apache-2.0) -1. **Group** : javax.annotation. **Name** : javax.annotation-api. **Version** : 1.3.2. - * **Project URL:** [http://jcp.org/en/jsr/detail?id=250](http://jcp.org/en/jsr/detail?id=250) - * **License:** [CDDL + GPLv2 with classpath exception](https://github.com/javaee/javax.annotation/blob/master/LICENSE) - 1. **Group** : org.checkerframework. **Name** : checker-qual. **Version** : 3.40.0. * **Project URL:** [https://checkerframework.org/](https://checkerframework.org/) * **License:** [The MIT License](http://opensource.org/licenses/MIT) @@ -2532,12 +2508,12 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri Dec 13 20:09:57 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-testutil-client:2.0.0-SNAPSHOT.183` +# Dependencies of `io.spine.tools:spine-testutil-client:2.0.0-SNAPSHOT.190` ## Runtime 1. **Group** : com.google.android. **Name** : annotations. **Version** : 4.1.1.4. @@ -2564,10 +2540,6 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice * **Project URL:** [https://errorprone.info/error_prone_annotations](https://errorprone.info/error_prone_annotations) * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group** : com.google.errorprone. **Name** : error_prone_type_annotations. **Version** : 2.23.0. - * **Project URL:** [https://errorprone.info/error_prone_type_annotations](https://errorprone.info/error_prone_type_annotations) - * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) - 1. **Group** : com.google.flogger. **Name** : flogger. **Version** : 0.7.4. * **Project URL:** [https://github.com/google/flogger](https://github.com/google/flogger) * **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) @@ -2688,10 +2660,6 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice * **Project URL:** [https://github.com/perfmark/perfmark](https://github.com/perfmark/perfmark) * **License:** [Apache 2.0](https://opensource.org/licenses/Apache-2.0) -1. **Group** : javax.annotation. **Name** : javax.annotation-api. **Version** : 1.3.2. - * **Project URL:** [http://jcp.org/en/jsr/detail?id=250](http://jcp.org/en/jsr/detail?id=250) - * **License:** [CDDL + GPLv2 with classpath exception](https://github.com/javaee/javax.annotation/blob/master/LICENSE) - 1. **Group** : junit. **Name** : junit. **Version** : 4.13.1. * **Project URL:** [http://junit.org](http://junit.org) * **License:** [Eclipse Public License 1.0](http://www.eclipse.org/legal/epl-v10.html) @@ -3514,12 +3482,12 @@ This report was generated on **Tue Nov 26 19:02:31 WET 2024** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri Dec 13 20:09:57 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-testutil-core:2.0.0-SNAPSHOT.183` +# Dependencies of `io.spine.tools:spine-testutil-core:2.0.0-SNAPSHOT.190` ## Runtime 1. **Group** : com.google.android. **Name** : annotations. **Version** : 4.1.1.4. @@ -3546,10 +3514,6 @@ This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-Lice * **Project URL:** [https://errorprone.info/error_prone_annotations](https://errorprone.info/error_prone_annotations) * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group** : com.google.errorprone. **Name** : error_prone_type_annotations. **Version** : 2.23.0. - * **Project URL:** [https://errorprone.info/error_prone_type_annotations](https://errorprone.info/error_prone_type_annotations) - * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) - 1. **Group** : com.google.flogger. **Name** : flogger. **Version** : 0.7.4. * **Project URL:** [https://github.com/google/flogger](https://github.com/google/flogger) * **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) @@ -3670,10 +3634,6 @@ This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-Lice * **Project URL:** [https://github.com/perfmark/perfmark](https://github.com/perfmark/perfmark) * **License:** [Apache 2.0](https://opensource.org/licenses/Apache-2.0) -1. **Group** : javax.annotation. **Name** : javax.annotation-api. **Version** : 1.3.2. - * **Project URL:** [http://jcp.org/en/jsr/detail?id=250](http://jcp.org/en/jsr/detail?id=250) - * **License:** [CDDL + GPLv2 with classpath exception](https://github.com/javaee/javax.annotation/blob/master/LICENSE) - 1. **Group** : junit. **Name** : junit. **Version** : 4.13.1. * **Project URL:** [http://junit.org](http://junit.org) * **License:** [Eclipse Public License 1.0](http://www.eclipse.org/legal/epl-v10.html) @@ -4496,12 +4456,12 @@ This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri Dec 13 20:09:58 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-testutil-server:2.0.0-SNAPSHOT.183` +# Dependencies of `io.spine.tools:spine-testutil-server:2.0.0-SNAPSHOT.190` ## Runtime 1. **Group** : com.google.android. **Name** : annotations. **Version** : 4.1.1.4. @@ -4528,10 +4488,6 @@ This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-Lice * **Project URL:** [https://errorprone.info/error_prone_annotations](https://errorprone.info/error_prone_annotations) * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group** : com.google.errorprone. **Name** : error_prone_type_annotations. **Version** : 2.23.0. - * **Project URL:** [https://errorprone.info/error_prone_type_annotations](https://errorprone.info/error_prone_type_annotations) - * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) - 1. **Group** : com.google.flogger. **Name** : flogger. **Version** : 0.7.4. * **Project URL:** [https://github.com/google/flogger](https://github.com/google/flogger) * **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) @@ -4652,10 +4608,6 @@ This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-Lice * **Project URL:** [https://github.com/perfmark/perfmark](https://github.com/perfmark/perfmark) * **License:** [Apache 2.0](https://opensource.org/licenses/Apache-2.0) -1. **Group** : javax.annotation. **Name** : javax.annotation-api. **Version** : 1.3.2. - * **Project URL:** [http://jcp.org/en/jsr/detail?id=250](http://jcp.org/en/jsr/detail?id=250) - * **License:** [CDDL + GPLv2 with classpath exception](https://github.com/javaee/javax.annotation/blob/master/LICENSE) - 1. **Group** : junit. **Name** : junit. **Version** : 4.13.1. * **Project URL:** [http://junit.org](http://junit.org) * **License:** [Eclipse Public License 1.0](http://www.eclipse.org/legal/epl-v10.html) @@ -5526,4 +5478,4 @@ This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 26 19:02:32 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Fri Dec 13 20:09:58 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml index b80526ec88..0282ed67ea 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject. --> io.spine spine-core-java -2.0.0-SNAPSHOT.183 +2.0.0-SNAPSHOT.190 2015 @@ -68,7 +68,7 @@ all modules and does not describe the project structure per-subproject. io.spine spine-base - 2.0.0-SNAPSHOT.220 + 2.0.0-SNAPSHOT.231 compile @@ -86,19 +86,19 @@ all modules and does not describe the project structure per-subproject. io.spine spine-logging - 2.0.0-SNAPSHOT.240 + 2.0.0-SNAPSHOT.242 compile io.spine spine-logging-grpc-context - 2.0.0-SNAPSHOT.240 + 2.0.0-SNAPSHOT.242 compile io.spine spine-reflect - 2.0.0-SNAPSHOT.190 + 2.0.0-SNAPSHOT.191 compile @@ -110,7 +110,7 @@ all modules and does not describe the project structure per-subproject. io.spine.validation spine-validation-java-runtime - 2.0.0-SNAPSHOT.172 + 2.0.0-SNAPSHOT.178 compile @@ -218,12 +218,12 @@ all modules and does not describe the project structure per-subproject. io.spine.protodata protodata-fat-cli - 0.69.0 + 0.70.3 io.spine.protodata protodata-protoc - 0.69.0 + 0.70.3 io.spine.tools @@ -233,18 +233,18 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-mc-java-checks - 2.0.0-SNAPSHOT.257 + 2.0.0-SNAPSHOT.259 provided io.spine.tools spine-mc-java-plugins - 2.0.0-SNAPSHOT.257 + 2.0.0-SNAPSHOT.259 io.spine.validation spine-validation-java-bundle - 2.0.0-SNAPSHOT.173 + 2.0.0-SNAPSHOT.177 net.sourceforge.pmd diff --git a/server/src/main/java/io/spine/server/ServiceDelegate.java b/server/src/main/java/io/spine/server/ServiceDelegate.java index dba8f4e6a2..faa610c0f4 100644 --- a/server/src/main/java/io/spine/server/ServiceDelegate.java +++ b/server/src/main/java/io/spine/server/ServiceDelegate.java @@ -143,7 +143,7 @@ protected boolean detectInternal(T request) { */ protected void handleInternal(T request, StreamObserver observer) { var targetType = enclosedMessageType(request); - var unpublishedLanguage = new UnpublishedLanguageException(targetType.toTypeName()); + var unpublishedLanguage = new UnpublishedLanguageException(targetType.typeName()); logger().atError().withCause(unpublishedLanguage).log(() -> format( "Unpublished type (`%s`) posted to `%s`.", targetType, serviceName())); observer.onError(unpublishedLanguage); diff --git a/server/src/main/java/io/spine/server/VisibilityGuard.java b/server/src/main/java/io/spine/server/VisibilityGuard.java index db728cb1e4..c10ddbea4d 100644 --- a/server/src/main/java/io/spine/server/VisibilityGuard.java +++ b/server/src/main/java/io/spine/server/VisibilityGuard.java @@ -201,8 +201,7 @@ private RepositoryAccess(Repository repository) { } private TypeName stateTypeName() { - return repository.entityStateType() - .toTypeName(); + return repository.entityStateType().typeName(); } @Override diff --git a/server/src/main/java/io/spine/server/event/store/EventColumn.java b/server/src/main/java/io/spine/server/event/store/EventColumn.java index b6066a0550..3540399511 100644 --- a/server/src/main/java/io/spine/server/event/store/EventColumn.java +++ b/server/src/main/java/io/spine/server/event/store/EventColumn.java @@ -50,7 +50,7 @@ final class EventColumn { */ static final RecordColumn type = create("type", String.class, (m) -> m.enclosedTypeUrl() - .toTypeName() + .typeName() .value()); /** diff --git a/server/src/main/java/io/spine/server/model/AbstractReceptor.java b/server/src/main/java/io/spine/server/model/AbstractReceptor.java index e63bf09194..9af8d51f24 100644 --- a/server/src/main/java/io/spine/server/model/AbstractReceptor.java +++ b/server/src/main/java/io/spine/server/model/AbstractReceptor.java @@ -1,11 +1,11 @@ /* - * Copyright 2022, TeamDev. All rights reserved. + * Copyright 2024, 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and/or binary forms, with or without * modification, must retain the above copyright notice and the following @@ -23,6 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + package io.spine.server.model; import com.google.common.collect.ImmutableSet; @@ -207,14 +208,13 @@ protected Class rawMessageClass() { * a class implementing {@link Message}. * * @param receptor - * the method to take first parameter type from - * @return the class of the first method parameter + * the method to take the first parameter type from + * the class of the first method parameter * @throws ClassCastException * if the first parameter is not a class implementing {@link Message} */ protected static Class firstParamType(Method receptor) { - @SuppressWarnings("unchecked") - // We always expect first param as a Message of required type. + @SuppressWarnings("unchecked" /* See Javadoc for the `receptor` parameter. */) var result = (Class) receptor.getParameterTypes()[0]; return result; } @@ -272,11 +272,22 @@ private static ImmutableSet> discoverAttributes(Method method) { /** * Feeds the given {@code envelope} to the given {@code target} and returns the outcome. * - * @implNote The outcome of this method is not validated, as its fields in fact consist + *

If the target method throws {@link java.lang.Error} dispatching terminates with + * rethrowing the error. + * + *

Other types of exceptions are converted to {@link io.spine.base.Error} and returned + * {@link DispatchOutcome.Builder#setError inside} the {@link DispatchOutcome}. + * + * @implNote The result of this method is not validated, as its fields in fact consist * of the parts, such as wrapped {@code Command}s and {@code Event}s that are validated - * upon their creation. Such an approach allows to improve the overall performance of + * upon their creation. Such an approach allows improving the overall performance of * the signal propagation. */ + @SuppressWarnings({ + "ChainOfInstanceofChecks" /* We need to separate exceptions. */, + "ThrowInsideCatchBlockWhichIgnoresCaughtException", "ProhibitedExceptionThrown" + /* Rethrowing `Error`. See Javadoc. */ + }) @Override public DispatchOutcome invoke(T target, E envelope) { checkNotNull(target); @@ -301,7 +312,9 @@ public DispatchOutcome invoke(T target, E envelope) { } catch (InvocationTargetException e) { var cause = e.getCause(); checkNotNull(cause); - if (cause instanceof RejectionThrowable) { + if (cause instanceof Error) { + throw (Error) cause; + } else if (cause instanceof RejectionThrowable) { var success = asRejection(target, envelope, (RejectionThrowable) cause); outcome.setSuccess(success); } else { @@ -340,10 +353,10 @@ protected Optional handleRejection(T target, E origin, RejectionThrowab } /** - * Allows to make sure that the passed envelope matches the annotation attributes of a method. + * A callback to check the passed envelope matches the annotation attributes of the method. * - *

Default implementation does nothing. Descending classes may override for checking - * the match. + *

The default implementation does nothing. + * Descending classes may override for checking the match. * * @throws IllegalArgumentException * the default implementation does not throw ever. Descending classes would throw diff --git a/server/src/main/java/io/spine/server/model/IllegalOutcomeException.java b/server/src/main/java/io/spine/server/model/IllegalOutcomeException.java index 9211187f08..95c3609aa6 100644 --- a/server/src/main/java/io/spine/server/model/IllegalOutcomeException.java +++ b/server/src/main/java/io/spine/server/model/IllegalOutcomeException.java @@ -1,11 +1,11 @@ /* - * Copyright 2022, TeamDev. All rights reserved. + * Copyright 2024, 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and/or binary forms, with or without * modification, must retain the above copyright notice and the following @@ -33,8 +33,8 @@ /** * An exception signifying that a handler method produced an unexpected result. * - *

For example, event subscriber methods should not produce any result signals. If any such - * signals are encountered, an {@code IllegalOutcomeException} is thrown. + *

For example, event subscriber methods should not produce any result signals. + * If any such signals are encountered, an {@code IllegalOutcomeException} is thrown. */ @Internal public final class IllegalOutcomeException extends RuntimeException { diff --git a/server/src/main/java/io/spine/server/stand/QueryValidator.java b/server/src/main/java/io/spine/server/stand/QueryValidator.java index eeab621b7d..70b1b20965 100644 --- a/server/src/main/java/io/spine/server/stand/QueryValidator.java +++ b/server/src/main/java/io/spine/server/stand/QueryValidator.java @@ -100,6 +100,6 @@ protected InvalidRequestException unsupportedException(Query request, Error erro @Override protected String errorMessage(Query request) { var targetType = getTypeOf(request.getTarget()); - return format("The query target type is not supported: %s", targetType.toTypeName()); + return format("The query target type is not supported: %s", targetType.typeName()); } } diff --git a/server/src/main/java/io/spine/server/stand/TopicValidator.java b/server/src/main/java/io/spine/server/stand/TopicValidator.java index 02782f7bdc..e86b8ce03b 100644 --- a/server/src/main/java/io/spine/server/stand/TopicValidator.java +++ b/server/src/main/java/io/spine/server/stand/TopicValidator.java @@ -85,6 +85,6 @@ protected InvalidRequestException unsupportedException(Topic request, @Override protected String errorMessage(Topic request) { var targetType = getTypeOf(request.getTarget()); - return format("The topic target type is not supported: %s", targetType.toTypeName()); + return format("The topic target type is not supported: %s", targetType.typeName()); } } diff --git a/server/src/test/java/io/spine/server/model/AbstractReceptorSpec.java b/server/src/test/java/io/spine/server/model/AbstractReceptorSpec.java deleted file mode 100644 index 7ca02b597a..0000000000 --- a/server/src/test/java/io/spine/server/model/AbstractReceptorSpec.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright 2022, 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.server.model; - -import io.spine.core.Event; -import io.spine.server.model.given.method.OneParamMethod; -import io.spine.server.model.given.method.OneParamSignature; -import io.spine.server.model.given.method.OneParamSpec; -import io.spine.server.model.given.method.StubHandler; -import io.spine.server.model.given.method.TwoParamMethod; -import io.spine.server.model.given.method.TwoParamSpec; -import io.spine.server.type.EventEnvelope; -import io.spine.server.type.given.GivenEvent; -import io.spine.test.model.ModProjectCreated; -import io.spine.test.model.ModProjectStarted; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - -import static io.spine.base.Identifier.newUuid; -import static io.spine.protobuf.AnyPacker.pack; -import static io.spine.server.model.AbstractReceptor.firstParamType; -import static io.spine.server.model.given.method.StubHandler.getMethodWithCheckedException; -import static io.spine.server.model.given.method.StubHandler.getMethodWithRuntimeException; -import static io.spine.testing.TestValues.nullRef; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@DisplayName("`AbstractReceptor` should") -@SuppressWarnings("DuplicateStringLiteralInspection") // Common test display names. -class AbstractReceptorSpec { - - private final OneParamSignature signature = new OneParamSignature(); - - private TwoParamMethod twoParamMethod; - private OneParamMethod oneParamMethod; - - private Object target; - - @BeforeEach - void setUp() { - target = new StubHandler(); - twoParamMethod = new TwoParamMethod(StubHandler.getTwoParameterMethod(), - TwoParamSpec.INSTANCE); - oneParamMethod = new OneParamMethod(StubHandler.getOneParameterMethod(), - OneParamSpec.INSTANCE); - } - - @Test - @DisplayName("not accept `null` method") - void notAcceptNullMethod() { - assertThrows(NullPointerException.class, () -> new TwoParamMethod(nullRef(), - TwoParamSpec.INSTANCE)); - } - - @Test - @DisplayName("return method") - void returnMethod() { - assertEquals(StubHandler.getTwoParameterMethod(), twoParamMethod.rawMethod()); - } - - @Nested - @DisplayName("check if method access is") - class CheckAccess { - - @Test - @DisplayName(AccessModifier.MODIFIER_PUBLIC) - void isPublic() { - assertTrue(twoParamMethod.isPublic()); - } - - @Test - @DisplayName(AccessModifier.MODIFIER_PRIVATE) - void isPrivate() { - assertTrue(oneParamMethod.isPrivate()); - } - } - - @Test - @DisplayName("obtain first parameter type of method") - void returnFirstParamType() { - assertEquals(ModProjectStarted.class, firstParamType(oneParamMethod.rawMethod())); - } - - @Nested - @DisplayName("invoke method") - class InvokeMethod { - - @SuppressWarnings("CheckReturnValue") // can ignore the result in this test - @Test - @DisplayName("with one parameter") - void withOneParam() { - var eventMessage = ModProjectStarted.newBuilder() - .setId(newUuid()) - .build(); - var event = Event.newBuilder() - .setId(GivenEvent.someId()) - .setMessage(pack(eventMessage)) - .setContext(GivenEvent.context()) - .build(); - var envelope = EventEnvelope.of(event); - oneParamMethod.invoke(target, envelope); - - assertTrue(((StubHandler) target).wasHandleInvoked()); - } - - @Test - @DisplayName("with two parameters") - @SuppressWarnings("CheckReturnValue") // can ignore the result in this test - void withTwoParams() { - var eventMessage = ModProjectCreated.newBuilder() - .setId(newUuid()) - .build(); - var event = Event.newBuilder() - .setId(GivenEvent.someId()) - .setMessage(pack(eventMessage)) - .setContext(GivenEvent.context()) - .build(); - var envelope = EventEnvelope.of(event); - twoParamMethod.invoke(target, envelope); - - assertTrue(((StubHandler) target).wasOnInvoked()); - } - } - - @Test - @DisplayName("return full name in `toString`") - void provideToString() { - assertEquals(twoParamMethod.getFullName(), twoParamMethod.toString()); - } - - @Nested - @DisplayName("provide `equals` method such that") - class ProvideEqualsSuchThat { - - @Test - @DisplayName("instance equals to itself") - void equalsToItself() { - assertEquals(twoParamMethod, twoParamMethod); - } - - @Test - @DisplayName("instance is not equal to `null`") - void notEqualsToNull() { - assertNotEquals(null, oneParamMethod); - } - - @Test - @DisplayName("instance is not equal to another class") - void notEqualsToOtherClass() { - assertNotEquals(twoParamMethod, oneParamMethod); - } - - @Test - @DisplayName("all fields are compared") - void allFieldsAreCompared() { - AbstractReceptor anotherMethod = - new TwoParamMethod(StubHandler.getTwoParameterMethod(), - TwoParamSpec.INSTANCE); - assertEquals(twoParamMethod, anotherMethod); - } - } - - @Test - @DisplayName("have `hashCode`") - void haveHashCode() { - assertNotEquals(System.identityHashCode(twoParamMethod), twoParamMethod.hashCode()); - } - - @Nested - @DisplayName("not be created from method throwing") - class RejectMethodThrowing { - - @Test - @DisplayName("checked exception") - void checkedException() { - var method = signature.classify(getMethodWithCheckedException()); - assertFalse(method.isPresent()); - } - - @Test - @DisplayName("runtime exception") - void runtimeException() { - var method = signature.classify(getMethodWithRuntimeException()); - assertFalse(method.isPresent()); - } - } -} diff --git a/server/src/test/java/io/spine/server/model/given/method/StubHandler.java b/server/src/test/java/io/spine/server/model/given/method/StubHandler.java index 2d3ccc42df..81bdf21bca 100644 --- a/server/src/test/java/io/spine/server/model/given/method/StubHandler.java +++ b/server/src/test/java/io/spine/server/model/given/method/StubHandler.java @@ -1,11 +1,11 @@ /* - * Copyright 2022, TeamDev. All rights reserved. + * Copyright 2024, 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and/or binary forms, with or without * modification, must retain the above copyright notice and the following @@ -34,17 +34,18 @@ import java.io.IOException; import java.lang.reflect.Method; -@SuppressWarnings("UnusedParameters") // OK for test methods. public class StubHandler { private boolean onInvoked; private boolean handleInvoked; - private static void throwCheckedException(BoolValue message) throws Exception { + private static void throwCheckedException( + @SuppressWarnings("unused") BoolValue message) throws Exception { throw new IOException("Throw new checked exception"); } - private static void throwRuntimeException(BoolValue message) throws RuntimeException { + private static void throwRuntimeException( + @SuppressWarnings("unused") BoolValue message) throws RuntimeException { throw new RuntimeException("Throw new runtime exception"); } @@ -92,6 +93,7 @@ public static Method getMethodWithRuntimeException() { return method; } + @SuppressWarnings("unused" /* to declare a method with two params. */) public void on(ModProjectCreated message, EventContext context) { onInvoked = true; } diff --git a/server/src/test/java/io/spine/system/server/given/SystemContextSettingsTestEnv.java b/server/src/test/java/io/spine/system/server/given/SystemContextSettingsTestEnv.java index f5a7a2f352..a8e335e39e 100644 --- a/server/src/test/java/io/spine/system/server/given/SystemContextSettingsTestEnv.java +++ b/server/src/test/java/io/spine/system/server/given/SystemContextSettingsTestEnv.java @@ -65,7 +65,8 @@ public static MemoizingObserver postSystemEvent(EventBus systemBus, Event systemBus.post(event); var filter = EventFilter.newBuilder() .setEventType(event.enclosedTypeUrl() - .toTypeName().value()) + .typeName() + .value()) .build(); var query = EventStreamQuery.newBuilder() .addFilter(filter) diff --git a/server/src/test/kotlin/io/spine/server/model/AbstractReceptorSpec.kt b/server/src/test/kotlin/io/spine/server/model/AbstractReceptorSpec.kt new file mode 100644 index 0000000000..c8138f7746 --- /dev/null +++ b/server/src/test/kotlin/io/spine/server/model/AbstractReceptorSpec.kt @@ -0,0 +1,261 @@ +/* + * Copyright 2024, 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.server.model + +import com.google.protobuf.Message +import io.kotest.matchers.optional.shouldBePresent +import io.kotest.matchers.shouldBe +import io.kotest.matchers.shouldNotBe +import io.spine.base.EventMessage +import io.spine.base.Identifier +import io.spine.core.Event +import io.spine.core.Subscribe +import io.spine.protobuf.AnyPacker +import io.spine.server.event.EventSubscriber +import io.spine.server.event.model.SubscriberSignature +import io.spine.server.model.AbstractReceptor.firstParamType +import io.spine.server.model.given.method.OneParamMethod +import io.spine.server.model.given.method.OneParamSignature +import io.spine.server.model.given.method.OneParamSpec +import io.spine.server.model.given.method.StubHandler +import io.spine.server.model.given.method.TwoParamMethod +import io.spine.server.model.given.method.TwoParamSpec +import io.spine.server.type.EventEnvelope +import io.spine.server.type.given.GivenEvent +import io.spine.test.model.ModProjectCreated +import io.spine.test.model.ModProjectStarted +import io.spine.test.reflect.event.RefProjectCreated +import io.spine.test.reflect.event.refProjectCreated +import io.spine.test.reflect.projectId +import io.spine.testing.TestValues +import io.spine.testing.server.TestEventFactory +import io.spine.testing.server.model.ModelTests +import java.lang.reflect.Method +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows + +@DisplayName("`AbstractReceptor` should") +internal class AbstractReceptorSpec { + + private val signature = OneParamSignature() + + private lateinit var target: Any + private lateinit var twoParamMethod: TwoParamMethod + private lateinit var oneParamMethod: OneParamMethod + + @BeforeEach + fun setUp() { + target = StubHandler() + twoParamMethod = TwoParamMethod( + StubHandler.getTwoParameterMethod(), + TwoParamSpec.INSTANCE + ) + oneParamMethod = OneParamMethod( + StubHandler.getOneParameterMethod(), + OneParamSpec.INSTANCE + ) + } + + @Test + fun `not accept 'null' method`() { + assertThrows { + TwoParamMethod( + TestValues.nullRef(), + TwoParamSpec.INSTANCE + ) + } + } + + @Test + fun `return method`() { + twoParamMethod.rawMethod() shouldBe StubHandler.getTwoParameterMethod() + } + + @Nested internal inner class + `check if method access is` { + + @Test + @DisplayName(AccessModifier.MODIFIER_PUBLIC) + fun isPublic() { + twoParamMethod.isPublic shouldBe true + } + + @Test + @DisplayName(AccessModifier.MODIFIER_PRIVATE) + fun isPrivate() { + oneParamMethod.isPrivate shouldBe true + } + } + + @Test + fun `obtain first parameter type of method`() { + firstParamType(oneParamMethod.rawMethod()) shouldBe + ModProjectStarted::class.java + } + + @Nested internal inner class + `invoke method` { + + // can ignore the result in this test + @Test + fun `with one parameter`() { + val eventMessage = ModProjectStarted.newBuilder() + .setId(Identifier.newUuid()) + .build() + val event = Event.newBuilder() + .setId(GivenEvent.someId()) + .setMessage(AnyPacker.pack(eventMessage)) + .setContext(GivenEvent.context()) + .build() + val envelope = EventEnvelope.of(event) + + oneParamMethod.invoke(target, envelope) + + (target as StubHandler).wasHandleInvoked() shouldBe true + } + + @Test + fun `with two parameters`() { + val eventMessage = ModProjectCreated.newBuilder() + .setId(Identifier.newUuid()) + .build() + val event = Event.newBuilder() + .setId(GivenEvent.someId()) + .setMessage(AnyPacker.pack(eventMessage)) + .setContext(GivenEvent.context()) + .build() + val envelope = EventEnvelope.of(event) + twoParamMethod.invoke(target, envelope) + + (target as StubHandler).wasOnInvoked() shouldBe true + } + } + + @Test + fun `return full name in in string form`() { + twoParamMethod.toString() shouldBe twoParamMethod.fullName + } + + @Nested internal inner class + `provide equality such that` { + + @Test + fun `it equals to itself`() { + twoParamMethod.equals(twoParamMethod) shouldBe true + } + + @Test + @Suppress("EqualsNullCall") // for the test. + fun `it is not equal to 'null'`() { + oneParamMethod.equals(null) shouldBe false + } + + @Test + @DisplayName("it is not equal to one of another class") + fun `it is not equal to one of another class`() { + oneParamMethod.equals(twoParamMethod) shouldBe false + } + + @Test + fun `all fields are compared`() { + val anotherMethod: AbstractReceptor<*, *, *, *, *> = + TwoParamMethod( + StubHandler.getTwoParameterMethod(), + TwoParamSpec.INSTANCE + ) + anotherMethod.equals(twoParamMethod) shouldBe true + } + } + + @Test + fun `provide hash code`() { + twoParamMethod.hashCode() shouldNotBe System.identityHashCode(twoParamMethod) + } + + @Nested internal inner class + `not be created from method throwing` { + + @Test + fun `checked exception`() { + val method = signature.classify(StubHandler.getMethodWithCheckedException()) + method.isPresent shouldBe false + } + + @Test + fun `runtime exception`() { + val method = signature.classify(StubHandler.getMethodWithRuntimeException()) + method.isPresent shouldBe false + } + } + + @Nested inner class + `propagate instances of 'Error'` { + + private val signature = SubscriberSignature(); + + @Test + fun `if a target throws 'java_lang_Error'`() { + val receptor = signature.classify(ErrorThrowingHandler.method("throwingError")) + receptor.shouldBePresent() + val envelope = envelope(projectCreated()) + assertThrows { + receptor.get().invoke(ErrorThrowingHandler(), envelope) + } + } + + private fun projectCreated(): RefProjectCreated = + refProjectCreated { this.projectId = projectId { id = Identifier.newUuid() } } + } +} + +/** + * A subscriber which throws [java.lang.Error] and [kotlin.Error] in the receptors. + */ +private class ErrorThrowingHandler : EventSubscriber { + + companion object { + fun method(name: String): Method { + return ModelTests.getMethod(ErrorThrowingHandler::class.java, name) + } + } + + @Subscribe + @Suppress("TooGenericExceptionThrown", "UNUSED_PARAMETER") + fun throwingError(e: RefProjectCreated) { + throw Error("Throwing `java.lang.Error`.") + } +} + +private fun envelope(eventMessage: EventMessage): EventEnvelope { + val factory = TestEventFactory.newInstance(AbstractReceptorSpec::class.java) + val event = factory.createEvent(eventMessage) + val envelope = EventEnvelope.of(event) + return envelope +} diff --git a/testutil-server/src/test/java/io/spine/testing/server/blackbox/BlackBoxTest.java b/testutil-server/src/test/java/io/spine/testing/server/blackbox/BlackBoxTest.java index 518c40bd4a..b394282c3a 100644 --- a/testutil-server/src/test/java/io/spine/testing/server/blackbox/BlackBoxTest.java +++ b/testutil-server/src/test/java/io/spine/testing/server/blackbox/BlackBoxTest.java @@ -599,8 +599,7 @@ private void assertDisabledPosting() { */ private Set toTypes(Iterable> repos) { ImmutableSet.Builder builder = ImmutableSet.builder(); - repos.forEach(repository -> builder.add(repository.entityStateType() - .toTypeName())); + repos.forEach(repository -> builder.add(repository.entityStateType().typeName())); return builder.build(); } } diff --git a/version.gradle.kts b/version.gradle.kts index 1859ddbf0c..5d592965f0 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -29,4 +29,4 @@ * * For versions of Spine-based dependencies, please see [io.spine.dependency.local.Spine]. */ -val versionToPublish: String by extra("2.0.0-SNAPSHOT.183") +val versionToPublish: String by extra("2.0.0-SNAPSHOT.190")