support ktlint-plugins.properties for ktlint version#1034
Conversation
8e59337 to
a40c5d6
Compare
| filterTargetApplier, | ||
| kotlinScriptAdditionalPathApplier | ||
| ) | ||
| val kotlinPluginsPropertiesFile = target.layout.projectDirectory.file(KTLINT_PLUGINS_PROPERTIES_FILE_NAME) |
There was a problem hiding this comment.
This won't track the file as an input. If the ktlint-plugins.properties file changes, the task won't be rerun. This can result in confusing/unintuitive behavior for the user
I know the copliot PR is sloppy, but there are test cases in there that we should also verify we pass here as well
There was a problem hiding this comment.
I think it does do this, since it is piped through target.providers.fileContents but ill include test cases to prove it
There was a problem hiding this comment.
I don't think it will if it's not marked explicitly as an @Input, but I could be wrong
There was a problem hiding this comment.
Input is for task-level caching (build cache). in my PR, we are setting the existing property on the extension, which is bound to the existing task Input field.
this is happening at configuration time, so when reading the file at configuration time (not within a task) it needs to be configuration cache compatible. @Input does not help at all here. for this, we need gradle.providers which allows configuration cache safe access to files, gradle properties, environment variables, and system properties
There was a problem hiding this comment.
My understanding is that @Input or @InputFile is also used for task up-to-date checking as well
There was a problem hiding this comment.
It is. but the configuration file is not an input to the task. it is an input to the plugin code that configures the dependencies.
There was a problem hiding this comment.
I updated the test to show that up to date checks work properly
There was a problem hiding this comment.
I also added some assertions that show that configuration cache is not violated
7e8ffbb to
e53016b
Compare
e53016b to
3c9887b
Compare
| implementation(libs.jgit) | ||
| implementation(libs.commons.io) | ||
|
|
||
| testImplementation(libs.assertj.core) |
There was a problem hiding this comment.
Can we drop the dependency on assertj and replace it all with nebula-test?
support ktlint-plugins.properties for version coordination with intellij plugin