Skip to content

Commit b146726

Browse files
Merge pull request #45 from SpineEventEngine/bump-kotlin
Bump Protobuf, Kotlin, and other dependencies
2 parents ddd5159 + b2c2c84 commit b146726

Some content is hidden

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

41 files changed

+711
-377
lines changed

build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import io.spine.dependency.boms.BomsPlugin
3030
import io.spine.dependency.build.Dokka
3131
import io.spine.dependency.build.JSpecify
32+
import io.spine.dependency.lib.Grpc
33+
import io.spine.dependency.lib.Kotlin
3234
import io.spine.dependency.lib.KotlinPoet
3335
import io.spine.dependency.lib.Protobuf
3436
import io.spine.dependency.local.Base
@@ -56,13 +58,16 @@ buildscript {
5658
}
5759

5860
dependencies {
61+
// Put the plugin before in the classpath to avoid complaints about the version.
62+
classpath(io.spine.dependency.build.Ksp.gradlePlugin)
5963
classpath(io.spine.dependency.local.McJava.pluginLib)
6064
}
6165

6266
configurations {
6367
all {
6468
resolutionStrategy {
6569
force(
70+
io.spine.dependency.lib.Kotlin.bom,
6671
io.spine.dependency.build.Dokka.BasePlugin.lib,
6772
io.spine.dependency.local.Base.lib,
6873
)
@@ -103,14 +108,17 @@ configurations {
103108

104109
all {
105110
resolutionStrategy {
111+
Grpc.forceArtifacts(project, this@all, this@resolutionStrategy)
106112
force(
113+
Kotlin.bom,
107114
JSpecify.annotations,
108115
KotlinPoet.lib,
109116
Dokka.BasePlugin.lib,
110117
Protobuf.compiler,
111118
Base.lib,
112119
Logging.lib,
113120
ToolBase.lib,
121+
ToolBase.psiJava,
114122
ProtoData.api,
115123
Validation.runtime,
116124
CoreJava.server,

buildSrc/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ val grGitVersion = "4.1.1"
7575
* This version may change from the [version of Kotlin][io.spine.dependency.lib.Kotlin.version]
7676
* used by the project.
7777
*/
78-
val kotlinEmbeddedVersion = "2.1.20"
78+
val kotlinEmbeddedVersion = "2.1.21"
7979

8080
/**
8181
* The version of Guava used in `buildSrc`.
@@ -103,7 +103,7 @@ val errorPronePluginVersion = "4.2.0"
103103
* @see <a href="https://github.com/google/protobuf-gradle-plugin/releases">
104104
* Protobuf Gradle Plugins Releases</a>
105105
*/
106-
val protobufPluginVersion = "0.9.4"
106+
val protobufPluginVersion = "0.9.5"
107107

108108
/**
109109
* The version of Dokka Gradle Plugins.

buildSrc/src/main/kotlin/BuildExtensions.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ fun ScriptHandlerScope.standardSpineSdkRepositories() {
7373
repositories.standardToSpineSdk()
7474
}
7575

76+
/**
77+
* Shortcut to [Protobuf] dependency object for using under `buildScript`.
78+
*/
79+
val ScriptHandlerScope.protobuf: Protobuf
80+
get() = Protobuf
81+
7682
/**
7783
* Shortcut to [McJava] dependency object for using under `buildScript`.
7884
*/
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
* Copyright 2025, TeamDev. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Redistribution and use in source and/or binary forms, with or without
11+
* modification, must retain the above copyright notice and the following
12+
* disclaimer.
13+
*
14+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
27+
package io.spine.dependency
28+
29+
import io.spine.gradle.log
30+
import org.gradle.api.Project
31+
import org.gradle.api.artifacts.Configuration
32+
import org.gradle.api.artifacts.ResolutionStrategy
33+
34+
/**
35+
* A dependency is a software component we use in a project.
36+
*
37+
* It could be a library, a set of libraries, or a development tool
38+
* that participates in a build.
39+
*/
40+
abstract class Dependency {
41+
42+
/**
43+
* The version of the dependency in terms of Maven coordinates.
44+
*/
45+
abstract val version: String
46+
47+
/**
48+
* The group of the dependency in terms of Maven coordinates.
49+
*/
50+
abstract val group: String
51+
52+
/**
53+
* The modules of the dependency that we use directly or
54+
* transitively in our projects.
55+
*/
56+
abstract val modules: List<String>
57+
58+
/**
59+
* The [modules] given with the [version].
60+
*/
61+
final val artifacts: Map<String, String> by lazy {
62+
modules.associateWith { "$it:$version" }
63+
}
64+
65+
/**
66+
* Obtains full Maven coordinates for the requested [module].
67+
*/
68+
fun artifact(module: String): String = artifacts[module] ?: error(
69+
"The dependency `${this::class.simpleName}` does not declare a module `$module`."
70+
)
71+
72+
/**
73+
* Forces all artifacts of this dependency using the given resolution strategy.
74+
*
75+
* @param project The project in which the artifacts are forced. Used for logging.
76+
* @param cfg The configuration for which the artifacts are forced. Used for logging.
77+
* @param rs The resolution strategy which forces the artifacts.
78+
*/
79+
fun forceArtifacts(project: Project, cfg: Configuration, rs: ResolutionStrategy) {
80+
artifacts.values.forEach {
81+
rs.forceWithLogging(project, cfg, it)
82+
}
83+
}
84+
}
85+
86+
/**
87+
* A dependency which declares a Maven Bill of Materials (BOM).
88+
*
89+
* @see <a href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Bill_of_Materials_.28BOM.29_POMs">
90+
* Maven Bill of Materials</a>
91+
* @see io.spine.dependency.boms.Boms
92+
* @see io.spine.dependency.boms.BomsPlugin
93+
*/
94+
abstract class DependencyWithBom : Dependency() {
95+
96+
/**
97+
* Maven coordinates of the dependency BOM.
98+
*/
99+
abstract val bom: String
100+
}
101+
102+
/**
103+
* Returns the suffix of diagnostic messages for this configuration in the given project.
104+
*/
105+
fun Configuration.diagSuffix(project: Project): String =
106+
"the configuration `$name` in the project: `${project.path}`."
107+
108+
109+
private fun ResolutionStrategy.forceWithLogging(
110+
project: Project,
111+
configuration: Configuration,
112+
artifact: String
113+
) {
114+
force(artifact)
115+
project.log { "Forced the version of `$artifact` in " + configuration.diagSuffix(project) }
116+
}

buildSrc/src/main/kotlin/io/spine/dependency/boms/Boms.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,41 @@
2626

2727
package io.spine.dependency.boms
2828

29+
import io.spine.dependency.DependencyWithBom
2930
import io.spine.dependency.kotlinx.Coroutines
3031
import io.spine.dependency.lib.Jackson
3132
import io.spine.dependency.lib.Kotlin
33+
import io.spine.dependency.lib.Grpc
3234
import io.spine.dependency.test.JUnit
3335

3436
/**
3537
* The collection of references to BOMs applied by [BomsPlugin].
38+
*
39+
* @see <a href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Bill_of_Materials_.28BOM.29_POMs">
40+
* Maven Bill of Materials</a>
3641
*/
3742
object Boms {
3843

3944
/**
4045
* The base production BOMs.
4146
*/
42-
val core = listOf(
43-
Kotlin.bom,
44-
Coroutines.bom
47+
val core: List<DependencyWithBom> = listOf(
48+
Kotlin,
49+
Coroutines
4550
)
4651

4752
/**
4853
* The BOMs for testing dependencies.
4954
*/
50-
val testing = listOf(
51-
JUnit.bom
55+
val testing: List<DependencyWithBom> = listOf(
56+
JUnit
5257
)
5358

5459
/**
5560
* Technology-based BOMs.
5661
*/
5762
object Optional {
58-
val jackson = listOf(
59-
Jackson.bom
60-
)
63+
val jackson = Jackson.bom
64+
val grpc = Grpc.bom
6165
}
6266
}

0 commit comments

Comments
 (0)