Open tresat opened 1 month ago
@autonomousapps
There are deeper questions about how we model this in the JVM plugins so that plugins can replace/change/hide variants available internally and externally (publishing and local projects).
We're not going to do anything for this in 8.x.
We should investigate how the IDE is getting confused and if there are other alternatives so it does not suggest the wrong answer.
@jjohannes may have some insights here.
When using the shadow plugin, we sometimes want to avoid publishing the default
apiElements
andruntimeElements
variants. This is currently possible withconfigurations["apiElements"]) { skip() }
. However, this does not prevent those variants from being available locally, which can confuse the IDE and lead to a poor UX.One way to avoid this is by setting these variants' configurations as
isCanBeConsumed = false
, however this behavior is deprecated (configurations should be role-locked).Another way is to intentionally mangle the attributes present on these variants, so they are not discoverable. This works, but fails to model the intent in our DSL and so is a poor solution.
It would be better to have a way to either remove variants completely, or have an API to mark them as replaced by another preferred variant. Then the details of doing this (including the
skip()
call) can be left as implementation details.See thread here: https://gradle.slack.com/archives/C01D0BR067J/p1738091816963369 and issue here: https://github.com/autonomousapps/dependency-analysis-gradle-plugin/pull/1367.