nebula-plugins / gradle-resolution-rules-plugin

Gradle plugin for providing reusable dependency resolution rules.
Apache License 2.0
45 stars 16 forks source link

SubstituteRule: introduce memoize for version selectors #120

Closed rpalcolea closed 4 years ago

rpalcolea commented 4 years ago

I don't think Kotlin has a memoize support out of the box and also didn't want to introduce a cache library so created my version of it using a map.

Here is how it looks like Screen Shot 2020-06-17 at 7 13 05 PM Screen Shot 2020-06-17 at 7 13 11 PM

If you look at SubstituteRulesWithMemoizeSpec, we have two rule sets which substitute dependencies with version 19.0-rc2

Looking at the screenshots, if you look at the versionSelector (ExactVersionSelector), it has uses the same object across rules.

The old approach would look like this

Screen Shot 2020-06-17 at 7 17 07 PM

Screen Shot 2020-06-17 at 7 17 12 PM