gradle icon indicating copy to clipboard operation
gradle copied to clipboard

Fix attribute bug for component metadata rules

Open jvandort opened this issue 3 years ago • 4 comments

Previously, any action which modifies the result of getAttributes from the action passed into 'withVariant' or 'allVariants', or any of the other methods in 'ComponentMetadataDetailsAdapter' which delegate to those methods, would always modify the attributes of all variants, regardless of whether a specific variant was specified. This is fixed by ensuring the result of 'getAttributes()' returns a unique mutable attribute container for any individual variant whose parent is the component's attributes.

Along the way, implements a 'ImmutableAttributesFactory#join' method which joins two attribute containers in a parent-child relationship where any updates in the parent or child are reflected in the joined container. This implementation was based on the parent functionality already implemented for 'DefaultMutableAttributeContainer'.

Also added '@Deprecated' annotations to 'ImmutableAttributes' to give immediate feedback to developers using these classes that these instances cannot be mutated. This is similar to how Guava immutable types handle an immutable implementation of a mutable interface.

  • [ ] Write Tests

jvandort avatar Sep 20 '22 05:09 jvandort

@bot-graddle test this

jvandort avatar Sep 26 '22 04:09 jvandort

@bot-gradle test this

jvandort avatar Sep 26 '22 14:09 jvandort

OK, I've already triggered the following builds for you:

bot-gradle avatar Sep 26 '22 14:09 bot-gradle

@bot-gradle test and merge

jvandort avatar Sep 27 '22 04:09 jvandort

OK, I've already triggered a build for you.

bot-gradle avatar Sep 27 '22 04:09 bot-gradle