Skip to content

Commit 3f0ab2f

Browse files
Merge pull request #48 from SpineEventEngine/bump-validation
Bump Protobuf, Base, and Validation
2 parents 1cbf443 + 7bcc794 commit 3f0ab2f

Some content is hidden

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

52 files changed

+507
-755
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ jobs:
5858
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5959
FORMAL_GIT_HUB_PAGES_AUTHOR: [email protected]
6060
# https://docs.github.com/en/actions/reference/environment-variables
61-
REPO_SLUG: $GITHUB_REPOSITORY # e.g. SpineEventEngine/core-java
61+
REPO_SLUG: ${{ github.repository }} # e.g. SpineEventEngine/core-jvm
6262
GOOGLE_APPLICATION_CREDENTIALS: ./maven-publisher.json
6363
NPM_TOKEN: ${{ secrets.NPM_SECRET }}

build.gradle.kts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import io.spine.dependency.lib.KotlinPoet
3636
import io.spine.dependency.lib.Protobuf
3737
import io.spine.dependency.local.Base
3838
import io.spine.dependency.local.Compiler
39-
import io.spine.dependency.local.CoreJava
39+
import io.spine.dependency.local.CoreJvm
4040
import io.spine.dependency.local.Logging
4141
import io.spine.dependency.local.ProtoData
4242
import io.spine.dependency.local.ToolBase
@@ -58,6 +58,7 @@ buildscript {
5858
dependencies {
5959
// Put the plugin before in the classpath to avoid complaints about the version.
6060
classpath(io.spine.dependency.build.Ksp.gradlePlugin)
61+
classpath(io.spine.dependency.local.Compiler.pluginLib)
6162
classpath(io.spine.dependency.local.CoreJvmCompiler.pluginLib)
6263
}
6364

@@ -108,10 +109,12 @@ configurations {
108109
Jackson.forceArtifacts(project, this@all, this@resolutionStrategy)
109110
Jackson.DataType.forceArtifacts(project, this@all, this@resolutionStrategy)
110111
force(
112+
Grpc.bom,
111113
Base.annotations,
112114
Base.lib,
115+
Base.environment,
113116
Compiler.api,
114-
CoreJava.server,
117+
CoreJvm.server,
115118
Dokka.BasePlugin.lib,
116119
Jackson.annotations,
117120
JSpecify.annotations,
@@ -127,6 +130,8 @@ configurations {
127130
ToolBase.protobufSetupPlugins,
128131
ToolBase.psiJava,
129132
Validation.runtime,
133+
Validation.javaBundle,
134+
Validation.oldRuntime
130135
)
131136
}
132137
}
@@ -142,11 +147,6 @@ spinePublishing {
142147
gitHub("base-types"),
143148
PublishingRepos.cloudArtifactRegistry
144149
)
145-
146-
dokkaJar {
147-
kotlin = true
148-
java = true
149-
}
150150
}
151151

152152
project.configureTaskDependencies()

buildSrc/build.gradle.kts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ val protobufPluginVersion = "0.9.5"
113113
* @see <a href="https://github.com/Kotlin/dokka/releases">
114114
* Dokka Releases</a>
115115
*/
116-
val dokkaVersion = "2.0.0"
116+
val dokkaVersion = "2.1.0"
117117

118118
/**
119119
* The version of Detekt Gradle Plugin.
@@ -127,11 +127,6 @@ val detektVersion = "1.23.8"
127127
*/
128128
val kotestJvmPluginVersion = "0.4.10"
129129

