diff --git a/buildSrc/src/main/kotlin/BuildExtensions.kt b/buildSrc/src/main/kotlin/BuildExtensions.kt index 35faf3ef..5c50c992 100644 --- a/buildSrc/src/main/kotlin/BuildExtensions.kt +++ b/buildSrc/src/main/kotlin/BuildExtensions.kt @@ -31,10 +31,10 @@ import io.spine.internal.dependency.GradleDoctor import io.spine.internal.dependency.Kotest import io.spine.internal.dependency.Kover import io.spine.internal.dependency.Ksp -import io.spine.internal.dependency.McJava -import io.spine.internal.dependency.ProtoData -import io.spine.internal.dependency.ProtoTap import io.spine.internal.dependency.Protobuf +import io.spine.internal.dependency.spine.McJava +import io.spine.internal.dependency.spine.ProtoData +import io.spine.internal.dependency.spine.ProtoTap import io.spine.internal.gradle.standardToSpineSdk import org.gradle.api.Project import org.gradle.api.Task diff --git a/buildSrc/src/main/kotlin/DependencyResolution.kt b/buildSrc/src/main/kotlin/DependencyResolution.kt index fd41c25d..a35d4a2a 100644 --- a/buildSrc/src/main/kotlin/DependencyResolution.kt +++ b/buildSrc/src/main/kotlin/DependencyResolution.kt @@ -50,8 +50,8 @@ import io.spine.internal.dependency.OpenTest4J import io.spine.internal.dependency.Plexus import io.spine.internal.dependency.Protobuf import io.spine.internal.dependency.Slf4J -import io.spine.internal.dependency.Spine import io.spine.internal.dependency.Truth +import io.spine.internal.dependency.spine.Spine import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.Project import org.gradle.api.artifacts.Configuration @@ -195,6 +195,7 @@ fun Project.forceSpineBase() { * Forces configurations containing `"proto"` in their names (disregarding the case) to * use [Spine.baseForBuildScript]. */ +@Suppress("unused") fun Project.forceBaseInProtoTasks() { configurations.configureEach { if (name.toLowerCase().contains("proto")) { diff --git a/buildSrc/src/main/kotlin/DokkaExts.kt b/buildSrc/src/main/kotlin/DokkaExts.kt index c6d619c4..59520ab1 100644 --- a/buildSrc/src/main/kotlin/DokkaExts.kt +++ b/buildSrc/src/main/kotlin/DokkaExts.kt @@ -70,8 +70,10 @@ fun DependencyHandlerScope.useDokkaWithSpineExtensions() { private fun DependencyHandler.dokkaPlugin(dependencyNotation: Any): Dependency? = add("dokkaPlugin", dependencyNotation) -private fun Project.dokkaOutput(language: String): File = - buildDir.resolve("docs/dokka${language.capitalized()}") +private fun Project.dokkaOutput(language: String): File { + val lng = language.capitalized() + return layout.buildDirectory.dir("docs/dokka$lng").get().asFile +} fun Project.dokkaConfigFile(file: String): File { val dokkaConfDir = project.rootDir.resolve("buildSrc/src/main/resources/dokka") @@ -183,7 +185,7 @@ fun Project.dokkaKotlinJar(): TaskProvider = tasks.getOrCreate("dokkaKotlin * The task `"publishToMavenLocal"` is excluded from the check because it is a part of * the local testing workflow. */ -fun DokkaTask.isInPublishingGraph(): Boolean = +fun AbstractDokkaTask.isInPublishingGraph(): Boolean = project.gradle.taskGraph.allTasks.any { with(it.name) { startsWith("publish") && !startsWith("publishToMavenLocal") diff --git a/buildSrc/src/main/kotlin/dokka-for-java.gradle.kts b/buildSrc/src/main/kotlin/dokka-for-java.gradle.kts index 8dc4df46..2c10701c 100644 --- a/buildSrc/src/main/kotlin/dokka-for-java.gradle.kts +++ b/buildSrc/src/main/kotlin/dokka-for-java.gradle.kts @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import org.jetbrains.dokka.gradle.DokkaTask +import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask plugins { id("org.jetbrains.dokka") // Cannot use `Dokka` dependency object here yet. @@ -35,9 +35,9 @@ dependencies { useDokkaWithSpineExtensions() } -tasks.withType().configureEach { +tasks.withType().configureEach { configureForJava() onlyIf { - (it as DokkaTask).isInPublishingGraph() + (it as AbstractDokkaLeafTask).isInPublishingGraph() } } diff --git a/buildSrc/src/main/kotlin/dokka-for-kotlin.gradle.kts b/buildSrc/src/main/kotlin/dokka-for-kotlin.gradle.kts index 5f20e007..73da35d8 100644 --- a/buildSrc/src/main/kotlin/dokka-for-kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/dokka-for-kotlin.gradle.kts @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import org.jetbrains.dokka.gradle.DokkaTask +import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask plugins { id("org.jetbrains.dokka") // Cannot use `Dokka` dependency object here yet. @@ -34,9 +34,9 @@ dependencies { useDokkaWithSpineExtensions() } -tasks.withType().configureEach { +tasks.withType().configureEach { configureForKotlin() onlyIf { - (it as DokkaTask).isInPublishingGraph() + (it as AbstractDokkaLeafTask).isInPublishingGraph() } } diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/Spine.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/Spine.kt deleted file mode 100644 index 08fab738..00000000 --- a/buildSrc/src/main/kotlin/io/spine/internal/dependency/Spine.kt +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2024, TeamDev. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.internal.dependency - -/** - * Dependencies on Spine modules. - */ -@Suppress("unused", "ConstPropertyName") -object Spine { - - const val group = "io.spine" - const val toolsGroup = "io.spine.tools" - - /** - * Versions for published Spine SDK artifacts. - */ - object ArtifactVersion { - - /** - * The version of [Spine.base]. - * - * @see spine-base - */ - const val base = "2.0.0-SNAPSHOT.212" - const val baseForBuildScript = "2.0.0-SNAPSHOT.212" - - /** - * The version of [Spine.reflect]. - * - * @see spine-reflect - */ - const val reflect = "2.0.0-SNAPSHOT.188" - - /** - * The version of [Spine.Logging]. - * - * @see spine-logging - */ - const val logging = "2.0.0-SNAPSHOT.233" - - /** - * The version of [Spine.testlib]. - * - * @see spine-testlib - */ - const val testlib = "2.0.0-SNAPSHOT.184" - - /** - * The version of `core-java`. - * - * @see [Spine.CoreJava.client] - * @see [Spine.CoreJava.server] - * @see core-java - */ - const val core = "2.0.0-SNAPSHOT.176" - - /** - * The version of [Spine.modelCompiler]. - * - * @see spine-model-compiler - */ - const val mc = "2.0.0-SNAPSHOT.133" - - /** - * The version of [Spine.baseTypes]. - * - * @see spine-base-types - */ - const val baseTypes = "2.0.0-SNAPSHOT.126" - - /** - * The version of [Spine.time]. - * - * @see spine-time - */ - const val time = "2.0.0-SNAPSHOT.135" - - /** - * The version of [Spine.change]. - * - * @see spine-change - */ - const val change = "2.0.0-SNAPSHOT.118" - - /** - * The version of [Spine.text]. - * - * @see spine-text - */ - const val text = "2.0.0-SNAPSHOT.6" - - /** - * The version of [Spine.toolBase]. - * - * @see spine-tool-base - */ - const val toolBase = "2.0.0-SNAPSHOT.226" - - /** - * The version of [Spine.javadocFilter]. - * - * @see spine-javadoc-tools - */ - const val javadocTools = "2.0.0-SNAPSHOT.75" - } - - const val base = "$group:spine-base:${ArtifactVersion.base}" - const val baseForBuildScript = "$group:spine-base:${ArtifactVersion.baseForBuildScript}" - - const val reflect = "$group:spine-reflect:${ArtifactVersion.reflect}" - const val baseTypes = "$group:spine-base-types:${ArtifactVersion.baseTypes}" - const val time = "$group:spine-time:${ArtifactVersion.time}" - const val change = "$group:spine-change:${ArtifactVersion.change}" - const val text = "$group:spine-text:${ArtifactVersion.text}" - - const val testlib = "$toolsGroup:spine-testlib:${ArtifactVersion.testlib}" - const val testUtilTime = "$toolsGroup:spine-testutil-time:${ArtifactVersion.time}" - const val psiJava = "$toolsGroup:spine-psi-java:${ArtifactVersion.toolBase}" - const val psiJavaBundle = "$toolsGroup:spine-psi-java-bundle:${ArtifactVersion.toolBase}" - const val toolBase = "$toolsGroup:spine-tool-base:${ArtifactVersion.toolBase}" - const val pluginBase = "$toolsGroup:spine-plugin-base:${ArtifactVersion.toolBase}" - const val pluginTestlib = "$toolsGroup:spine-plugin-testlib:${ArtifactVersion.toolBase}" - const val modelCompiler = "$toolsGroup:spine-model-compiler:${ArtifactVersion.mc}" - - @Deprecated(message = "Please use top level `McJava` object instead.") - val McJava = io.spine.internal.dependency.McJava - - /** - * Dependencies on the artifacts of the Spine Logging library. - * - * @see spine-logging - */ - object Logging { - const val version = ArtifactVersion.logging - const val lib = "$group:spine-logging:$version" - - const val log4j2Backend = "$group:spine-logging-log4j2-backend:$version" - const val stdContext = "$group:spine-logging-std-context:$version" - const val grpcContext = "$group:spine-logging-grpc-context:$version" - const val smokeTest = "$group:spine-logging-smoke-test:$version" - - // Transitive dependencies. - // Make `public` and use them to force a version in a particular repository, if needed. - internal const val julBackend = "$group:spine-logging-jul-backend:$version" - internal const val middleware = "$group:spine-logging-middleware:$version" - internal const val platformGenerator = "$group:spine-logging-platform-generator:$version" - internal const val jvmDefaultPlatform = "$group:spine-logging-jvm-default-platform:$version" - } - - const val javadocFilter = "$toolsGroup:spine-javadoc-filter:${ArtifactVersion.javadocTools}" - - const val client = CoreJava.client // Added for brevity. - const val server = CoreJava.server // Added for brevity. - - /** - * Dependencies on `core-java` modules. - * - * See [`SpineEventEngine/core-java`](https://github.com/SpineEventEngine/core-java/). - */ - object CoreJava { - const val version = ArtifactVersion.core - const val core = "$group:spine-core:$version" - const val client = "$group:spine-client:$version" - const val server = "$group:spine-server:$version" - const val testUtilServer = "$toolsGroup:spine-testutil-server:$version" - } -} diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ArtifactVersion.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ArtifactVersion.kt new file mode 100644 index 00000000..0b2652b8 --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ArtifactVersion.kt @@ -0,0 +1,117 @@ +/* + * Copyright 2024, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.internal.dependency.spine + +/** + * Versions for published Spine SDK artifacts. + */ +@Suppress("ConstPropertyName") +object ArtifactVersion { + + /** + * The version of [Spine.base]. + * + * @see spine-base + */ + const val base = "2.0.0-SNAPSHOT.215" + const val baseForBuildScript = "2.0.0-SNAPSHOT.215" + + /** + * The version of [Spine.reflect]. + * + * @see spine-reflect + */ + const val reflect = "2.0.0-SNAPSHOT.190" + + /** + * The version of [Logging]. + */ + @Deprecated(message = "Please use `Logging.version`.", ReplaceWith("Logging.version")) + const val logging = Logging.version + + /** + * The version of [Spine.testlib]. + * + * @see spine-testlib + */ + const val testlib = "2.0.0-SNAPSHOT.184" + + /** + * The version of `core-java`. + */ + @Deprecated(message = "Please use `CoreJava.version`.", ReplaceWith("CoreJava.version")) + const val core = CoreJava.version + + /** + * The version of [Spine.modelCompiler]. + * + * @see spine-model-compiler + */ + const val mc = "2.0.0-SNAPSHOT.133" + + /** + * The version of [Spine.baseTypes]. + * + * @see spine-base-types + */ + const val baseTypes = "2.0.0-SNAPSHOT.126" + + /** + * The version of [Spine.time]. + * + * @see spine-time + */ + const val time = "2.0.0-SNAPSHOT.135" + + /** + * The version of [Spine.change]. + * + * @see spine-change + */ + const val change = "2.0.0-SNAPSHOT.118" + + /** + * The version of [Spine.text]. + * + * @see spine-text + */ + const val text = "2.0.0-SNAPSHOT.6" + + /** + * The version of [Spine.toolBase]. + * + * @see spine-tool-base + */ + const val toolBase = ToolBase.version + + /** + * The version of [Spine.javadocFilter]. + * + * @see spine-javadoc-tools + */ + const val javadocTools = "2.0.0-SNAPSHOT.75" +} diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/CoreJava.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/CoreJava.kt new file mode 100644 index 00000000..82f8c087 --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/CoreJava.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2024, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.internal.dependency.spine + +/** + * Dependencies on `core-java` modules. + * + * See [`SpineEventEngine/core-java`](https://github.com/SpineEventEngine/core-java/). + */ +@Suppress("ConstPropertyName", "unused") +object CoreJava { + const val group = Spine.group + const val version = "2.0.0-SNAPSHOT.177" + const val core = "$group:spine-core:$version" + const val client = "$group:spine-client:$version" + const val server = "$group:spine-server:$version" + const val testUtilServer = "${Spine.toolsGroup}:spine-testutil-server:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Logging.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Logging.kt new file mode 100644 index 00000000..b5be98e4 --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Logging.kt @@ -0,0 +1,52 @@ +/* + * Copyright 2024, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.internal.dependency.spine + +/** + * Dependencies on the artifacts of the Spine Logging library. + * + * @see spine-logging + */ +@Suppress("ConstPropertyName", "unused") +object Logging { + const val version = "2.0.0-SNAPSHOT.240" + const val group = Spine.group + const val lib = "$group:spine-logging:$version" + const val libJvm = "$group:spine-logging-jvm:$version" + + const val log4j2Backend = "$group:spine-logging-log4j2-backend:$version" + const val stdContext = "$group:spine-logging-std-context:$version" + const val grpcContext = "$group:spine-logging-grpc-context:$version" + const val smokeTest = "$group:spine-logging-smoke-test:$version" + + // Transitive dependencies. + // Make `public` and use them to force a version in a particular repository, if needed. + internal const val julBackend = "$group:spine-logging-jul-backend:$version" + internal const val middleware = "$group:spine-logging-middleware:$version" + internal const val platformGenerator = "$group:spine-logging-platform-generator:$version" + internal const val jvmDefaultPlatform = "$group:spine-logging-jvm-default-platform:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/McJava.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/McJava.kt similarity index 75% rename from buildSrc/src/main/kotlin/io/spine/internal/dependency/McJava.kt rename to buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/McJava.kt index b1d0a052..2eee68ee 100644 --- a/buildSrc/src/main/kotlin/io/spine/internal/dependency/McJava.kt +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/McJava.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.internal.dependency +package io.spine.internal.dependency.spine /** * Dependencies on Spine Model Compiler for Java. @@ -33,26 +33,47 @@ package io.spine.internal.dependency */ @Suppress( "MemberVisibilityCanBePrivate" /* `pluginLib()` is used by subprojects. */, - "ConstPropertyName" + "ConstPropertyName", + "unused" ) object McJava { const val group = Spine.toolsGroup - /** The version used to in the build classpath. */ - const val dogfoodingVersion = "2.0.0-SNAPSHOT.242" + /** + * The version used to in the build classpath. + */ + const val dogfoodingVersion = "2.0.0-SNAPSHOT.244" - /** The version to be used for integration tests. */ - const val version = "2.0.0-SNAPSHOT.243" + /** + * The version to be used for integration tests. + */ + const val version = "2.0.0-SNAPSHOT.244" + /** + * The ID of the Gradle plugin. + */ const val pluginId = "io.spine.mc-java" + /** + * The library with the [dogfoodingVersion]. + */ val pluginLib = pluginLib(dogfoodingVersion) + + /** + * The library with the given [version]. + */ fun pluginLib(version: String): String = "$group:spine-mc-java-plugins:$version:all" /** The artifact reference for forcing in configurations. */ - @Suppress("unused") const val pluginsArtifact: String = "$group:spine-mc-java-plugins:$version" + /** + * The `mc-java-base` artifact with the [version]. + */ val base = base(version) + + /** + * The `mc-java-base` artifact with the given [version]. + */ fun base(version: String): String = "$group:spine-mc-java-base:$version" } diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoData.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ProtoData.kt similarity index 97% rename from buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoData.kt rename to buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ProtoData.kt index be14c890..9d03282b 100644 --- a/buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoData.kt +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ProtoData.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.internal.dependency +package io.spine.internal.dependency.spine /** * Dependencies on ProtoData modules. @@ -73,7 +73,7 @@ object ProtoData { * The version of ProtoData dependencies. */ val version: String - private const val fallbackVersion = "0.61.4" + private const val fallbackVersion = "0.64.0" /** * The distinct version of ProtoData used by other build tools. @@ -82,7 +82,7 @@ object ProtoData { * transitional dependencies, this is the version used to build the project itself. */ val dogfoodingVersion: String - private const val fallbackDfVersion = "0.61.4" + private const val fallbackDfVersion = "0.61.8" /** * The artifact for the ProtoData Gradle plugin. diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoTap.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ProtoTap.kt similarity index 97% rename from buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoTap.kt rename to buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ProtoTap.kt index 470f550d..681d5d22 100644 --- a/buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoTap.kt +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ProtoTap.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.internal.dependency +package io.spine.internal.dependency.spine /** * Dependencies on ProtoTap plugins. diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Spine.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Spine.kt new file mode 100644 index 00000000..faf8179d --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Spine.kt @@ -0,0 +1,82 @@ +/* + * Copyright 2024, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.internal.dependency.spine + +/** + * Dependencies on smaller Spine modules. + */ +@Suppress("unused", "ConstPropertyName") +object Spine { + + const val group = "io.spine" + const val toolsGroup = "io.spine.tools" + + const val base = "$group:spine-base:${ArtifactVersion.base}" + const val baseForBuildScript = "$group:spine-base:${ArtifactVersion.baseForBuildScript}" + + const val reflect = "$group:spine-reflect:${ArtifactVersion.reflect}" + const val baseTypes = "$group:spine-base-types:${ArtifactVersion.baseTypes}" + const val time = "$group:spine-time:${ArtifactVersion.time}" + const val change = "$group:spine-change:${ArtifactVersion.change}" + const val text = "$group:spine-text:${ArtifactVersion.text}" + + const val testlib = "$toolsGroup:spine-testlib:${ArtifactVersion.testlib}" + const val testUtilTime = "$toolsGroup:spine-testutil-time:${ArtifactVersion.time}" + + @Deprecated(message = "Please use `ToolBase.psiJava` instead`.") + const val psiJava = "$toolsGroup:spine-psi-java:${ArtifactVersion.toolBase}" + @Deprecated(message = "Please use `ToolBase.psiJava` instead`.") + const val psiJavaBundle = "$toolsGroup:spine-psi-java-bundle:${ArtifactVersion.toolBase}" + @Deprecated(message = "Please use `ToolBase.lib` instead`.") + const val toolBase = "$toolsGroup:spine-tool-base:${ArtifactVersion.toolBase}" + @Deprecated(message = "Please use `ToolBase.pluginBase` instead`.") + const val pluginBase = "$toolsGroup:spine-plugin-base:${ArtifactVersion.toolBase}" + @Deprecated(message = "Please use `ToolBase.pluginTestlib` instead`.") + const val pluginTestlib = "$toolsGroup:spine-plugin-testlib:${ArtifactVersion.toolBase}" + + const val modelCompiler = "$toolsGroup:spine-model-compiler:${ArtifactVersion.mc}" + + @Deprecated( + message = "Please use top level `McJava` object instead.", + ReplaceWith("McJava", "io.spine.internal.dependency.spine.McJava") + ) + val McJava = io.spine.internal.dependency.spine.McJava + + const val javadocFilter = "$toolsGroup:spine-javadoc-filter:${ArtifactVersion.javadocTools}" + + @Deprecated( + message = "Please use top level `CoreJava.client` object instead.", + ReplaceWith("CoreJava.client", "io.spine.internal.dependency.spine.CoreJava") + ) + const val client = CoreJava.client + + @Deprecated( + message = "Please use top level `CoreJava.server` object instead.", + ReplaceWith("CoreJava.server", "io.spine.internal.dependency.spine.CoreJava") + ) + const val server = CoreJava.server +} diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ToolBase.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ToolBase.kt new file mode 100644 index 00000000..29ed5605 --- /dev/null +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/ToolBase.kt @@ -0,0 +1,46 @@ +/* + * Copyright 2024, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.internal.dependency.spine + +/** + * Artifacts of the `tool-base` module. + * + * @see spine-tool-base + */ +@Suppress("ConstPropertyName", "unused") +object ToolBase { + const val group = Spine.toolsGroup + const val version = "2.0.0-SNAPSHOT.232" + + const val lib = "$group:spine-tool-base:$version" + const val pluginBase = "$group:spine-plugin-base:$version" + const val pluginTestlib = "$group:spine-plugin-testlib:$version" + + const val intellijPlatformJava = "$group:intellij-platform-java:$version" + + const val psiJava = "$group:spine-psi-java:$version" +} diff --git a/buildSrc/src/main/kotlin/io/spine/internal/dependency/Validation.kt b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Validation.kt similarity index 97% rename from buildSrc/src/main/kotlin/io/spine/internal/dependency/Validation.kt rename to buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Validation.kt index 591d2c4e..be2d0c93 100644 --- a/buildSrc/src/main/kotlin/io/spine/internal/dependency/Validation.kt +++ b/buildSrc/src/main/kotlin/io/spine/internal/dependency/spine/Validation.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.internal.dependency +package io.spine.internal.dependency.spine /** * Dependencies on Spine Validation SDK. diff --git a/buildSrc/src/main/kotlin/io/spine/internal/gradle/javadoc/ExcludeInternalDoclet.kt b/buildSrc/src/main/kotlin/io/spine/internal/gradle/javadoc/ExcludeInternalDoclet.kt index 4d5702bf..ef689d1a 100644 --- a/buildSrc/src/main/kotlin/io/spine/internal/gradle/javadoc/ExcludeInternalDoclet.kt +++ b/buildSrc/src/main/kotlin/io/spine/internal/gradle/javadoc/ExcludeInternalDoclet.kt @@ -1,11 +1,11 @@ /* - * Copyright 2023, TeamDev. All rights reserved. + * Copyright 2024, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and/or binary forms, with or without * modification, must retain the above copyright notice and the following @@ -26,7 +26,8 @@ package io.spine.internal.gradle.javadoc -import io.spine.internal.dependency.Spine +import io.spine.internal.dependency.spine.ArtifactVersion +import io.spine.internal.dependency.spine.Spine import io.spine.internal.gradle.javadoc.ExcludeInternalDoclet.Companion.taskName import io.spine.internal.gradle.sourceSets import org.gradle.api.Project @@ -40,7 +41,7 @@ import org.gradle.external.javadoc.StandardJavadocDocletOptions @Suppress("ConstPropertyName") class ExcludeInternalDoclet( @Deprecated("`Spine.ArtifactVersion.javadocTools` is used instead.") - val version: String = Spine.ArtifactVersion.javadocTools + val version: String = ArtifactVersion.javadocTools ) { private val dependency = Spine.javadocFilter diff --git a/buildSrc/src/main/kotlin/io/spine/internal/gradle/protobuf/ProtoTaskExtensions.kt b/buildSrc/src/main/kotlin/io/spine/internal/gradle/protobuf/ProtoTaskExtensions.kt index de78a5ec..60e9953a 100644 --- a/buildSrc/src/main/kotlin/io/spine/internal/gradle/protobuf/ProtoTaskExtensions.kt +++ b/buildSrc/src/main/kotlin/io/spine/internal/gradle/protobuf/ProtoTaskExtensions.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and/or binary forms, with or without * modification, must retain the above copyright notice and the following @@ -262,7 +262,9 @@ private fun GenerateProtoTask.dependOnProcessResourcesTask() { * Obtains the name of the `processResource` task for the given source set name. */ private fun processResourceTaskName(sourceSetName: String): String { - val infix = if (sourceSetName == "main") "" else sourceSetName.capitalized() + val infix = + if (sourceSetName == "main") "" + else sourceSetName.capitalized() return "process${infix}Resources" } diff --git a/buildSrc/src/main/kotlin/io/spine/internal/gradle/publish/Publications.kt b/buildSrc/src/main/kotlin/io/spine/internal/gradle/publish/Publications.kt index 0b4d24be..e89f5a9c 100644 --- a/buildSrc/src/main/kotlin/io/spine/internal/gradle/publish/Publications.kt +++ b/buildSrc/src/main/kotlin/io/spine/internal/gradle/publish/Publications.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and/or binary forms, with or without * modification, must retain the above copyright notice and the following @@ -174,14 +174,14 @@ internal class StandardJavaPublicationHandler( * * A typical Maven publication contains: * - * 1. Jar archives. For example: compilation output, sources, javadoc, etc. - * 2. Maven metadata file that has ".pom" extension. - * 3. Gradle's metadata file that has ".module" extension. + * 1. Jar archives. For example, compilation output, sources, javadoc, etc. + * 2. Maven metadata file that has the ".pom" extension. + * 3. Gradle's metadata file that has the ".module" extension. * - * Metadata files contain information about a publication itself, its artifacts and their + * Metadata files contain information about a publication itself, its artifacts, and their * dependencies. Presence of ".pom" file is mandatory for publication to be consumed by * `mvn` build tool itself or other build tools that understand Maven notation (Gradle, Ivy). - * Presence of ".module" is optional, but useful when a publication is consumed by Gradle. + * The presence of ".module" is optional, but useful when a publication is consumed by Gradle. * * @see Maven – POM Reference * @see diff --git a/buildSrc/src/main/kotlin/jvm-module.gradle.kts b/buildSrc/src/main/kotlin/jvm-module.gradle.kts index 86290834..dd67d1cc 100644 --- a/buildSrc/src/main/kotlin/jvm-module.gradle.kts +++ b/buildSrc/src/main/kotlin/jvm-module.gradle.kts @@ -34,7 +34,8 @@ import io.spine.internal.dependency.Jacoco import io.spine.internal.dependency.JavaX import io.spine.internal.dependency.Kotest import io.spine.internal.dependency.Protobuf -import io.spine.internal.dependency.Spine +import io.spine.internal.dependency.spine.Logging +import io.spine.internal.dependency.spine.Spine import io.spine.internal.gradle.checkstyle.CheckStyleConfig import io.spine.internal.gradle.github.pages.updateGitHubPages import io.spine.internal.gradle.javac.configureErrorProne @@ -45,19 +46,6 @@ import io.spine.internal.gradle.kotlin.setFreeCompilerArgs import io.spine.internal.gradle.report.license.LicenseReporter import io.spine.internal.gradle.testing.configureLogging import io.spine.internal.gradle.testing.registerTestTasks -import org.gradle.api.Project -import org.gradle.api.tasks.Delete -import org.gradle.api.tasks.compile.JavaCompile -import org.gradle.jvm.toolchain.JavaLanguageVersion -import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.getValue -import org.gradle.kotlin.dsl.idea -import org.gradle.kotlin.dsl.invoke -import org.gradle.kotlin.dsl.`java-library` -import org.gradle.kotlin.dsl.kotlin -import org.gradle.kotlin.dsl.provideDelegate -import org.gradle.kotlin.dsl.registering -import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -149,7 +137,7 @@ fun Module.addDependencies() = dependencies { compileOnlyApi(JavaX.annotations) ErrorProne.annotations.forEach { compileOnlyApi(it) } - implementation(Spine.Logging.lib) + implementation(Logging.lib) testImplementation(Guava.testLib) testImplementation(JUnit.runner) diff --git a/pull b/pull index fc6cfb8f..6d71d339 100755 --- a/pull +++ b/pull @@ -1,13 +1,13 @@ #!/usr/bin/env bash # -# Copyright 2023, TeamDev. All rights reserved. +# Copyright 2024, TeamDev. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Redistribution and use in source and/or binary forms, with or without # modification, must retain the above copyright notice and the following @@ -81,23 +81,21 @@ cp -a .github-workflows/. ../.github/workflows cp -a .github/workflows/. ../.github/workflows rm -f ../.github/workflows/detekt-code-analysis.yml # This one is `config`-only workflow. -echo "Cleaning up GitHub workflows" -# TODO:2022-11-15:yevhenii.nadtochii: Drop or update clean-up code below from time to time. -rm -f ../.github/workflows/ensure-reports.updated.yml - -echo "Cleaning up Gradle 'buildSrc' scripts" -# TODO:2022-11-02:yevhenii.nadtochii: Drop or update clean-up code below from time to time. -rm -f ../buildSrc/src/main/kotlin/force-jacoco.gradle.kts -rm -f ../buildSrc/src/main/kotlin/deps-between-tasks.kt -rm -f ../buildSrc/src/main/kotlin/io/spine/internal/gradle/Scripts.kt -rm -rf ../buildSrc/src/main/kotlin/io/spine/internal/gradle/test -rm -f ../buildSrc/src/main/kotlin/io/spine/internal/dependencies/AutoCommon.kt -rm -f ../buildSrc/src/main/kotlin/io/spine/internal/dependencies/AutoService.kt -rm -f ../buildSrc/src/main/kotlin/io/spine/internal/dependencies/AutoValue.kt -rm -f ../buildSrc/src/main/kotlin/io/spine/internal/gradle/publish/ProtoLocators.kt -rm -f ../buildSrc/src/main/kotlin/TaskDependencies.kt -rm -f ../buildSrc/src/main/kotlin/Dependencies.kt -rm -f ../buildSrc/src/main/kotlin/PluginAccessors.kt +# echo "Cleaning up GitHub workflows" +#rm -f ../buildSrc/src/main/kotlin/force-jacoco.gradle.kts +#rm -f ../buildSrc/src/main/kotlin/deps-between-tasks.kt + +# echo "Cleaning up Gradle 'buildSrc' scripts" +#rm -f ../buildSrc/src/main/kotlin/force-jacoco.gradle.kts +#rm -f ../buildSrc/src/main/kotlin/deps-between-tasks.kt + +echo "Cleaning up outdated dependency objects in 'buildSrc'" +# 2024-10-26, remove outdated files. +rm -f ../buildSrc/src/main/kotlin/io/spine/internal/dependency/McJava.kt +rm -f ../buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoData.kt +rm -f ../buildSrc/src/main/kotlin/io/spine/internal/dependency/ProtoTap.kt +rm -f ../buildSrc/src/main/kotlin/io/spine/internal/dependency/Spine.kt +rm -f ../buildSrc/src/main/kotlin/io/spine/internal/dependency/Validation.kt # 2023-04-13, remove outdated files.