File tree 2 files changed +35
-1
lines changed
main/kotlin/org/jlleitschuh/gradle/ktlint/tasks
test/kotlin/org/jlleitschuh/gradle/ktlint
2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ abstract class BaseKtLintCheckTask @Inject constructor(
55
55
@get:Internal
56
56
internal abstract val additionalEditorconfigFile: RegularFileProperty
57
57
58
- @get:Internal
58
+ @get:Input
59
59
internal abstract val additionalEditorconfig: MapProperty <String , String >
60
60
61
61
@get:Incremental
Original file line number Diff line number Diff line change @@ -147,6 +147,26 @@ class EditorConfigTests : AbstractPluginTest() {
147
147
}
148
148
}
149
149
150
+ @DisplayName(" Check task should rerun if additionalEditorconfig property changes" )
151
+ @CommonTest
152
+ fun checkRerunOnAdditionalEditorconfigPropertyChange (gradleVersion : GradleVersion ) {
153
+ project(gradleVersion) {
154
+ withAdditionalEditorconfigProperty(120 )
155
+ withCleanSources()
156
+
157
+ build(CHECK_PARENT_TASK_NAME ) {
158
+ assertThat(task(" :$lintTaskName " )?.outcome).isEqualTo(TaskOutcome .SUCCESS )
159
+ }
160
+
161
+ withAdditionalEditorconfigProperty(10 )
162
+
163
+ buildAndFail(CHECK_PARENT_TASK_NAME ) {
164
+ assertThat(task(" :$lintTaskName " )?.outcome).isEqualTo(TaskOutcome .SUCCESS )
165
+ assertThat(task(" :$mainSourceSetCheckTaskName " )?.outcome).isEqualTo(TaskOutcome .FAILED )
166
+ }
167
+ }
168
+ }
169
+
150
170
private fun TestProject.createEditorconfigFile (
151
171
maxLineLength : Int = 120,
152
172
filePath : String = ""
@@ -168,4 +188,18 @@ class EditorConfigTests : AbstractPluginTest() {
168
188
}
169
189
createEditorconfigFile(maxLineLength)
170
190
}
191
+
192
+ private fun TestProject.withAdditionalEditorconfigProperty (
193
+ maxLineLength : Int
194
+ ) {
195
+ // language=Groovy
196
+ buildGradle.appendText(
197
+ """
198
+
199
+ ktlint {
200
+ additionalEditorconfig["max_line_length"] = "$maxLineLength "
201
+ }
202
+ """ .trimIndent()
203
+ )
204
+ }
171
205
}
You can’t perform that action at this time.
0 commit comments