diff --git a/.idea/misc.xml b/.idea/misc.xml index b9d0bed..5d98256 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/dependencies.md b/dependencies.md index 583617d..44a71d6 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine.chords:spine-chords-gradle-plugin:1.9.21` +# Dependencies of `io.spine.chords:spine-chords-gradle-plugin:1.9.22` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -751,4 +751,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Dec 29 10:48:38 EET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Sat Apr 25 01:52:04 EEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/gradle-plugin/src/functionalTest/kotlin/io/spine/chords/gradle/Given.kt b/gradle-plugin/src/functionalTest/kotlin/io/spine/chords/gradle/Given.kt index 87fa3f0..7da286f 100644 --- a/gradle-plugin/src/functionalTest/kotlin/io/spine/chords/gradle/Given.kt +++ b/gradle-plugin/src/functionalTest/kotlin/io/spine/chords/gradle/Given.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -35,6 +35,7 @@ package io.spine.chords.gradle */ internal fun generateGradleBuildFile( pluginId: String, + codegenPluginsArtifact: String, spineArtifactsRepo: String ): String = """ @@ -51,8 +52,7 @@ repositories { chordsGradlePlugin { protoDependencies("io.spine:spine-money:1.5.0") - codegenPluginsArtifact = - "io.spine.chords:spine-chords-codegen-plugins:2.0.0-SNAPSHOT.81" + codegenPluginsArtifact = "$codegenPluginsArtifact" } """.trimIndent() diff --git a/gradle-plugin/src/functionalTest/kotlin/io/spine/chords/gradle/GradlePluginSpec.kt b/gradle-plugin/src/functionalTest/kotlin/io/spine/chords/gradle/GradlePluginSpec.kt index 45a1999..30b11ef 100644 --- a/gradle-plugin/src/functionalTest/kotlin/io/spine/chords/gradle/GradlePluginSpec.kt +++ b/gradle-plugin/src/functionalTest/kotlin/io/spine/chords/gradle/GradlePluginSpec.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -27,12 +27,13 @@ package io.spine.chords.gradle import io.kotest.assertions.withClue +import io.kotest.matchers.ints.shouldBeGreaterThan import io.kotest.matchers.shouldBe -import java.io.File -import java.io.FileWriter import org.gradle.testkit.runner.GradleRunner import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test +import java.io.File +import java.io.FileWriter /** * The functional test for `io.spine.chords.gradle` Gradle plugin. @@ -47,6 +48,19 @@ class GradlePluginSpec { */ private const val pluginId = "io.spine.chords" + /** + * The Chords `codegen-plugins` dependency to generate the code with. + */ + private object CodegenPlugins { + private const val group = "io.spine.chords" + private const val prefix = "spine-chords-" + + // The latest version as of 2026-04-24. + private const val version = "2.0.0-SNAPSHOT.85" + + const val artifact = "$group:${prefix}codegen-plugins:$version" + } + /** * The Spine cloud artifacts repo to load the `codegen-plugins` from. */ @@ -78,7 +92,11 @@ class GradlePluginSpec { File(projectDir, "settings.gradle.kts").writeText("") File(projectDir, "build.gradle.kts").writeText( - generateGradleBuildFile(pluginId, spineArtifactsRepo) + generateGradleBuildFile( + pluginId, + CodegenPlugins.artifact, + spineArtifactsRepo + ) ) File(projectDir, sourceProtoFile).writeText( protoFileContent @@ -100,8 +118,12 @@ class GradlePluginSpec { result.output.contains(message) shouldBe true } + val expectedFile = File(projectDir, expectedKotlinFile) withClue("The required Kotlin file has not been generated.") { - File(projectDir, expectedKotlinFile).exists() shouldBe true + expectedFile.exists() shouldBe true + } + withClue("The generated Kotlin file is empty.") { + expectedFile.readText().length shouldBeGreaterThan 0 } } } diff --git a/gradle-plugin/src/main/kotlin/io/spine/chords/gradle/ApplyCodegenPlugins.kt b/gradle-plugin/src/main/kotlin/io/spine/chords/gradle/ApplyCodegenPlugins.kt index a7e86da..b9cb81d 100644 --- a/gradle-plugin/src/main/kotlin/io/spine/chords/gradle/ApplyCodegenPlugins.kt +++ b/gradle-plugin/src/main/kotlin/io/spine/chords/gradle/ApplyCodegenPlugins.kt @@ -1,3 +1,29 @@ +/* + * Copyright 2026, 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.chords.gradle import java.io.File @@ -50,7 +76,7 @@ public open class ApplyCodegenPlugins : DefaultTask() { public var sourceModuleDir: String = project.projectDir.path /** - * Dependencies that should be added to classpath of codegen module + * Dependencies that should be added to the classpath of the codegen module * to read the necessary Proto files. */ private val dependencies: MutableSet = mutableSetOf() diff --git a/pom.xml b/pom.xml index f86e8a4..ed1528c 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject. --> io.spine.chords Chords-Gradle-plugin -1.9.21 +1.9.22 2015 diff --git a/version.gradle.kts b/version.gradle.kts index 87ddba8..b51ee42 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2024, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -33,4 +33,4 @@ * * The version should be updated to `2.0.x` after migrating to Spine `2.0.x`. */ -val gradlePluginVersion: String by extra("1.9.21") +val gradlePluginVersion: String by extra("1.9.22")