gradle / gradle-native

The home of Gradle's support for natively compiled languages
https://blog.gradle.org/introducing-the-new-cpp-plugins
Apache License 2.0
92 stars 8 forks source link

Removed artifacts should be removed from `DefaultArtifactPublicationSet` #845

Closed ghale closed 6 years ago

ghale commented 6 years ago

Prior to the changes we made to make DefaultArtifactPublicationSet lazy, if an artifact was added, it immediately went into the archives configuration. This meant that if the artifact was then later removed from the archives configuration, it would also be removed from DefaultArtifactPublicationSet. Now that this is a lazy provider, if the artifact is removed before the provider is realized, it won't get removed from DefaultArtifactPublicationSet, causing it to show up in archives again when it's realized.

ghale commented 6 years ago

@big-guy and I spoke about this and the fundamental question here is should an unrealized Provider that provides a certain value respond if the realized value is removed from the container before the provider is realized? At least for now, I think the answer is no. DefaultArtifactPublicationSet is a special case where the provider is kind of transparent to the user, but doesn't really reflect "normal" usage of a provider in a container like this. And, this construct will eventually be deprecated once the publishing plugins are stabilized.

Given this, we've just worked around the issue in the Gradle build where this was a problem. I don't think there's further work to be done here unless we come up with a solid use case demonstrating a need for different behavior here.