Skip to content

Commit 4ddc267

Browse files
Merge pull request #139 from SpineEventEngine/bump-mc-java-and-protodata
Bump internal dependencies
2 parents 6093598 + 7227fe7 commit 4ddc267

38 files changed

+554
-328
lines changed

build.gradle.kts

+10-7
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@
2929
import io.spine.internal.dependency.Grpc
3030
import io.spine.internal.dependency.Kotlin
3131
import io.spine.internal.dependency.KotlinX
32-
import io.spine.internal.dependency.ProtoData
3332
import io.spine.internal.dependency.Roaster
34-
import io.spine.internal.dependency.Spine
33+
import io.spine.internal.dependency.spine.CoreJava
34+
import io.spine.internal.dependency.spine.Logging
35+
import io.spine.internal.dependency.spine.ProtoData
36+
import io.spine.internal.dependency.spine.Spine
37+
import io.spine.internal.dependency.spine.ToolBase
3538
import io.spine.internal.gradle.publish.PublishingRepos
3639
import io.spine.internal.gradle.publish.spinePublishing
3740
import io.spine.internal.gradle.report.coverage.JacocoConfig
@@ -93,11 +96,11 @@ allprojects {
9396
ProtoData.backend,
9497
ProtoData.java,
9598
Spine.base,
96-
Spine.Logging.lib,
97-
Spine.client,
98-
Spine.server,
99-
Spine.toolBase,
100-
Spine.pluginBase,
99+
Logging.lib,
100+
CoreJava.client,
101+
CoreJava.server,
102+
ToolBase.lib,
103+
ToolBase.pluginBase,
101104
Grpc.api,
102105
Grpc.context,
103106
Grpc.core,

buildSrc/src/main/kotlin/BuildExtensions.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ import io.spine.internal.dependency.GradleDoctor
3131
import io.spine.internal.dependency.Kotest
3232
import io.spine.internal.dependency.Kover
3333
import io.spine.internal.dependency.Ksp
34-
import io.spine.internal.dependency.McJava
35-
import io.spine.internal.dependency.ProtoData
36-
import io.spine.internal.dependency.ProtoTap
3734
import io.spine.internal.dependency.Protobuf
35+
import io.spine.internal.dependency.spine.McJava
36+
import io.spine.internal.dependency.spine.ProtoData
37+
import io.spine.internal.dependency.spine.ProtoTap
3838
import io.spine.internal.gradle.standardToSpineSdk
3939
import org.gradle.api.Project
4040
import org.gradle.api.Task

buildSrc/src/main/kotlin/DependencyResolution.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ import io.spine.internal.dependency.OpenTest4J
5050
import io.spine.internal.dependency.Plexus
5151
import io.spine.internal.dependency.Protobuf
5252
import io.spine.internal.dependency.Slf4J
53-
import io.spine.internal.dependency.Spine
5453
import io.spine.internal.dependency.Truth
54+
import io.spine.internal.dependency.spine.Spine
5555
import org.gradle.api.NamedDomainObjectContainer
5656
import org.gradle.api.Project
5757
import org.gradle.api.artifacts.Configuration
@@ -195,9 +195,10 @@ fun Project.forceSpineBase() {
195195
* Forces configurations containing `"proto"` in their names (disregarding the case) to
196196
* use [Spine.baseForBuildScript].
197197
*/
198+
@Suppress("unused")
198199
fun Project.forceBaseInProtoTasks() {
199200
configurations.configureEach {
200-
if (name.toLowerCase().contains("proto")) {
201+
if (name.lowercased().contains("proto")) {
201202
resolutionStrategy {
202203
force(Spine.baseForBuildScript)
203204
}

buildSrc/src/main/kotlin/DokkaExts.kt

+6-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import org.gradle.api.file.FileCollection
3535
import org.gradle.api.tasks.TaskContainer
3636
import org.gradle.api.tasks.TaskProvider
3737
import org.gradle.api.tasks.bundling.Jar
38-
import org.gradle.configurationcache.extensions.capitalized
3938
import org.gradle.kotlin.dsl.DependencyHandlerScope
4039
import org.jetbrains.dokka.DokkaConfiguration
4140
import org.jetbrains.dokka.base.DokkaBase
@@ -70,8 +69,10 @@ fun DependencyHandlerScope.useDokkaWithSpineExtensions() {
7069
private fun DependencyHandler.dokkaPlugin(dependencyNotation: Any): Dependency? =
7170
add("dokkaPlugin", dependencyNotation)
7271

73-
private fun Project.dokkaOutput(language: String): File =
74-
buildDir.resolve("docs/dokka${language.capitalized()}")
72+
private fun Project.dokkaOutput(language: String): File {
73+
val lng = language.titleCaseFirstChar()
74+
return layout.buildDirectory.dir("docs/dokka$lng").get().asFile
75+
}
7576

7677
fun Project.dokkaConfigFile(file: String): File {
7778
val dokkaConfDir = project.rootDir.resolve("buildSrc/src/main/resources/dokka")
@@ -183,7 +184,7 @@ fun Project.dokkaKotlinJar(): TaskProvider<Jar> = tasks.getOrCreate("dokkaKotlin
183184
* The task `"publishToMavenLocal"` is excluded from the check because it is a part of
184185
* the local testing workflow.
185186
*/
186-
fun DokkaTask.isInPublishingGraph(): Boolean =
187+
fun AbstractDokkaTask.isInPublishingGraph(): Boolean =
187188
project.gradle.taskGraph.allTasks.any {
188189
with(it.name) {
189190
startsWith("publish") && !startsWith("publishToMavenLocal")
@@ -216,7 +217,7 @@ fun Project.dokkaJavaJar(): TaskProvider<Jar> = tasks.getOrCreate("dokkaJavaJar"
216217
fun Project.disableDocumentationTasks() {
217218
gradle.taskGraph.whenReady {
218219
tasks.forEach { task ->
219-
val lowercaseName = task.name.toLowerCase()
220+
val lowercaseName = task.name.lowercased()
220221
if (lowercaseName.contains("dokka") || lowercaseName.contains("javadoc")) {
221222
task.enabled = false
222223
}

buildSrc/src/main/kotlin/Strings.kt

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright 2024, 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+
import org.gradle.configurationcache.extensions.capitalized
28+
29+
/**
30+
* This file provides extensions to `String` and `CharSequence` that wrap
31+
* analogues from standard Kotlin runtime.
32+
*
33+
* It helps in switching between versions of Gradle which have different versions of
34+
* the Kotlin runtime. Please see the bodies of the extension functions for details on
35+
* switching the implementations depending on the Kotlin version at hand.
36+
*
37+
* Once we migrate to newer Gradle, these wrappers should be inlined with
38+
* the subsequent removal of this source file.
39+
*/
40+
@Suppress("unused")
41+
private const val ABOUT = ""
42+
43+
/**
44+
* Makes the first character come in the title case.
45+
*/
46+
fun String.titleCaseFirstChar(): String {
47+
// return replaceFirstChar { it.titlecase() }
48+
// OR for earlier Kotlin versions:
49+
// 1. add import of `org.gradle.configurationcache.extensions.capitalized`
50+
// 2. call `capitalized()` instead of `replaceFirstChar` above.
51+
return capitalized()
52+
}
53+
54+
/**
55+
* Converts this string to lowercase.
56+
*/
57+
fun String.lowercased(): String {
58+
// return lowercase()
59+
// OR for earlier Kotlin versions call:
60+
return toLowerCase()
61+
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import com.google.protobuf.gradle.ProtobufExtension
2828
import io.spine.internal.dependency.Protobuf
29-
import io.spine.internal.dependency.Spine
3029
import io.spine.internal.gradle.publish.excludeGoogleProtoFromArtifacts
3130

3231
apply {

buildSrc/src/main/kotlin/dokka-for-java.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
*/
2626

27-
import org.jetbrains.dokka.gradle.DokkaTask
27+
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
2828

2929
plugins {
3030
id("org.jetbrains.dokka") // Cannot use `Dokka` dependency object here yet.
@@ -35,9 +35,9 @@ dependencies {
3535
useDokkaWithSpineExtensions()
3636
}
3737

38-
tasks.withType<DokkaTask>().configureEach {
38+
tasks.withType<AbstractDokkaLeafTask>().configureEach {
3939
configureForJava()
4040
onlyIf {
41-
(it as DokkaTask).isInPublishingGraph()
41+
(it as AbstractDokkaLeafTask).isInPublishingGraph()
4242
}
4343
}

buildSrc/src/main/kotlin/dokka-for-kotlin.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
*/
2626

27-
import org.jetbrains.dokka.gradle.DokkaTask
27+
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
2828

2929
plugins {
3030
id("org.jetbrains.dokka") // Cannot use `Dokka` dependency object here yet.
@@ -34,9 +34,9 @@ dependencies {
3434
useDokkaWithSpineExtensions()
3535
}
3636

37-
tasks.withType<DokkaTask>().configureEach {
37+
tasks.withType<AbstractDokkaLeafTask>().configureEach {
3838
configureForKotlin()
3939
onlyIf {
40-
(it as DokkaTask).isInPublishingGraph()
40+
(it as AbstractDokkaLeafTask).isInPublishingGraph()
4141
}
4242
}

0 commit comments

Comments
 (0)