Skip to content

Commit 400b0a6

Browse files
Merge pull request #101 from SpineEventEngine/bump-protodata
Bump ProtoData
2 parents 746c3ef + a2d1da1 commit 400b0a6

File tree

14 files changed

+238
-187
lines changed

14 files changed

+238
-187
lines changed

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

+97-7
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,107 @@ package io.spine.internal.dependency
2929
/**
3030
* Dependencies on ProtoData modules.
3131
*
32+
* In order to use locally published ProtoData version instead of the version from a public plugin
33+
* registry, set the `PROTODATA_VERSION` and/or the `PROTODATA_DF_VERSION` environment variables
34+
* and stop the Gradle daemons so that Gradle observes the env change:
35+
* ```
36+
* export PROTODATA_VERSION=0.43.0-local
37+
* export PROTODATA_DF_VERSION=0.41.0
38+
*
39+
* ./gradle --stop
40+
* ./gradle build # Conduct the intended checks.
41+
* ```
42+
*
43+
* Then, in order to reset the console to run the usual versions again, remove the values of
44+
* the environment variables and stop the daemon:
45+
* ```
46+
* export PROTODATA_VERSION=""
47+
* export PROTODATA_DF_VERSION=""
48+
*
49+
* ./gradle --stop
50+
* ```
51+
*
3252
* See [`SpineEventEngine/ProtoData`](https://github.com/SpineEventEngine/ProtoData/).
3353
*/
34-
@Suppress("unused", "ConstPropertyName")
54+
@Suppress(
55+
"unused" /* Some subprojects do not use ProtoData directly. */,
56+
"ConstPropertyName" /* We use custom convention for artifact properties. */,
57+
"MemberVisibilityCanBePrivate" /* The properties are used directly by other subprojects. */,
58+
"KDocUnresolvedReference" /* Referencing private properties in constructor KDoc. */
59+
)
3560
object ProtoData {
36-
const val version = "0.11.4"
37-
const val dogfoodingVersion = "0.11.0"
3861
const val group = "io.spine.protodata"
39-
const val compiler = "$group:protodata-compiler:$version"
62+
const val pluginId = "io.spine.protodata"
4063

41-
const val codegenJava = "io.spine.protodata:protodata-codegen-java:$version"
64+
/**
65+
* The version of ProtoData dependencies.
66+
*/
67+
val version: String
68+
private const val fallbackVersion = "0.12.0"
4269

43-
const val pluginId = "io.spine.protodata"
44-
const val pluginLib = "${Spine.group}:protodata:$version"
70+
/**
71+
* The distinct version of ProtoData used by other build tools.
72+
*
73+
* When ProtoData is used both for building the project and as a part of the Project's
74+
* transitional dependencies, this is the version used to build the project itself.
75+
*/
76+
val dogfoodingVersion: String
77+
private const val fallbackDfVersion = "0.9.11"
78+
79+
/**
80+
* The artifact for the ProtoData Gradle plugin.
81+
*/
82+
val pluginLib: String
83+
84+
val api
85+
get() = "$group:protodata-api:$version"
86+
val compiler
87+
get() = "$group:protodata-compiler:$version"
88+
val codegenJava
89+
get() = "$group:protodata-codegen-java:$version"
90+
91+
/**
92+
* An env variable storing a custom [version].
93+
*/
94+
private const val VERSION_ENV = "PROTODATA_VERSION"
95+
96+
/**
97+
* An env variable storing a custom [dogfoodingVersion].
98+
*/
99+
private const val DF_VERSION_ENV = "PROTODATA_DF_VERSION"
100+
101+
/**
102+
* Sets up the versions and artifacts for the build to use.
103+
*
104+
* If either [VERSION_ENV] or [DF_VERSION_ENV] is set, those versions are used instead of
105+
* the hardcoded ones. Also, in this mode, the [pluginLib] coordinates are changed so that
106+
* it points at a locally published artifact. Otherwise, it points at an artifact that would be
107+
* published to a public plugin registry.
108+
*/
109+
init {
110+
val experimentVersion = System.getenv(VERSION_ENV)
111+
val experimentDfVersion = System.getenv(DF_VERSION_ENV)
112+
if (experimentVersion?.isNotBlank() == true || experimentDfVersion?.isNotBlank() == true) {
113+
version = experimentVersion ?: fallbackVersion
114+
dogfoodingVersion = experimentDfVersion ?: fallbackDfVersion
115+
116+
pluginLib = "${group}:gradle-plugin:$version"
117+
println("""
118+
119+
❗ Running an experiment with ProtoData. ❗
120+
-----------------------------------------
121+
Regular version = v$version
122+
Dogfooding version = v$dogfoodingVersion
123+
124+
ProtoData Gradle plugin can now be loaded from Maven Local.
125+
126+
To reset the versions, erase the `$$VERSION_ENV` and `$$DF_VERSION_ENV` environment variables.
127+
128+
""".trimIndent())
129+
} else {
130+
version = fallbackVersion
131+
dogfoodingVersion = fallbackDfVersion
132+
pluginLib = "${Spine.group}:protodata:$version"
133+
}
134+
}
45135
}

