diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d852aac1..1c105f4ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - fix "additionalEditorconfig not supported until ktlint 0.49" warning [#712](https://github.com/JLLeitschuh/ktlint-gradle/pull/712) - update latest version text file manually [#709](https://github.com/JLLeitschuh/ktlint-gradle/pull/709) - Improve error logging [#711](https://github.com/JLLeitschuh/ktlint-gradle/pull/711) +- Fixed a case, when -on Windows- an exclude filter is ignored [#715](https://github.com/JLLeitschuh/ktlint-gradle/pull/715) ## [11.6.0] - 2023-09-18 diff --git a/plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/KtlintPluginTest.kt b/plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/KtlintPluginTest.kt index 1ff5f3ff3..c7963c525 100644 --- a/plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/KtlintPluginTest.kt +++ b/plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/KtlintPluginTest.kt @@ -196,6 +196,37 @@ class KtlintPluginTest : AbstractPluginTest() { } } + @DisplayName("Should ignore excluded sources which are generated during build") + @CommonTest + fun ignoreExcludedSourcesGeneratedByBuild(gradleVersion: GradleVersion) { + project(gradleVersion) { + withCleanSources() + + //language=Groovy + buildGradle.appendText( + """ + ktlint.filter { exclude { it.file.path.contains("Failing") } } + + task createExtraFile() { + def rootDir = project.getRootDir().toString() + def fileDir = rootDir + "/src/main/kotlin" + def fileName = "FailingSource.kt" + doLast { + file(fileDir).mkdirs() + file(fileDir + "/" + fileName) << "val foo = \"bar\"\n" + } + } + + $CHECK_PARENT_TASK_NAME.dependsOn createExtraFile + """.trimIndent() + ) + + build(CHECK_PARENT_TASK_NAME) { + assertThat(task(":$mainSourceSetCheckTaskName")?.outcome).isEqualTo(TaskOutcome.SUCCESS) + } + } + } + @DisplayName("Should fail on additional source set directories files style violation") @CommonTest fun additionalSourceSetsViolations(gradleVersion: GradleVersion) {