Skip to content

Commit c94466b

Browse files
Merge pull request #240 from SpineEventEngine/migrate-to-reaction-api
Migrate to `Reaction` API
2 parents 0aeca62 + 111fd99 commit c94466b

File tree

57 files changed

+424
-287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+424
-287
lines changed

buildSrc/src/main/kotlin/build-proto-model.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2022, 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.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Redistribution and use in source and/or binary forms, with or without
1111
* modification, must retain the above copyright notice and the following

buildSrc/src/main/kotlin/io/spine/dependency/build/LicenseReport.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ package io.spine.dependency.build
2929
// https://github.com/jk1/Gradle-License-Report
3030
@Suppress("unused")
3131
object LicenseReport {
32-
private const val version = "1.16"
32+
private const val version = "3.0.1"
3333
const val lib = "com.github.jk1:gradle-license-report:$version"
3434

3535
object GradlePlugin {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ package io.spine.dependency.local
2929
/**
3030
* Dependencies on the Spine Compiler modules.
3131
*
32-
* To use a locally published ProtoData version instead of the version from a public plugin
32+
* To use a locally published Compiler version instead of the version from a public plugin
3333
* registry, set the `COMPILER_VERSION` and/or the `COMPILER_DF_VERSION` environment variables
3434
* and stop the Gradle daemons so that Gradle observes the env change:
3535
* ```
@@ -67,22 +67,22 @@ object Compiler {
6767
const val module = "io.spine.tools:compiler"
6868

6969
/**
70-
* The version of ProtoData dependencies.
70+
* The version of the Compiler dependencies.
7171
*/
7272
val version: String
73-
private const val fallbackVersion = "2.0.0-SNAPSHOT.030"
73+
private const val fallbackVersion = "2.0.0-SNAPSHOT.034"
7474

7575
/**
76-
* The distinct version of ProtoData used by other build tools.
76+
* The distinct version of the Compiler used by other build tools.
7777
*
78-
* When ProtoData is used both for building the project and as a part of the Project's
79-
* transitional dependencies, this is the version used to build the project itself.
78+
* When the Compiler is used both for building the project and as a part of the Project's
79+
* transitive dependencies, this is the version used to build the project itself.
8080
*/
8181
val dogfoodingVersion: String
8282
private const val fallbackDfVersion = "2.0.0-SNAPSHOT.030"
8383

8484
/**
85-
* The artifact for the ProtoData Gradle plugin.
85+
* The artifact for the Compiler Gradle plugin.
8686
*/
8787
val pluginLib: String
8888

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@
2727
package io.spine.dependency.local
2828

2929
// For backward compatibility.
30+
@Suppress("unused")
3031
typealias CoreJava = CoreJvm
3132

3233
/**
33-
* Dependencies on `core-java` modules.
34+
* Dependencies on `core-jvm` modules.
3435
*
35-
* See [`SpineEventEngine/core-java`](https://github.com/SpineEventEngine/core-java/).
36+
* See [`SpineEventEngine/core-jvm`](https://github.com/SpineEventEngine/core-jvm/).
3637
*/
3738
@Suppress("ConstPropertyName", "unused")
3839
object CoreJvm {
3940
const val group = Spine.group
40-
const val version = "2.0.0-SNAPSHOT.346"
41+
const val version = "2.0.0-SNAPSHOT.356"
4142

4243
const val coreArtifact = "spine-core"
4344
const val clientArtifact = "spine-client"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ object CoreJvmCompiler {
4646
/**
4747
* The version used to in the build classpath.
4848
*/
49-
const val dogfoodingVersion = "2.0.0-SNAPSHOT.034"
49+
const val dogfoodingVersion = "2.0.0-SNAPSHOT.035"
5050

5151
/**
5252
* The version to be used for integration tests.
5353
*/
54-
const val version = "2.0.0-SNAPSHOT.034"
54+
const val version = "2.0.0-SNAPSHOT.035"
5555

5656
/**
5757
* The ID of the Gradle plugin.

buildSrc/src/main/kotlin/io/spine/gradle/git/Repository.kt

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626

2727
package io.spine.gradle.git
2828

29+
import com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly
2930
import io.spine.gradle.Cli
3031
import io.spine.gradle.fs.LazyTempPath
32+
import java.util.concurrent.TimeUnit.MILLISECONDS
3133
import org.gradle.api.logging.Logger
3234

3335
/**
@@ -133,8 +135,10 @@ class Repository private constructor(
133135
* Performs a pull with rebase before pushing to ensure the local branch is up-to-date.
134136
*/
135137
fun push() {
136-
repoExecute("git", "pull", "--rebase")
137-
repoExecute("git", "push")
138+
withRetries(description = "Pushing to $sshUrl, branch = '$currentBranch'") {
139+
repoExecute("git", "pull", "--rebase")
140+
repoExecute("git", "push")
141+
}
138142
}
139143

140144
override fun close() {
@@ -174,3 +178,43 @@ class Repository private constructor(
174178
}
175179
}
176180
}
181+
182+
/**
183+
* Executes a given operation with retries using exponential backoff strategy.
184+
*
185+
* If the operation fails, it will be retried up to the specified number of times
186+
* with increasing delays between attempts.
187+
* The delay increases exponentially but is capped at the specified maximum value.
188+
*
189+
* If all retries fail, the exception from the final attempt will be thrown to the caller.
190+
*
191+
* @param T the type of value returned by the operation
192+
* @param times the maximum number of attempts to execute the operation (default: 3)
193+
* @param initialDelay the delay before the first retry in milliseconds (default: 100ms)
194+
* @param maxDelay the maximum delay between retries in milliseconds (default: 2000ms)
195+
* @param factor the multiplier used to increase delay after each failure (default: 2.0)
196+
* @param description a description of the operation for error reporting (default: empty string)
197+
* @param block the operation to execute
198+
* @return the result of the successful operation execution
199+
*/
200+
private fun <T> withRetries(
201+
times: Int = 3,
202+
initialDelay: Long = 100, // ms
203+
maxDelay: Long = 2000, // ms
204+
factor: Double = 2.0,
205+
description: String = "",
206+
block: () -> T
207+
): T {
208+
var currentDelay = initialDelay
209+
repeat(times - 1) {
210+
try {
211+
return block()
212+
} catch (e: Exception) {
213+
System.err.println("'$description' failed. " +
214+
"Message: '${e.message}'. Retrying in $currentDelay ms.")
215+
}
216+
sleepUninterruptibly(currentDelay, MILLISECONDS)
217+
currentDelay = (currentDelay * factor).toLong().coerceAtMost(maxDelay)
218+
}
219+
return block()
220+
}

buildSrc/src/main/kotlin/io/spine/gradle/report/license/LicenseReporter.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,14 @@ object LicenseReporter {
155155
.map {
156156
val buildDir = it.layout.buildDirectory.asFile.get()
157157
"$buildDir/${Paths.relativePath}/${Paths.outputFilename}"
158-
}.filter { File(it).exists() }
159-
println("Merging the license reports from the all projects.")
158+
}.filter {
159+
val exists = File(it).exists()
160+
if (!exists) {
161+
rootProject.logger.debug("License report file not found: $it")
162+
}
163+
exists
164+
}
165+
println("Merging the license reports from all projects.")
160166
val mergedContent = paths.joinToString("\n\n\n") { (File(it)).readText() }
161167
val output = File("${rootProject.rootDir}/${Paths.outputFilename}")
162168
output.writeText(mergedContent)

buildSrc/src/main/kotlin/module.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import io.spine.dependency.local.Time
4343
import io.spine.dependency.local.ToolBase
4444
import io.spine.dependency.local.Validation
4545
import io.spine.dependency.test.JUnit
46+
import io.spine.gradle.github.pages.updateGitHubPages
4647
import io.spine.gradle.javac.configureErrorProne
4748
import io.spine.gradle.javac.configureJavac
4849
import io.spine.gradle.javadoc.JavadocConfig
@@ -86,6 +87,7 @@ project.run {
8687
configureTaskDependencies()
8788
dependTestOnJavaRuntime()
8889
configureProtoc()
90+
setupDocPublishing()
8991
}
9092

9193
/**
@@ -276,3 +278,16 @@ fun Module.configureProtoc() {
276278
protoc { artifact = Protobuf.compiler }
277279
}
278280
}
281+
282+
/**
283+
* Configures documentation publishing for this subproject.
284+
*/
285+
fun Module.setupDocPublishing() {
286+
updateGitHubPages {
287+
rootFolder.set(rootDir)
288+
}
289+
290+
tasks.named("publish") {
291+
dependsOn("${project.path}:updateGitHubPages")
292+
}
293+
}

buildSrc/src/main/kotlin/test-module.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@
2626

2727
import io.spine.dependency.local.Base
2828
import io.spine.dependency.local.Validation
29+
import io.spine.gradle.report.license.LicenseReporter
2930

3031
plugins {
3132
java
3233
`java-test-fixtures`
34+
id("module-testing")
3335
}
36+
LicenseReporter.generateReportIn(project)
3437

3538
dependencies {
3639
arrayOf(

0 commit comments

Comments
 (0)