This message was deleted.
# community-support
s
This message was deleted.
j
Adding a module shouldn’t run any task
n
The cache key changes (it seems).
j
only the tasks that are attached using the idea plugin, if you see test tasks running, some plugin is doing weird things
n
I am talking about CI
in CI we run
./gradlew build
And we rely on gradle enterprise for caching
If you add a new module then all modules will be recompiled and all tests will be re-run
j
Ah okay, you missed the CI + cache part on the OP. I haven’t used gradle enterprise so I don’t know how it caches
n
It caches the same as Gradle local, but it is remote.
c
it sounds weird, because that is not concept of gradle. if the new module is not a dependency of existing module, why should existing modules rebuilt?
v
Because the classpath changes by having a change in the settings script. So yes, if you do dynamic recognition, or even if you have a txt file with the projects to include that you read from the settings script should probably have the desired effect.
n
Putting asside the caching issue. It is 1 extra step that we need to do every time we add a module. If we made
settings.gradle.kts
dynamic it will mean we have to write less code to add a new module. The question is the file traversal going to be an expensive price to pay?
j
that is a really bad default behavior...
I am doing that and there are settings plugins that do that too, I guess it depends a lot on the project size
n
Can you point me to a settings plugin that does that?
v
Depending on how deeply nested your projects are and how you do the traversal it will probably not be that expense, if you for example only look one directory level deep
that is a really bad default behavior...
Not really, if classpath changes, you don't know what exactly changed
n
Unfortunately we need to look several directories deep. I guess I will have to give it smarts when traversing to make it as efficient as possible.
j
@Vampire I think there should be an alternative to add modules without changing the settings script as default behavior based on this problem
v
Unfortunately we need to look several directories deep. I guess I will have to give it smarts when traversing to make it as efficient as possible.
Or as I said, just have the list in a separate file and not in the setting script code, so that the classpath does not change just because you add a module
n
The text file solves incremental build problem, but doesn’t solve boilerplate around adding new module problem. I will try the traversal approach and see how much overhead (if any it adds).
👌 1
I am curious why nobody from gradle has written a blog post about this. Seems like a common problem.
v
@Vampire I think there should be an alternative to add modules without changing the settings script as default behavior based on this problem
That's not trivial, a project does not even have to have an own build script to be a valid project, even though it is bad practice. And traversing the whole tree might be the wrong thing to do as you could also have nested builds using composite builds that should not be included as subprojects and so on. And if you want that behavior, it is trivial to do such a traversal or put the projects to include in a separate file that you read from the settings script
I am curious why nobody from gradle has written a blog post about this. Seems like a common problem.
Personally, I don't think it is such a common problem, as the modules that are part of a build usually do not change that often in a typical build.
j
Yeah but I am not talking about an auto include feature. But a text like file to add modules and Gradle can read, for example a toml file based on they are using it for version catalogs
v
Feel free to add a feature request for it 🙂 Besides that it could also be trivially solved as a 3rd party plugin probably.
j
In Square they are adding tons of modules continuously, I would like to know what they are doing about this issue, cc @tony
n
We have between 100-200 modules and and using the auto-import plugin doesn’t seem to add significant overhead.
thanks everyone
👌 1
c
ok, so reason is because of auto-import plugin. We have about 400 modules and we add all of them manually :D