-
Notifications
You must be signed in to change notification settings - Fork 166
Description
New feature, improvement proposal
We have a large multi-module build with quite a number of built-in and extra enforcer rules enabled. For modules with many dependencies, plugin execution takes several seconds, adding up to hundreds of seconds over-all. Based on some profiling, most time is spent repeatedly collecting dependency information:

I had a brief look at the code, and besides full rule caching it appears that dependency resolution isn't cached. Would it be possible to add this, such that distinct rules applied to the same module can reuse invariant dependency information?
I suppose that the changes in #930 could be extended to support more fine-grained caching (AbstractResolveDependencies#collectProjectDependencies()
would be an easy candidate), but SessionData
's documentation explicitly states:
Unlike a cache, this session data is not subject to purging. For this same reason, session data should also not be abused as a cache (i.e. for storing values that can be re-calculated) to avoid memory exhaustion.
There's also EnforcerRuleHelper#getCache(String key, Supplier<?> producer)
, but EnforcerRuleHelper
is deprecated.
I can't promise to have time in the near feature to help implement any improvement in this area, but if one were to attempt this, what would be the recommended approach?