buildSrc/src/main/kotlin/io/spine/internal/dependency/Roaster.kt

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ package io.spine.internal.dependency
3030
@Suppress("unused", "ConstPropertyName")
3131
object Roaster {
3232

33+
/**
34+
* This is the last version build with Java 11.
35+
*
36+
* Starting from version
37+
* [2.29.0.Final](https://github.com/forge/roaster/releases/tag/2.29.0.Final),
38+
* Roaster requires Java 17.
39+
*/
3340
private const val version = "2.28.0.Final"
3441

3542
const val api = "org.jboss.forge.roaster:roaster-api:${version}"

buildSrc/src/main/kotlin/io/spine/internal/dependency/Spine.kt

+17-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ object Spine {
5959
*
6060
* @see <a href="https://github.com/SpineEventEngine/logging">spine-logging</a>
6161
*/
62-
const val logging = "2.0.0-SNAPSHOT.210"
62+
const val logging = "2.0.0-SNAPSHOT.226"
6363

6464
/**
6565
* The version of [Spine.testlib].
@@ -75,7 +75,7 @@ object Spine {
7575
* @see [Spine.CoreJava.server]
7676
* @see <a href="https://github.com/SpineEventEngine/core-java">core-java</a>
7777
*/
78-
const val core = "2.0.0-SNAPSHOT.157"
78+
const val core = "2.0.0-SNAPSHOT.159"
7979

8080
/**
8181
* The version of [Spine.modelCompiler].
@@ -89,7 +89,7 @@ object Spine {
8989
*
9090
* @see <a href="https://github.com/SpineEventEngine/mc-java">spine-mc-java</a>
9191
*/
92-
const val mcJava = "2.0.0-SNAPSHOT.169"
92+
const val mcJava = "2.0.0-SNAPSHOT.170"
9393

9494
/**
9595
* The version of [Spine.baseTypes].
@@ -103,7 +103,7 @@ object Spine {
103103
*
104104
* @see <a href="https://github.com/SpineEventEngine/time">spine-time</a>
105105
*/
106-
const val time = "2.0.0-SNAPSHOT.133"
106+
const val time = "2.0.0-SNAPSHOT.134"
107107

108108
/**
109109
* The version of [Spine.change].
@@ -124,7 +124,7 @@ object Spine {
124124
*
125125
* @see <a href="https://github.com/SpineEventEngine/tool-base">spine-tool-base</a>
126126
*/
127-
const val toolBase = "2.0.0-SNAPSHOT.183"
127+
const val toolBase = "2.0.0-SNAPSHOT.186"
128128

129129
/**
130130
* The version of [Spine.javadocTools].
@@ -165,8 +165,20 @@ object Spine {
165165
const val version = ArtifactVersion.logging
166166
const val lib = "$group:spine-logging:$version"
167167
const val backend = "$group:spine-logging-backend:$version"
168+
const val log4j2Backend = "$group:spine-logging-log4j2-backend:$version"
168169
const val context = "$group:spine-logging-context:$version"
170+
const val grpcContext = "$group:spine-logging-grpc-context:$version"
171+
172+
@Deprecated(
173+
message = "Please use `Logging.lib` instead.",
174+
replaceWith = ReplaceWith("lib")
175+
)
169176
const val floggerApi = "$group:spine-flogger-api:$version"
177+
178+
@Deprecated(
179+
message = "Please use `grpcContext` instead.",
180+
replaceWith = ReplaceWith("grpcContext")
181+
)
170182
const val floggerGrpcContext = "$group:spine-flogger-grpc-context:$version"
171183
const val smokeTest = "$group:spine-logging-smoke-test:$version"
172184
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ package io.spine.internal.dependency
3333
*/
3434
@Suppress("unused", "ConstPropertyName")
3535
object Validation {
36-
const val version = "2.0.0-SNAPSHOT.103"
36+
const val version = "2.0.0-SNAPSHOT.104"
3737
const val group = "io.spine.validation"
3838
const val runtime = "$group:spine-validation-java-runtime:$version"
3939
const val java = "$group:spine-validation-java:$version"

gradle/wrapper/gradle-wrapper.jar

50 Bytes
Binary file not shown.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

java-tests/consumer/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022, TeamDev. All rights reserved.
2+
* Copyright 2023, 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.
@@ -30,7 +30,7 @@ import io.spine.protodata.gradle.plugin.LaunchProtoData
3030
protoData {
3131
plugins(
3232
// Suppress warnings in the generated code.
33-
"io.spine.protodata.codegen.java.annotation.SuppressWarningsAnnotation",
33+
"io.spine.protodata.codegen.java.annotation.SuppressWarningsAnnotation\$Plugin",
3434
"io.spine.validation.java.JavaValidationPlugin",
3535
"io.spine.validation.test.MoneyValidationPlugin"
3636
)

java-tests/vanilla/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022, TeamDev. All rights reserved.
2+
* Copyright 2023, 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.
@@ -29,7 +29,7 @@ import io.spine.internal.dependency.Spine
2929
protoData {
3030
plugins(
3131
// Suppress warnings in the generated code.
32-
"io.spine.protodata.codegen.java.annotation.SuppressWarningsAnnotation",
32+
"io.spine.protodata.codegen.java.annotation.SuppressWarningsAnnotation\$Plugin",
3333
"io.spine.validation.java.JavaValidationPlugin"
3434
)
3535
}

java/src/main/java/io/spine/validation/java/JavaValidationPlugin.java

-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import io.spine.protodata.plugin.View;
3333
import io.spine.protodata.plugin.ViewRepository;
3434
import io.spine.protodata.renderer.Renderer;
35-
import io.spine.protodata.type.TypeConvention;
3635
import io.spine.server.BoundedContextBuilder;
3736
import io.spine.validation.ValidationPlugin;
3837

@@ -92,11 +91,6 @@ public void extend(BoundedContextBuilder context) {
9291
base.extend(context);
9392
}
9493

95-
@Override
96-
public Set<TypeConvention<?, ?>> typeConventions() {
97-
return base.typeConventions();
98-
}
99-
10094
@Override
10195
public Set<Class<? extends View<?, ?, ?>>> views() {
10296
return base.views();

java/src/main/kotlin/io/spine/validation/java/GenerationContext.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import io.spine.protodata.MessageType
3333
import io.spine.protodata.ProtobufSourceFile
3434
import io.spine.protodata.TypeName
3535
import io.spine.protodata.codegen.java.Expression
36-
import io.spine.protodata.codegen.java.JavaImplConvention
36+
import io.spine.protodata.codegen.java.MessageOrEnumConvention
3737
import io.spine.protodata.codegen.java.JavaValueConverter
3838
import io.spine.protodata.codegen.java.MessageReference
3939
import io.spine.protodata.type.TypeSystem
@@ -96,8 +96,8 @@ internal constructor(
9696
private val elementReference: Expression? = null
9797
) {
9898

99-
val typeConvention: JavaImplConvention by lazy {
100-
JavaImplConvention(typeSystem)
99+
val typeConvention: MessageOrEnumConvention by lazy {
100+
MessageOrEnumConvention(typeSystem)
101101
}
102102

103103
/**

0 commit comments

Comments
 (0)