gradle
gradle copied to clipboard
Move stateful logic from local metadata to state
Prior changes have attempted to add a distinction between immutable component metadata and mutable component state. Currently, the component metadata is mutable, and calling methods on it may cause user code to run. The metadata caches its computed values. The state which calls those metadata methods transforms the metadata's computed values and then also caches its transformations.
This double layer of caching makes it very difficult to properly handle project lock synchronization. This change consolidates the logic of computing variants and configurations into the component state. All stateful logic from the component metadata has been moved into the component state, and the component metadata type is now fully immutable.
The most significant change here is that a ComponentGraphResolveMetadata instance no longer has methods to expose
the component's variants or configrations. For local components, this logic is now completely handled by the component
state. For external components, the metadata still has the responsibility of computing variants and configurations. So,
a new interface for external metadata has been introduced to expose this functionality, ExternalComponentGraphResolveMetadata.
Note that this commit does not actually solve the project locking issues present in the code. Its sole purpose is to collapse the double-caching layers into a single class, so that the project locking can be handled much more easily in a separate change.
Reviewing cheatsheet
Before merging the PR, comments starting with
- ❌ ❓must be fixed
- 🤔 💅 should be fixed
- 💭 may be fixed
- 🎉 celebrate happy things
@bot-gradle test apt
I've triggered the following builds for you. Click here to see all build failures.
@bot-gradle test this
I've triggered the following builds for you. Click here to see all build failures.