Plugin doesn't seem to take account changes to source set after plugin is applied
See original GitHub issueI’m using this plugin like this:
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "org.jmailen.kotlinter"
...
android {
...
sourceSets {
main {
java.srcDirs += "src/main/kotlin"
}
test {
java.srcDirs += "src/test/kotlin"
}
androidTest {
java.srcDirs += "src/androidTest/kotlin"
}
}
}
The problem is kotlinter seems to resolve the source sets and collect the files right away, in the apply step. Changes made later have no effect. I’d like to use “src/group/kotlin” directories since these are pure kotlin projects.
What I’d like to see is the source file discovery deferred until task run time. I think it’d be fine if this plugin still searched for source sets on apply for purpose of creating the tasks, but I think each task should get a list of files from the app at runtime, rather than plugin apply time.
This is a fine plugin all around and I’d like to keep using it. I spent about an hour looking at how to hack a solution in, but it required a decent amount of refactoring and I don’t have the time at the moment. I may pick it up in a few weeks when I have some spare time, but for now I’m leaving this issue open to put it on the radar and perhaps see if someone has a quick fix for it.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
Thanks @jeremymailen, I’ll review and test this in the next couple of days. I’ve got a couple very busy days coming up, but I’ll definitely try to give this the attention it deserves before the weekend.
Thank you for the excellent analysis and suggestions @mikeholler. I appreciate your experience here! If you are interested and have a little spare time now and again, I’d gladly add you as a collaborator on the project.
Your suggestion for how to build it sounds both reasonable and doable. I’m assuming a
SourceSet
property can be marked as@Input
to implement incremental build behavior? As far as modifying the files for an auto-created format or lint task, I had just imagined the use case and haven’t seen it in real life yet. Creating a new custom source set seems fine. Not sure if the “filter some files out” use case exists in the wild.I’ll try to get to it this week or I’ll update here if it’s taking me longer.