Skip to content

Bump ProtoData #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 97 additions & 7 deletions buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,107 @@ package io.spine.internal.dependency
/**
* Dependencies on ProtoData modules.
*
* In order to use locally published ProtoData version instead of the version from a public plugin
* registry, set the `PROTODATA_VERSION` and/or the `PROTODATA_DF_VERSION` environment variables
* and stop the Gradle daemons so that Gradle observes the env change:
* ```
* export PROTODATA_VERSION=0.43.0-local
* export PROTODATA_DF_VERSION=0.41.0
*
* ./gradle --stop
* ./gradle build # Conduct the intended checks.
* ```
*
* Then, in order to reset the console to run the usual versions again, remove the values of
* the environment variables and stop the daemon:
* ```
* export PROTODATA_VERSION=""
* export PROTODATA_DF_VERSION=""
*
* ./gradle --stop
* ```
*
* See [`SpineEventEngine/ProtoData`](https://github.com/SpineEventEngine/ProtoData/).
*/
@Suppress("unused", "ConstPropertyName")
@Suppress(
"unused" /* Some subprojects do not use ProtoData directly. */,
"ConstPropertyName" /* We use custom convention for artifact properties. */,
"MemberVisibilityCanBePrivate" /* The properties are used directly by other subprojects. */,
"KDocUnresolvedReference" /* Referencing private properties in constructor KDoc. */
)
object ProtoData {
const val version = "0.11.4"
const val dogfoodingVersion = "0.11.0"
const val group = "io.spine.protodata"
const val compiler = "$group:protodata-compiler:$version"
const val pluginId = "io.spine.protodata"

const val codegenJava = "io.spine.protodata:protodata-codegen-java:$version"
/**
* The version of ProtoData dependencies.
*/
val version: String
private const val fallbackVersion = "0.12.0"

const val pluginId = "io.spine.protodata"
const val pluginLib = "${Spine.group}:protodata:$version"
/**
* The distinct version of ProtoData used by other build tools.
*
* When ProtoData is used both for building the project and as a part of the Project's
* transitional dependencies, this is the version used to build the project itself.
*/
val dogfoodingVersion: String
private const val fallbackDfVersion = "0.9.11"

/**
* The artifact for the ProtoData Gradle plugin.
*/
val pluginLib: String

val api
get() = "$group:protodata-api:$version"
val compiler
get() = "$group:protodata-compiler:$version"
val codegenJava
get() = "$group:protodata-codegen-java:$version"

/**
* An env variable storing a custom [version].
*/
private const val VERSION_ENV = "PROTODATA_VERSION"

/**
* An env variable storing a custom [dogfoodingVersion].
*/
private const val DF_VERSION_ENV = "PROTODATA_DF_VERSION"

/**
* Sets up the versions and artifacts for the build to use.
*
* If either [VERSION_ENV] or [DF_VERSION_ENV] is set, those versions are used instead of
* the hardcoded ones. Also, in this mode, the [pluginLib] coordinates are changed so that
* it points at a locally published artifact. Otherwise, it points at an artifact that would be
* published to a public plugin registry.
*/
init {
val experimentVersion = System.getenv(VERSION_ENV)
val experimentDfVersion = System.getenv(DF_VERSION_ENV)
if (experimentVersion?.isNotBlank() == true || experimentDfVersion?.isNotBlank() == true) {
version = experimentVersion ?: fallbackVersion
dogfoodingVersion = experimentDfVersion ?: fallbackDfVersion

pluginLib = "${group}:gradle-plugin:$version"
println("""

❗ Running an experiment with ProtoData. ❗
-----------------------------------------
Regular version = v$version
Dogfooding version = v$dogfoodingVersion

ProtoData Gradle plugin can now be loaded from Maven Local.

To reset the versions, erase the `$$VERSION_ENV` and `$$DF_VERSION_ENV` environment variables.

""".trimIndent())
} else {
version = fallbackVersion
dogfoodingVersion = fallbackDfVersion
pluginLib = "${Spine.group}:protodata:$version"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ package io.spine.internal.dependency
@Suppress("unused", "ConstPropertyName")
object Roaster {

/**
* This is the last version build with Java 11.
*
* Starting from version
* [2.29.0.Final](https://github.com/forge/roaster/releases/tag/2.29.0.Final),
* Roaster requires Java 17.
*/
private const val version = "2.28.0.Final"

const val api = "org.jboss.forge.roaster:roaster-api:${version}"
Expand Down
22 changes: 17 additions & 5 deletions buildSrc/src/main/kotlin/io/spine/internal/dependency/Spine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object Spine {
*
* @see <a href="https://github.com/SpineEventEngine/logging">spine-logging</a>
*/
const val logging = "2.0.0-SNAPSHOT.210"
const val logging = "2.0.0-SNAPSHOT.226"

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

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

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

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

/**
* The version of [Spine.javadocTools].
Expand Down Expand Up @@ -165,8 +165,20 @@ object Spine {
const val version = ArtifactVersion.logging
const val lib = "$group:spine-logging:$version"
const val backend = "$group:spine-logging-backend:$version"
const val log4j2Backend = "$group:spine-logging-log4j2-backend:$version"
const val context = "$group:spine-logging-context:$version"
const val grpcContext = "$group:spine-logging-grpc-context:$version"

@Deprecated(
message = "Please use `Logging.lib` instead.",
replaceWith = ReplaceWith("lib")
)
const val floggerApi = "$group:spine-flogger-api:$version"

@Deprecated(
message = "Please use `grpcContext` instead.",
replaceWith = ReplaceWith("grpcContext")
)
const val floggerGrpcContext = "$group:spine-flogger-grpc-context:$version"
const val smokeTest = "$group:spine-logging-smoke-test:$version"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package io.spine.internal.dependency
*/
@Suppress("unused", "ConstPropertyName")
object Validation {
const val version = "2.0.0-SNAPSHOT.103"
const val version = "2.0.0-SNAPSHOT.104"
const val group = "io.spine.validation"
const val runtime = "$group:spine-validation-java-runtime:$version"
const val java = "$group:spine-validation-java:$version"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions java-tests/consumer/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022, TeamDev. All rights reserved.
* Copyright 2023, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,7 @@ import io.spine.protodata.gradle.plugin.LaunchProtoData
protoData {
plugins(
// Suppress warnings in the generated code.
"io.spine.protodata.codegen.java.annotation.SuppressWarningsAnnotation",
"io.spine.protodata.codegen.java.annotation.SuppressWarningsAnnotation\$Plugin",
"io.spine.validation.java.JavaValidationPlugin",
"io.spine.validation.test.MoneyValidationPlugin"
)
Expand Down
4 changes: 2 additions & 2 deletions java-tests/vanilla/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022, TeamDev. All rights reserved.
* Copyright 2023, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@ import io.spine.internal.dependency.Spine
protoData {
plugins(
// Suppress warnings in the generated code.
"io.spine.protodata.codegen.java.annotation.SuppressWarningsAnnotation",
"io.spine.protodata.codegen.java.annotation.SuppressWarningsAnnotation\$Plugin",
"io.spine.validation.java.JavaValidationPlugin"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import io.spine.protodata.plugin.View;
import io.spine.protodata.plugin.ViewRepository;
import io.spine.protodata.renderer.Renderer;
import io.spine.protodata.type.TypeConvention;
import io.spine.server.BoundedContextBuilder;
import io.spine.validation.ValidationPlugin;

Expand Down Expand Up @@ -92,11 +91,6 @@ public void extend(BoundedContextBuilder context) {
base.extend(context);
}

@Override
public Set<TypeConvention<?, ?>> typeConventions() {
return base.typeConventions();
}

@Override
public Set<Class<? extends View<?, ?, ?>>> views() {
return base.views();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import io.spine.protodata.MessageType
import io.spine.protodata.ProtobufSourceFile
import io.spine.protodata.TypeName
import io.spine.protodata.codegen.java.Expression
import io.spine.protodata.codegen.java.JavaImplConvention
import io.spine.protodata.codegen.java.MessageOrEnumConvention
import io.spine.protodata.codegen.java.JavaValueConverter
import io.spine.protodata.codegen.java.MessageReference
import io.spine.protodata.type.TypeSystem
Expand Down Expand Up @@ -96,8 +96,8 @@ internal constructor(
private val elementReference: Expression? = null
) {

val typeConvention: JavaImplConvention by lazy {
JavaImplConvention(typeSystem)
val typeConvention: MessageOrEnumConvention by lazy {
MessageOrEnumConvention(typeSystem)
}

/**
Expand Down
Loading