Support publishing optional dependencies This commit adds support for publishing optional dependencies on Java libraries. For now, this is really limited to Java libraries, but potentially the API can be extended to other types of components.
If doing so, the user can attach an outgoing configuration to a Java published component. This configuration will be considered "optional", in the sense that:
- all its dependencies will be mapped to the runtime scope of Maven components, but using `<optional>true</optional>` - if using Gradle metadata, additional variants will be published alongside the main (`api` and `runtime`) variants of the library.
It is not allowed to publish an optional feature which doesn't declare at least one capability.
Make sure published platforms can be consumed as enforced platforms This commit introduces a similar strategy to what we do with Maven metadata, but for Gradle metadata, in order to force platforms. In fact, it uses the same code path since Gradle metadata also makes use of Maven immutable resolve metadata. The only difference then happens at parse time where we generate synthetic copies of platform variants.