Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import io.spine.dependency.lib.KotlinPoet
import io.spine.dependency.lib.Roaster
import io.spine.dependency.local.Base
import io.spine.dependency.local.Compiler
import io.spine.dependency.local.CoreJava
import io.spine.dependency.local.CoreJvm
import io.spine.dependency.local.Logging
import io.spine.dependency.local.Time
import io.spine.dependency.local.ToolBase
Expand Down Expand Up @@ -79,9 +79,7 @@ plugins {

spinePublishing {
modules = setOf(
"model",
":proto:configuration",
":proto:context",
"context",
"java",
"java-bundle",
"jvm-runtime",
Expand Down Expand Up @@ -119,8 +117,8 @@ allprojects {
Compiler.jvm,
Compiler.params,
Compiler.pluginLib,
CoreJava.client,
CoreJava.server,
CoreJvm.client,
CoreJvm.server,
Grpc.bom,
KotlinPoet.lib,
Logging.lib,
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ package io.spine.dependency.local
*/
@Suppress("ConstPropertyName", "unused")
object Base {
const val version = "2.0.0-SNAPSHOT.382"
const val versionForBuildScript = "2.0.0-SNAPSHOT.382"
const val version = "2.0.0-SNAPSHOT.383"
const val versionForBuildScript = "2.0.0-SNAPSHOT.383"
const val group = Spine.group
private const val prefix = "spine"
const val libModule = "$prefix-base"
Expand Down
14 changes: 13 additions & 1 deletion buildSrc/src/main/kotlin/io/spine/dependency/local/Compiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,19 @@ object Compiler : Dependency() {
get() = "$group:compiler-testlib:$version"

override val modules: List<String>
get() = listOf(api, backend, params, protocPlugin, gradleApi, cliApi, jvm, fatCli, testlib)
get() = listOf(
api,
backend,
params,
protocPlugin,
gradleApi,
cliApi,
jvm,
fatCli,
testlib
).map {
it.split(":").let { (group, artifact) -> "$group:$artifact" }
}

/**
* An env variable storing a custom [version].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package io.spine.dependency.local

// For backward compatibility.
@Suppress("unused")
@Deprecated("Use `CoreJvm` instead.", ReplaceWith("CoreJvm"))
typealias CoreJava = CoreJvm

/**
Expand All @@ -38,7 +39,7 @@ typealias CoreJava = CoreJvm
@Suppress("ConstPropertyName", "unused")
object CoreJvm {
const val group = Spine.group
const val version = "2.0.0-SNAPSHOT.356"
const val version = "2.0.0-SNAPSHOT.358"

const val coreArtifact = "spine-core"
const val clientArtifact = "spine-client"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
package io.spine.dependency.local

/**
* Dependencies on smaller Spine modules.
* Defines Maven groups for the Spine SDK artifacts.
*/
@Suppress("unused", "ConstPropertyName")
object Spine {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Validation {
/**
* The version of the Validation library artifacts.
*/
const val version = "2.0.0-SNAPSHOT.373"
const val version = "2.0.0-SNAPSHOT.375"

/**
* The last version of Validation compatible with ProtoData.
Expand All @@ -46,14 +46,15 @@ object Validation {
const val group = Spine.toolsGroup
private const val prefix = "validation"

const val gradlePluginLib = "$group:$prefix-gradle-plugin:$version"

const val runtimeModule = "${Spine.group}:spine-$prefix-jvm-runtime"

fun runtime(version: String) = "$runtimeModule:$version"
val runtime = runtime(version)

const val javaModule = "$group:$prefix-java"
const val java = "$javaModule:$version"

const val javaBundleModule = "$group:$prefix-java-bundle"

/** Obtains the artifact for the `java-bundle` artifact of the given version. */
Expand Down
9 changes: 3 additions & 6 deletions buildSrc/src/main/kotlin/io/spine/gradle/git/Repository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ class Repository private constructor(
private var currentBranch: String,
) : AutoCloseable {

private val logger = project.logger

/**
* Path to the temporal folder for a clone of the underlying repository.
*/
Expand All @@ -78,10 +76,9 @@ class Repository private constructor(
* Executes a command in the [location].
*/
private fun repoExecute(vararg command: String): String {
if (logger.isErrorEnabled) {
val msg = "[Repo (${project.path})] Executing command: `${command.toList().joinToString(" ")}`."
logger.error(msg)
}
val cmd = command.toList().joinToString(" ")
val msg = "[Repo (${project.path})] Executing command: `$cmd`."
System.err.println(msg)
return Cli(location.toFile()).execute(*command)
}

Expand Down
3 changes: 1 addition & 2 deletions buildSrc/src/main/kotlin/module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import io.spine.dependency.lib.Jackson
import io.spine.dependency.lib.Kotlin
import io.spine.dependency.lib.Protobuf
import io.spine.dependency.local.Base
import io.spine.dependency.local.CoreJava
import io.spine.dependency.local.CoreJvm
import io.spine.dependency.local.Logging
import io.spine.dependency.local.Reflect
Expand Down Expand Up @@ -182,7 +181,7 @@ fun Module.forceConfigurations() {
Logging.libJvm,
Logging.testLib,
Logging.grpcContext,
CoreJava.server,
CoreJvm.server,
CoreJvm.serverTestLib,
Validation.runtime,
Dokka.BasePlugin.lib,
Expand Down
5 changes: 5 additions & 0 deletions context-tests/Module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Module `context-tests`

This is a test-only module that verifies compilation using Protobuf files
in the `testFixtures` source set. The module is based on Prototap and verifies
the handling of errors in using validation options.
11 changes: 2 additions & 9 deletions model/build.gradle.kts → context-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
*/

import io.spine.dependency.artifact
import io.spine.dependency.local.CoreJava
import io.spine.dependency.local.Logging
import io.spine.dependency.local.Compiler
import io.spine.dependency.local.Logging
import io.spine.dependency.test.JUnit.Jupiter

plugins {
Expand All @@ -38,18 +37,12 @@ plugins {
}

dependencies {
api(CoreJava.server)
api(Compiler.jvm)
implementation(Compiler.backend)

implementation(project(":proto:configuration"))
implementation(project(":proto:context"))
implementation(project(":context"))
implementation(project(":jvm-runtime"))

testImplementation(Logging.testLib)?.because("We need `tapConsole`.")
testImplementation(Compiler.testlib)

testFixturesImplementation(project(":proto:configuration"))
testFixturesImplementation(Compiler.api)
testFixturesImplementation(Compiler.testlib)
testFixturesImplementation(Jupiter.artifact { params })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,11 @@
package io.spine.tools.validation

import com.google.protobuf.Message
import io.spine.format.Format
import io.spine.option.OptionsProto
import io.spine.testing.compiler.AbstractCompilationErrorTest
import io.spine.tools.compiler.ast.Field
import io.spine.tools.compiler.ast.filePattern
import io.spine.tools.compiler.plugin.Plugin
import io.spine.tools.compiler.protobuf.descriptor
import io.spine.tools.compiler.protobuf.field
import io.spine.tools.compiler.settings.SettingsDirectory
import io.spine.tools.compiler.settings.defaultConsumerId
import io.spine.validation.messageMarkers
import io.spine.validation.validationConfig
import kotlin.reflect.KClass

/**
Expand All @@ -49,22 +42,6 @@ internal abstract class CompilationErrorTest : AbstractCompilationErrorTest() {
override fun plugins(): List<Plugin> = listOf(
object : ValidationPlugin() {}
)

override fun writeSettings(settings: SettingsDirectory) {
val config = validationConfig {
messageMarkers = messageMarkers {
commandPattern.add(filePattern { suffix = "commands.proto" })
eventPattern.add(filePattern { suffix = "events.proto" })
rejectionPattern.add(filePattern { suffix = "rejections.proto" })
entityOptionName.add(OptionsProto.entity.descriptor.name)
}
}
settings.write(
ValidationPlugin::class.java.defaultConsumerId,
Format.ProtoJson,
config.toByteArray()
)
}
}

/**
Expand Down
22 changes: 22 additions & 0 deletions proto/context/build.gradle.kts → context/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,30 @@
import io.spine.dependency.local.Base
import io.spine.dependency.local.Compiler

buildscript {
standardSpineSdkRepositories()
configurations {
all {
resolutionStrategy {
force(
io.spine.dependency.local.Logging.grpcContext,
)
}
}
}
dependencies {
spineCompiler.run {
classpath(pluginLib(dogfoodingVersion))
}
classpath(io.spine.dependency.local.CoreJvmCompiler.pluginLib)
}
}

apply(plugin = "io.spine.core-jvm")

dependencies {
api(Compiler.backend)
api(Compiler.jvm)
implementation(Base.lib)
Comment on lines +49 to 54

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore core runtime dependencies in context module

The new context build file only pulls in compiler artifacts and spine-base, but the sources moved into this module now import server classes such as io.spine.server.event.React and io.spine.server.tuple.EitherOf2 (e.g. context/src/main/kotlin/io/spine/tools/validation/option/ChoiceOption.kt lines 29‑38). Previously the model module declared CoreJava.server/jvm-runtime to supply those types; after the consolidation those dependencies were dropped, so the context module’s compile classpath lacks the Spine server runtime and will fail to compile any of the option reactions. Add the core runtime dependency back to this module so the server types resolve.

Useful? React with 👍 / 👎.

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ import io.spine.tools.validation.option.WhenFieldView
import io.spine.tools.validation.option.WhenReaction
import io.spine.tools.validation.option.required.IfMissingReaction
import io.spine.tools.validation.option.required.RequiredFieldView
import io.spine.tools.validation.option.required.RequiredIdOptionReaction
import io.spine.tools.validation.option.required.RequiredIdPatternReaction
import io.spine.tools.validation.option.required.RequiredReaction

/**
Expand Down Expand Up @@ -106,8 +104,6 @@ public abstract class ValidationPlugin(
ChoiceReaction(),
IsRequiredReaction(),
WhenReaction(),
RequiredIdPatternReaction(),
RequiredIdOptionReaction(),
GoesReaction(),
SetOnceReaction(),
IfSetAgainReaction(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import io.spine.tools.validation.checkPlaceholders
import io.spine.tools.validation.defaultMessage
import io.spine.tools.validation.option.MAX
import io.spine.tools.validation.option.RANGE
import io.spine.tools.validation.bound.MaxField
import io.spine.tools.validation.bound.event.MaxFieldDiscovered
import io.spine.tools.validation.bound.event.maxFieldDiscovered

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import io.spine.tools.validation.checkPlaceholders
import io.spine.tools.validation.defaultMessage
import io.spine.tools.validation.option.MIN
import io.spine.tools.validation.option.RANGE
import io.spine.tools.validation.bound.MinField
import io.spine.tools.validation.bound.event.MinFieldDiscovered
import io.spine.tools.validation.bound.event.minFieldDiscovered

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import io.spine.tools.validation.bound.BoundFieldSupport.checkFieldType
import io.spine.tools.validation.checkPlaceholders
import io.spine.tools.validation.defaultMessage
import io.spine.tools.validation.option.RANGE
import io.spine.tools.validation.bound.RangeField
import io.spine.tools.validation.bound.event.RangeFieldDiscovered
import io.spine.tools.validation.bound.event.rangeFieldDiscovered

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ import io.spine.tools.compiler.ast.PrimitiveType
/**
* Determines whether the field type can be validated as `(required)`.
*/
internal object RequiredFieldSupport {
public object RequiredFieldSupport {

/**
* Tells if this [FieldType] can be validated with the `(required)` option.
* Tells if this [io.spine.tools.compiler.ast.FieldType] can
* be validated with the `(required)` option.
*/
fun FieldType.isSupported(): Boolean =
public fun FieldType.isSupported(): Boolean =
!isPrimitive || primitive in SUPPORTED_PRIMITIVES

private val SUPPORTED_PRIMITIVES = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ import io.spine.tools.validation.event.requiredFieldDiscovered
* Note that this reaction is responsible only for fields explicitly marked with
* the validation option. There are other reactions that handle implicitly
* required fields, i.e., ID fields in entities and signal messages.
*
* @see [RequiredIdOptionReaction]
* @see [RequiredIdPatternReaction]
*/
internal class RequiredReaction : Reaction<FieldOptionDiscovered>() {

Expand Down
Loading
Loading