From 9baf4f48198741af956f5afad8115f824e37d5b9 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Fri, 25 Nov 2022 14:06:05 +0300 Subject: [PATCH 1/4] Enabled functionalTest in gradle plugin ### What's done: * added call for functionTest in gradle plugin --- diktat-gradle-plugin/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/diktat-gradle-plugin/pom.xml b/diktat-gradle-plugin/pom.xml index c94b96f9b5..0a23744efb 100644 --- a/diktat-gradle-plugin/pom.xml +++ b/diktat-gradle-plugin/pom.xml @@ -72,6 +72,7 @@ clean test + functionalTest -Pgroup=${project.groupId} -Pversion=${project.version} -Pdescription=${project.description} From 47ccbc0ffa66a69403d7490b9a35ec01e48b0007 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Fri, 25 Nov 2022 15:18:07 +0300 Subject: [PATCH 2/4] downgraded version of mu-logging --- diktat-test-framework/pom.xml | 4 ++-- pom.xml | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/diktat-test-framework/pom.xml b/diktat-test-framework/pom.xml index df6e8c8a0e..4ba068f3a2 100644 --- a/diktat-test-framework/pom.xml +++ b/diktat-test-framework/pom.xml @@ -31,8 +31,8 @@ commons-io - org.apache.logging.log4j - log4j-slf4j-impl + io.github.microutils + kotlin-logging-jvm io.github.petertrr diff --git a/pom.xml b/pom.xml index 68ebbbb84d..a9aa4b15a2 100644 --- a/pom.xml +++ b/pom.xml @@ -59,8 +59,8 @@ 0.8.8 3.6.4 1.24 - 3.0.4 - 2.19.0 + + 2.1.23 @@ -198,11 +198,6 @@ kotlin-logging-jvm ${mu-logging.version} - - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j.version} - io.github.petertrr kotlin-multiplatform-diff-jvm From e661fe0eadc1d9b5454b0ea26d845944f7b9f3b3 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Fri, 25 Nov 2022 15:49:31 +0300 Subject: [PATCH 3/4] reused util method to check diktat run --- ...DiktatGradlePluginMultiprojectFunctionalTest.kt | 14 +------------- .../kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt | 14 ++++++++++---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/DiktatGradlePluginMultiprojectFunctionalTest.kt b/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/DiktatGradlePluginMultiprojectFunctionalTest.kt index 1d40218b0a..610bbf1ed5 100644 --- a/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/DiktatGradlePluginMultiprojectFunctionalTest.kt +++ b/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/DiktatGradlePluginMultiprojectFunctionalTest.kt @@ -1,11 +1,9 @@ package org.cqfn.diktat.plugin.gradle -import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin.Companion.DIKTAT_CHECK_TASK import org.gradle.buildinit.plugins.internal.modifiers.BuildInitDsl import org.gradle.internal.impldep.org.junit.rules.TemporaryFolder import org.gradle.testkit.runner.TaskOutcome import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import java.io.File @@ -30,18 +28,8 @@ class DiktatGradlePluginMultiprojectFunctionalTest { @Test fun `should execute diktatCheck on default values in multiproject build`() { val result = runDiktat(testProjectDir, shouldSucceed = false) - - val diktatCheckRootResult = result.task(":$DIKTAT_CHECK_TASK") - requireNotNull(diktatCheckRootResult) - Assertions.assertEquals(TaskOutcome.NO_SOURCE, diktatCheckRootResult.outcome) { + assertDiktatExecuted(result, TaskOutcome.NO_SOURCE) { "Task for root project with empty sources should succeed" } - - val diktatCheckBackendResult = result.task(":backend:$DIKTAT_CHECK_TASK") - requireNotNull(diktatCheckBackendResult) - Assertions.assertEquals(TaskOutcome.FAILED, diktatCheckBackendResult.outcome) - Assertions.assertTrue( - result.output.contains("org.cqfn.diktat.example.gradle.multiproject") - ) } } diff --git a/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt b/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt index 4a0d552e28..1a973dc9ee 100644 --- a/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt +++ b/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt @@ -24,7 +24,7 @@ internal fun createExampleProject(testProjectDir: TemporaryFolder, plugins { id("org.cqfn.diktat.diktat-gradle-plugin") } - + repositories { mavenLocal() mavenCentral() @@ -75,11 +75,17 @@ private fun GradleRunner.withJaCoCo(number: Int) = apply { } } -fun assertDiktatExecuted(result: BuildResult) { +fun assertDiktatExecuted( + result: BuildResult, + taskOutcome: TaskOutcome = TaskOutcome.FAILED, + errorMessage: () -> String? = { null } +) { val diktatCheckBuildResult = result.task(":${DiktatGradlePlugin.DIKTAT_CHECK_TASK}") requireNotNull(diktatCheckBuildResult) - Assertions.assertEquals(TaskOutcome.FAILED, diktatCheckBuildResult.outcome) + Assertions.assertEquals(taskOutcome, diktatCheckBuildResult.outcome, errorMessage) Assertions.assertTrue( result.output.contains("[FILE_NAME_MATCH_CLASS]") - ) + ) { + "Task ${DiktatGradlePlugin.DIKTAT_CHECK_TASK} wasn't run" + } } From 9a7c8f7ee99c7c4a26c1c2e86ead6199f13f1beb Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Fri, 25 Nov 2022 16:37:42 +0300 Subject: [PATCH 4/4] block version of mu logging --- renovate.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/renovate.json b/renovate.json index 86a4aacb6f..fd4a1471b5 100644 --- a/renovate.json +++ b/renovate.json @@ -49,6 +49,13 @@ ], "allowedVersions": "<= 1.6.8 || > 1.6.13" }, + { + "managers": ["maven"], + "matchPackageNames": [ + "io.github.microutils:kotlin-logging-jvm" + ], + "allowedVersions": "<= 2.1.23" + }, { "managers": ["gradle"], "matchPackagePatterns": [