diff --git a/.github/workflows/diktat_snapshot.yml b/.github/workflows/diktat_snapshot.yml index e2143b0289..d38c8845bb 100644 --- a/.github/workflows/diktat_snapshot.yml +++ b/.github/workflows/diktat_snapshot.yml @@ -46,11 +46,6 @@ jobs: with: gradle-version: wrapper arguments: | - :diktat-api:publishToMavenLocal - :diktat-common:publishToMavenLocal - :diktat-ktlint-engine:publishToMavenLocal - :diktat-rules:publishToMavenLocal - :diktat-gradle-plugin:publishToMavenLocal :generateLibsForDiktatSnapshot -x detekt -x test diff --git a/README.md b/README.md index a335942094..891bb13132 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ ![Build and test](https://github.com/saveourtool/diKTat/workflows/Build%20and%20test/badge.svg?branch=master) ![deteKT static analysis](https://github.com/saveourtool/diKTat/workflows/Run%20deteKT/badge.svg) -![diKTat code style](https://github.com/saveourtool/diKTat/workflows/Run%20diKTat%20from%20release%20version/badge.svg?branch=master) +![diKTat code style](https://github.com/saveourtool/diKTat/workflows/Run%20diKTat%20%28release%29/badge.svg?branch=master) [![codecov](https://codecov.io/gh/saveourtool/diKTat/branch/master/graph/badge.svg)](https://codecov.io/gh/saveourtool/diKTat) [![Releases](https://img.shields.io/github/v/release/saveourtool/diKTat)](https://github.com/saveourtool/diKTat/releases) [![Maven Central](https://img.shields.io/maven-central/v/com.saveourtool.diktat/diktat-rules)](https://mvnrepository.com/artifact/com.saveourtool.diktat) -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsaveourtool%2FdiKTat.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsaveourtool%2FdiKTat?ref=badge_shield) +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsaveourtool%2Fdiktat.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsaveourtool%2Fdiktat?ref=badge_shield) [![Chat on Telegram](https://img.shields.io/badge/Chat%20on-Telegram-brightgreen.svg)](https://t.me/diktat_help) [![Hits-of-Code](https://hitsofcode.com/github/saveourtool/diktat)](https://hitsofcode.com/view/github/saveourtool/diktat) diff --git a/build.gradle.kts b/build.gradle.kts index afba69b985..3dee31eeb1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,7 +39,7 @@ tasks.create("generateLibsForDiktatSnapshot") { rootProject.project(":diktat-rules"), rootProject.project(":diktat-gradle-plugin"), ) - mustRunAfter(dependencies.map { "${it.path}:publishToMavenLocal" }) + dependsOn(dependencies.map { "${it.path}:publishToMavenLocal" }) val libsFile = rootProject.file("gradle/libs.versions.toml") inputs.file(libsFile) diff --git a/diktat-cli/build.gradle.kts b/diktat-cli/build.gradle.kts index b7db4f5702..f14c1004cd 100644 --- a/diktat-cli/build.gradle.kts +++ b/diktat-cli/build.gradle.kts @@ -1,3 +1,4 @@ +import com.saveourtool.diktat.buildutils.configurePublications import com.github.jengelman.gradle.plugins.shadow.ShadowExtension import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.jetbrains.kotlin.incremental.createDirectory @@ -92,3 +93,4 @@ publishing { } } } +configurePublications() diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index e1db1fb38c..27f0a82387 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -1,13 +1,16 @@ +import com.saveourtool.diktat.buildutils.configurePom import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +//import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { id("com.saveourtool.diktat.buildutils.kotlin-jvm-configuration") id("com.saveourtool.diktat.buildutils.code-quality-convention") - id("com.saveourtool.diktat.buildutils.publishing-default-configuration") + id("com.saveourtool.diktat.buildutils.publishing-configuration") id("pl.droidsonroids.jacoco.testkit") version "1.0.12" id("org.gradle.test-retry") version "1.5.6" id("com.gradle.plugin-publish") version "1.2.1" +// alias(libs.plugins.shadow) } dependencies { @@ -38,6 +41,8 @@ tasks.withType<KotlinCompile> { } gradlePlugin { + website = "https://diktat.saveourtool.com/" + vcsUrl = "https://github.com/saveourtool/diktat" plugins { create("diktatPlugin") { id = "com.saveourtool.diktat.diktat-gradle-plugin" @@ -46,6 +51,38 @@ gradlePlugin { } } +//tasks.named("jar") { +// enabled = false +//} +//val shadowJar by tasks.existing(ShadowJar::class) { +// archiveClassifier.set("") +// duplicatesStrategy = DuplicatesStrategy.FAIL +//} +// +//val javadocJar by tasks.registering(Jar::class) { +// group = "documentation" +// archiveClassifier.set("javadoc") +// from(tasks.named("dokkaHtml")) +//} +// +//publishing { +// repositories { +// mavenLocal() +// } +// publications { +// val pluginMaven by creating(MavenPublication::class) { +// artifact(shadowJar) +// artifact(javadocJar) +// pom { +// configurePom(project) +// } +// } +// } +//} + + + + // === testing & code coverage, jacoco is run independent from maven val functionalTestTask by tasks.register<Test>("functionalTest") tasks.withType<Test> { @@ -104,14 +141,8 @@ tasks.jacocoTestReport { } } -afterEvaluate { - tasks.named("javadocJar") { - enabled = false - } - tasks.named("generateMetadataFileForPluginMavenPublication") { - dependsOn(tasks.named("dokkaJar")) - } - tasks.named("generateMetadataFileForMavenPublication") { - dependsOn(tasks.named("dokkaJar")) - } -} +//afterEvaluate { +// tasks.named("publishDiktatPluginPluginMarkerMavenPublicationToMavenLocal") { +// dependsOn(javadocJar) +// } +//} diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index 05ace85be0..3497312994 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -1,3 +1,4 @@ +import com.saveourtool.diktat.buildutils.configurePublications import de.benediktritter.maven.plugin.development.task.GenerateHelpMojoSourcesTask import de.benediktritter.maven.plugin.development.task.GenerateMavenPluginDescriptorTask @@ -47,3 +48,4 @@ publishing { } } } +configurePublications() diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 6f066d90bd..94bc7dc4b7 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -1,4 +1,5 @@ import com.saveourtool.diktat.buildutils.configurePom +import com.saveourtool.diktat.buildutils.configurePublications import com.github.jengelman.gradle.plugins.shadow.ShadowExtension import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar @@ -73,3 +74,4 @@ publishing { } } } +configurePublications() diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/PublishingConfiguration.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/PublishingConfiguration.kt index 321a8295de..ac62e3aca1 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/PublishingConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/PublishingConfiguration.kt @@ -39,7 +39,6 @@ import org.jetbrains.dokka.gradle.DokkaPlugin * Configures all aspects of the publishing process. */ fun Project.configurePublishing() { - configurePublications() apply<MavenPublishPlugin>() if (this == rootProject) { configureNexusPublishing() @@ -161,7 +160,7 @@ private fun Project.configureGitHubPublishing() { * Configures all publications. The publications must already exist. */ @Suppress("TOO_LONG_FUNCTION") -private fun Project.configurePublications() { +fun Project.configurePublications() { if (this == rootProject) { return } diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/VersioningConfiguration.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/VersioningConfiguration.kt index 04bc814484..72ddc7c113 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/VersioningConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/VersioningConfiguration.kt @@ -5,6 +5,7 @@ package com.saveourtool.diktat.buildutils import org.ajoberstar.reckon.core.Scope +import org.ajoberstar.reckon.core.VersionTagParser import org.ajoberstar.reckon.gradle.ReckonExtension import org.ajoberstar.reckon.gradle.ReckonPlugin import org.eclipse.jgit.api.Git @@ -23,7 +24,7 @@ fun Project.configureVersioning() { // should be provided in the gradle.properties configure<ReckonExtension> { setDefaultInferredScope(Scope.MINOR.name) - snapshots() + stages("rc", "final") setScopeCalc(calcScopeFromProp()) setStageCalc(calcStageFromProp()) } diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/publishing-default-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/publishing-default-configuration.gradle.kts index 92952dc516..47c8e7773a 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/publishing-default-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/publishing-default-configuration.gradle.kts @@ -16,4 +16,5 @@ publishing { } } +configurePublications() configurePublishing()