130-
/**
131-
* @see [io.spine.dependency.test.Kotest.MultiplatformGradlePlugin]
132-
*/
133-
val kotestMultiplatformPluginVersion = "6.0.0.M4"
134-
135130
/**
136131
* @see [io.spine.dependency.test.Kover]
137132
*/
@@ -185,7 +180,6 @@ dependencies {
185180
"com.gradleup.shadow:shadow-gradle-plugin:$shadowVersion",
186181
"io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion",
187182
"io.kotest:kotest-gradle-plugin:$kotestJvmPluginVersion",
188-
"io.kotest:kotest-framework-multiplatform-plugin-gradle:$kotestMultiplatformPluginVersion",
189183
// https://github.com/srikanth-lingala/zip4j
190184
"net.lingala.zip4j:zip4j:2.10.0",
191185
"net.ltgt.gradle:gradle-errorprone-plugin:$errorPronePluginVersion",

buildSrc/src/main/kotlin/BuildExtensions.kt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -199,43 +199,34 @@ fun Project.configureTaskDependencies() {
199199
}
200200

201201
afterEvaluate {
202-
val launchProtoData = "launchProtoData"
203-
val launchTestProtoData = "launchTestProtoData"
204202
val generateProto = "generateProto"
205203
val createVersionFile = "createVersionFile"
206204
val compileKotlin = "compileKotlin"
207205
compileKotlin.run {
208206
dependOn(generateProto)
209-
dependOn(launchProtoData)
210207
}
211208
val compileTestKotlin = "compileTestKotlin"
212-
compileTestKotlin.dependOn(launchTestProtoData)
213209
val sourcesJar = "sourcesJar"
214210
val kspKotlin = "kspKotlin"
215211
sourcesJar.run {
216212
dependOn(generateProto)
217-
dependOn(launchProtoData)
218213
dependOn(kspKotlin)
219214
dependOn(createVersionFile)
220215
dependOn("prepareProtocConfigVersions")
221216
}
222-
val dokkaHtml = "dokkaHtml"
223-
dokkaHtml.run {
217+
val dokkaGenerate = "dokkaGenerate"
218+
dokkaGenerate.run {
224219
dependOn(generateProto)
225-
dependOn(launchProtoData)
226-
dependOn(kspKotlin)
227-
}
228-
val dokkaJavadoc = "dokkaJavadoc"
229-
dokkaJavadoc.run {
230-
dependOn(launchProtoData)
231220
dependOn(kspKotlin)
232221
}
222+
val dokkaGeneratePublicationJavadoc = "dokkaGeneratePublicationJavadoc"
223+
dokkaGeneratePublicationJavadoc.dependOn(kspKotlin)
233224
"publishPluginJar".dependOn(createVersionFile)
234225
compileKotlin.dependOn(kspKotlin)
235226
compileTestKotlin.dependOn("kspTestKotlin")
236227
"compileTestFixturesKotlin".dependOn("kspTestFixturesKotlin")
237-
"javadocJar".dependOn(dokkaHtml)
238-
"dokkaKotlinJar".dependOn(dokkaJavadoc)
228+
"javadocJar".dependOn(dokkaGeneratePublicationJavadoc)
229+
"htmlDocsJar".dependOn(dokkaGenerate)
239230
}
240231
}
241232

buildSrc/src/main/kotlin/DocumentationSettings.kt

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
*/
2626

27+
import org.gradle.api.Project
28+
2729
/**
2830
* The documentation settings specific to this project.
2931
*
@@ -33,6 +35,36 @@
3335
@Suppress("ConstPropertyName")
3436
object DocumentationSettings {
3537

38+
/**
39+
* The organization infix for the Spine SDK.
40+
*/
41+
private const val orgPath = "github.com/SpineEventEngine"
42+
43+
/**
44+
* The organization URL of the Spine SDK.
45+
*/
46+
private const val orgUrl = "https://$orgPath"
47+
48+
/**
49+
* Obtains the repository URL for the given project.
50+
*/
51+
fun repoUrl(project: Project) = "https://${repoPath(project)}"
52+
53+
/**
54+
* Obtains the repository path for the given project.
55+
*/
56+
private fun repoPath(project: Project) = "$orgPath/${project.rootProject.name}"
57+
58+
/**
59+
* Obtains the connection URL for the given project.
60+
*/
61+
fun connectionUrl(project: Project) = "scm:git:git://${repoPath(project)}.git"
62+
63+
/**
64+
* Obtains the developer connection URL for the given project.
65+
*/
66+
fun developerConnectionUrl(project: Project) = "scm:git:ssh://${repoPath(project)}.git"
67+
3668
/**
3769
* Settings passed to Dokka for
3870
* [sourceLink][[org.jetbrains.dokka.gradle.engine.parameters.DokkaSourceLinkSpec]
@@ -43,12 +75,16 @@ object DocumentationSettings {
4375
* The URL of the remote source code
4476
* [location][org.jetbrains.dokka.gradle.engine.parameters.DokkaSourceLinkSpec.remoteUrl].
4577
*/
46-
const val url: String = "https://github.com/SpineEventEngine/base/tree/master/src"
78+
fun url(project: Project): String {
79+
val root = project.rootProject.name
80+
val module = project.name
81+
return "$orgUrl/$root/tree/master/$module/src/main/kotlin"
82+
}
4783

4884
/**
4985
* The suffix used to append the source code line number to the URL.
5086
*
51-
* The suffix depends on the online code repository.
87+
* The value depends on the online code repository and is set for GitHub (`#L`).
5288
*
5389
* @see <a href="https://kotlinlang.org/docs/dokka-gradle.html#fwor0d_534">
5490
* remoteLineSuffix</a>

buildSrc/src/main/kotlin/DokkaExts.kt

Lines changed: 17 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,18 @@ import io.spine.gradle.publish.getOrCreate
2929
import java.io.File
3030
import java.time.LocalDate
3131
import org.gradle.api.Project
32+
import org.gradle.api.Task
3233
import org.gradle.api.artifacts.Dependency
3334
import org.gradle.api.artifacts.dsl.DependencyHandler
34-
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
3838
import org.gradle.kotlin.dsl.DependencyHandlerScope
39-
import org.jetbrains.dokka.gradle.AbstractDokkaTask
4039
import org.jetbrains.dokka.gradle.DokkaExtension
41-
import org.jetbrains.dokka.gradle.DokkaTask
42-
import org.jetbrains.dokka.gradle.GradleDokkaSourceSetBuilder
4340
import org.jetbrains.dokka.gradle.engine.parameters.DokkaSourceSetSpec
4441
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
4542
import org.jetbrains.dokka.gradle.engine.plugins.DokkaHtmlPluginParameters
4643

47-
/**
48-
* To generate the documentation as seen from Java perspective, the `kotlin-as-java`
49-
* plugin was added to the Dokka classpath.
50-
*
51-
* @see <a href="https://github.com/Kotlin/dokka#output-formats">
52-
* Dokka output formats</a>
53-
*/
54-
fun DependencyHandlerScope.useDokkaForKotlinAsJava() {
55-
dokkaPlugin(Dokka.KotlinAsJavaPlugin.lib)
56-
}
57-
5844
/**
5945
* To exclude pieces of code annotated with `@Internal` from the documentation
6046
* a custom plugin is added to the Dokka classpath.
@@ -72,9 +58,8 @@ private fun DependencyHandler.dokkaPlugin(dependencyNotation: Any): Dependency?
7258
/**
7359
* Resolves the directory where Dokka outputs HTML documentation for the given language.
7460
*/
75-
internal fun Project.dokkaOutput(language: String): File {
76-
val lng = language.titleCaseFirstChar()
77-
return layout.buildDirectory.dir("docs/dokka$lng").get().asFile
61+
internal fun Project.dokkaHtmlOutput(): File {
62+
return layout.buildDirectory.dir("dokka/html").get().asFile
7863
}
7964

8065
/**
@@ -187,54 +172,42 @@ private fun DokkaSourceSetSpec.configureSourceSet(config: SourceSetConfig) {
187172
}
188173

189174
/**
190-
* Configures this [DokkaTask] to accept only Kotlin files.
175+
* Configures this [DokkaExtension] to accept only Kotlin files.
191176
*/
192177
fun DokkaExtension.configureForKotlin(project: Project, sourceLinkRemoteUrl: String) {
193178
configureFor(project, "kotlin", sourceLinkRemoteUrl)
194179
}
195180

196181
/**
197-
* Configures this [DokkaTask] to accept only Java files.
182+
* Configures this [DokkaExtension] to accept only Java files.
198183
*/
199184
@Suppress("unused")
200185
fun DokkaExtension.configureForJava(project: Project, sourceLinkRemoteUrl: String) {
201186
configureFor(project, "java", sourceLinkRemoteUrl)
202187
}
203188

204189
/**
205-
* Finds the `dokkaHtml` Gradle task.
190+
* Finds the `dokkaGenerateHtml` Gradle task.
206191
*/
207-
fun TaskContainer.dokkaHtmlTask(): DokkaTask? = this.findByName("dokkaHtml") as DokkaTask?
192+
fun TaskContainer.dokkaHtmlTask(): Task? = this.findByName("dokkaGeneratePublicationHtml")
208193

209194
/**
210-
* Returns only Java source roots out of all present in the source set.
211-
*
212-
* It is a helper method for generating documentation by Dokka only for Java code.
213-
* It is helpful when both Java and Kotlin source files are present in a source set.
214-
* Dokka can properly generate documentation for either Kotlin or Java depending on
215-
* the configuration, but not both.
195+
* Finds the `dokkaGeneratePublicationJavadoc` Gradle task.
216196
*/
217-
@Suppress("unused")
218-
internal fun GradleDokkaSourceSetBuilder.onlyJavaSources(): FileCollection {
219-
return sourceRoots.filter(File::isJavaSourceDirectory)
220-
}
221-
222-
private fun File.isJavaSourceDirectory(): Boolean {
223-
return isDirectory && name == "java"
224-
}
197+
fun TaskContainer.dokkaJavadocTask(): Task? = this.findByName("dokkaGeneratePublicationJavadoc")
225198

226199
/**
227-
* Locates or creates `dokkaKotlinJar` task in this [Project].
200+
* Locates or creates `htmlDocsJar` task in this [Project].
228201
*
229202
* The output of this task is a `jar` archive. The archive contains the Dokka output, generated upon
230203
* Kotlin sources from `main` source set. Requires Dokka to be configured in the target project by
231-
* applying `dokka-for-kotlin` plugin.
204+
* applying `dokka-setup` plugin.
232205
*/
233-
fun Project.dokkaKotlinJar(): TaskProvider<Jar> = tasks.getOrCreate("dokkaKotlinJar") {
234-
archiveClassifier.set("dokka")
235-
from(files(dokkaOutput("kotlin")))
206+
fun Project.htmlDocsJar(): TaskProvider<Jar> = tasks.getOrCreate("htmlDocsJar") {
207+
archiveClassifier.set("html-docs")
208+
from(files(dokkaHtmlOutput()))
236209

237-
tasks.dokkaHtmlTask()?.let{ dokkaTask ->
210+
tasks.dokkaHtmlTask()?.let { dokkaTask ->
238211
this@getOrCreate.dependsOn(dokkaTask)
239212
}
240213
}
@@ -246,29 +219,13 @@ fun Project.dokkaKotlinJar(): TaskProvider<Jar> = tasks.getOrCreate("dokkaKotlin
246219
* This predicate could be useful for disabling publishing tasks
247220
* when doing, e.g., `publishToMavenLocal` for the purpose of the
248221
* integration tests that (of course) do not test the documentation
249-
* generation proces and its resuults.
222+
* generation process and its results.
250223
*/
251-
fun AbstractDokkaTask.isInPublishingGraph(): Boolean =
224+
fun Task.isInPublishingGraph(): Boolean =
252225
project.gradle.taskGraph.allTasks.any {
253226
it.name == "publish" || it.name.contains("dokkaGenerate")
254227
}
255228

256-
/**
257-
* Locates or creates `dokkaJavaJar` task in this [Project].
258-
*
259-
* The output of this task is a `jar` archive. The archive contains the Dokka output, generated upon
260-
* Kotlin sources from `main` source set. Requires Dokka to be configured in the target project by
261-
* applying `dokka-for-java` and/or `dokka-for-kotlin` script plugin.
262-
*/
263-
fun Project.dokkaJavaJar(): TaskProvider<Jar> = tasks.getOrCreate("dokkaJavaJar") {
264-
archiveClassifier.set("dokka-java")
265-
from(files(dokkaOutput("java")))
266-
267-
tasks.dokkaHtmlTask()?.let{ dokkaTask ->
268-
this@getOrCreate.dependsOn(dokkaTask)
269-
}
270-
}
271-
272229
/**
273230
* Disables Dokka and Javadoc tasks in this `Project`.
274231
*

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

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)