Skip to content

Commit b557134

Browse files
Merge branch 'master' into remove-nested-violations
# Conflicts: # dependencies.md # pom.xml # version.gradle.kts
2 parents 8da107f + 23b2a7a commit b557134

File tree

10 files changed

+33
-19
lines changed

10 files changed

+33
-19
lines changed

.idea/inspectionProfiles/Project_Default.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

buildSrc/src/main/kotlin/io/spine/dependency/local/BaseTypes.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ package io.spine.dependency.local
3333
*/
3434
@Suppress("ConstPropertyName")
3535
object BaseTypes {
36-
const val version = "2.0.0-SNAPSHOT.130"
36+
const val version = "2.0.0-SNAPSHOT.126"
3737
const val group = Spine.group
3838
const val artifact = "spine-base-types"
3939
const val lib = "$group:$artifact:$version"

buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024, TeamDev. All rights reserved.
2+
* Copyright 2025, TeamDev. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024, TeamDev. All rights reserved.
2+
* Copyright 2025, TeamDev. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -106,6 +106,9 @@ object ProtoData {
106106
val backend
107107
get() = "$group:protodata-backend:$version"
108108

109+
val params
110+
get() = "$group:protodata-params:$version"
111+
109112
val protocPlugin
110113
get() = "$group:protodata-protoc:$version"
111114

@@ -115,7 +118,7 @@ object ProtoData {
115118
val cliApi
116119
get() = "$group:protodata-cli-api:$version"
117120

118-
const val javaModule = "$group:protodata-java"
121+
val javaModule = "$group:protodata-java"
119122

120123
fun java(version: String): String =
121124
"$javaModule:$version"

buildSrc/src/main/kotlin/io/spine/dependency/local/Time.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024, TeamDev. All rights reserved.
2+
* Copyright 2025, TeamDev. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,11 +33,10 @@ package io.spine.dependency.local
3333
*/
3434
@Suppress("ConstPropertyName")
3535
object Time {
36-
const val version = "2.0.0-SNAPSHOT.135"
36+
const val version = "2.0.0-SNAPSHOT.136"
3737
const val group = Spine.group
3838
const val artifact = "spine-time"
3939
const val lib = "$group:$artifact:$version"
4040

41-
//TODO:2024-11-29:alexander.yevsyukov: Change the artifact name to `spine-time-testlib`.
42-
const val testLib = "${Spine.toolsGroup}:spine-testutil-time:$version"
41+
const val testLib = "${Spine.toolsGroup}:spine-time-testlib:$version"
4342
}

buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024, TeamDev. All rights reserved.
2+
* Copyright 2025, TeamDev. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ object Validation {
3636
/**
3737
* The version of the Validation library artifacts.
3838
*/
39-
const val version = "2.0.0-SNAPSHOT.178"
39+
const val version = "2.0.0-SNAPSHOT.184"
4040

4141
const val group = "io.spine.validation"
4242
private const val prefix = "spine-validation"

buildSrc/src/main/kotlin/io/spine/gradle/publish/CheckVersionIncrement.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024, TeamDev. All rights reserved.
2+
* Copyright 2025, TeamDev. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -71,8 +71,8 @@ open class CheckVersionIncrement : DefaultTask() {
7171
val versionExists = versions?.contains(version) ?: false
7272
if (versionExists) {
7373
throw GradleException(
74-
"""
75-
Version `$version` is already published to maven repository `$repoUrl`.
74+
"""
75+
The version `$version` is already published to the Maven repository `$repoUrl`.
7676
Try incrementing the library version.
7777
All available versions are: ${versions?.joinToString(separator = ", ")}.
7878

buildSrc/src/main/kotlin/io/spine/gradle/publish/SpinePublishing.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024, TeamDev. All rights reserved.
2+
* Copyright 2025, TeamDev. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -205,10 +205,8 @@ open class SpinePublishing(private val project: Project) {
205205

206206
/**
207207
* A prefix to be added before the name of each artifact.
208-
*
209-
* The default value is "spine-".
210208
*/
211-
var artifactPrefix: String = "spine-"
209+
var artifactPrefix: String = DEFAULT_PREFIX
212210

213211
/**
214212
* Allows disabling publishing of [protoJar] artifact, containing all Proto sources

java-runtime/src/main/java/io/spine/validate/option/Required.java

+14
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import com.google.common.collect.ImmutableSet;
3030
import com.google.errorprone.annotations.Immutable;
3131
import com.google.protobuf.Descriptors.FieldDescriptor.JavaType;
32+
import io.spine.base.CommandMessage;
33+
import io.spine.base.EntityState;
3234
import io.spine.code.proto.FieldContext;
3335
import io.spine.code.proto.FieldDeclaration;
3436
import io.spine.logging.WithLogging;
@@ -101,6 +103,18 @@ public boolean shouldValidate(FieldContext context) {
101103
void checkUsage(FieldDeclaration field) {
102104
var type = field.javaType();
103105
if (!CAN_BE_REQUIRED.contains(type) && field.isNotCollection()) {
106+
var isTheFirstField = field.descriptor().getIndex() == 0;
107+
if (isTheFirstField) {
108+
// The first field declared in a message type could be assumed as required
109+
// because by convention it is an ID field of the message.
110+
// If so, do not log the warning message for this field because ID fields
111+
// could be of any reasonable type.
112+
var messageClass = field.messageType().javaClass();
113+
if (CommandMessage.class.isAssignableFrom(messageClass)
114+
|| EntityState.class.isAssignableFrom(messageClass)) {
115+
return;
116+
}
117+
}
104118
var typeName = field.descriptor().getType().name();
105119
logger().atWarning().log(() -> format(
106120
"The field `%s.%s` has the type %s and" +

0 commit comments

Comments
 (0)