diff --git a/.github/workflows/diktat_snapshot.yml b/.github/workflows/diktat_snapshot.yml index dafc6b9786..426ac35eb0 100644 --- a/.github/workflows/diktat_snapshot.yml +++ b/.github/workflows/diktat_snapshot.yml @@ -56,9 +56,6 @@ jobs: mv gradle/libs.versions.toml gradle/libs.versions.toml_current mv build/diktat-snapshot/libs.versions.toml gradle/libs.versions.toml - mv gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts_current - mv build/diktat-snapshot/diktat-convention-configuration.gradle.kts gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts - # copied from .github/workflows/diktat.yml - uses: gradle/gradle-build-action@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 488923fb66..d5db8d2fff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,6 +50,16 @@ jobs: publishToSonatype closeAndReleaseSonatypeStagingRepository + - name: 'Publish a release to Gradle Plugins' + id: publish-sonatype + uses: gradle/gradle-build-action@v2 + with: + gradle-version: wrapper + arguments: | + :diktat-gradle-plugin:publishPlugins + -Pgradle.publish.key=${{ secrets.GRADLE_KEY }} + -Pgradle.publish.secret=${{ secrets.GRADLE_SECRET }} + github_release: needs: release name: 'Github Release' diff --git a/build.gradle.kts b/build.gradle.kts index ba66f0b157..e84609569d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -42,10 +42,8 @@ tasks.create("generateLibsForDiktatSnapshot") { dependsOn(dependencies.map { "${it.path}:publishToMavenLocal" }) val libsFile = rootProject.file("gradle/libs.versions.toml") - val diktatGradleFile = rootProject.file("gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts") inputs.file(libsFile) - inputs.file(diktatGradleFile) inputs.files(dependencies.map { it.pomFile() }) inputs.files(dependencies.map { it.artifactFile() }) inputs.property("project-version", version.toString()) @@ -68,18 +66,6 @@ tasks.create("generateLibsForDiktatSnapshot") { Files.write(libsFileForDiktatSnapshot.toPath(), it) } - Files.readAllLines(diktatGradleFile.toPath()) - .map { line -> - when { - line.contains("com.saveourtool.diktat.diktat-gradle-plugin") -> line.replace("com.saveourtool.diktat.diktat-gradle-plugin", "com.saveourtool.diktat") - else -> line - } - } - .let { - val diktatGradleFileForDiktatSnapshot = dir.resolve("diktat-convention-configuration.gradle.kts") - Files.write(diktatGradleFileForDiktatSnapshot.toPath(), it) - } - dependencies.forEach { dependency -> val artifactDir = dir.pathToMavenArtifact(dependency) .also { it.createDirectory() } diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 1a2e77ff1a..95808a6ada 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -44,6 +44,9 @@ gradlePlugin { plugins { create("diktatPlugin") { id = "com.saveourtool.diktat" + displayName = "Static code analysis for Kotlin" + description = "Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs" + tags = listOf("kotlin", "code-analysis") implementationClass = "com.saveourtool.diktat.plugin.gradle.DiktatGradlePlugin" } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a7026d407..18aa477e99 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,7 +35,7 @@ gradle-shadow = "8.1.1" jetbrains-annotations = "24.0.1" kotlinx-coroutines = "1.7.3" assertj = "3.24.2" -diktat = "1.3.0-SNAPSHOT" +diktat = "2.0.0-rc.6" reckon = "0.18.1" spotless = "6.22.0" download = "5.5.0" diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts index af84f299f7..532aba2bf6 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts @@ -1,7 +1,7 @@ package com.saveourtool.diktat.buildutils plugins { - id("com.saveourtool.diktat.diktat-gradle-plugin") + id("com.saveourtool.diktat") } diktat {