-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: create per-sourceset task plus the default one for files outside of sourcesets #18
Comments
Hi Vladimir, This is a good suggestion. But, as you wrote, there wouldn't be a straight forward way to know the "set of files not included in source sets" without reaching across projects or doing some other gymnastic. We could try to figure out an elegant way to do it but it won't be trivial and will impose constraints. From the top of my head I can think of aggregating the set of files covered by source sets tasks and then using that set as excludes on the "not in source sets". It would mean that the "not in source sets" task would have to wait for all "source set tasks" to be run. There might be other ways. That being said, a plugin that sets up one task per source set could be enough for some users that only want to check the actual sources. This is the first time this need is expressed. But if I understand correctly you got to this idea because of the performance aspect, not because of the pure use case point of view. Performance here is two fold. There's the time it takes to snapshot everything and there's the fact that given all files are in a single bucket the task gets invalidated as soon as one file changes. Making the rat task incremental could also be another way to make its execution faster. I'm not sure this is possible given the current RAT api, maybe it is, I didn't investigate that yet. |
AFAIK, sourceSet is always defined as a set of directories.
Well, recently there was a discussion on cross-project configuration, and it looks like "code analysis" tools need a way to split the files as follows: I have the same use-case in https://github.com/autostyle/autostyle, and my current workaround is a lazy extra in the root project: extra[PROJECT_DIR_MAP] = lazy {
allprojects
.asSequence()
.flatMap { sequenceOf(it.projectDir, it.buildDir) }
.plus(File(rootDir, "buildSrc"))
.plus(File(rootDir, ".gradle"))
.plus(File(rootDir, ".idea"))
.mapTo(TreeSet()) { it.absolutePath + File.separatorChar }
}
I don't think Gradle supports "incremental from build cache" execution mode yet. |
Your idea uses
That's right. |
:) Ah, you've caught me :) |
:)
Yep, publications. But it's quite involved and I would like to take the time to think about / discuss how a solution would look before committing to implementing this. There might be simpler alternatives. A naïve "workaround" could be adding a |
The current approach with a single task is not very build-cache friendly: it has to re-compute all the files no matter what has changed.
What if the plugin generated multiple tasks (e.g. per-source set)?
Note: there are files outside of sourcesets, so there should be a task that verifies them as well. I wonder if there's Gradle out-of-the-box way to create such a task that would verify all files in the root project, yet it won't dig into subproject's files?
Full RAT for Apache Calcite takes ~17sec
Build scan: https://scans.gradle.com/s/mwgkq3a7ozuzm
The text was updated successfully, but these errors were encountered: