Improve error reporting in case no matching dynamic version is foundThis commit improves rendering of errors in case resolution fails becauseall versions in a dynamic range are evicted, and that at least one of theevicted versions was evicted because of attribute matching. The error willnow report the attributes on each tested version, as well as the requestedattributes.For this, the module not found exception has been updated to carry morecontext, and now makes use of the tree formatter for consistency with otherexceptions in the codebase.
Make `ModuleComponentSelector` the source of truth for version constraintsThis commit pushes `VersionConstraint` as a primary concept in `ModuleComponentSelector`. It replaces the (now)deprecated `getVersion` call, which didn't reflect all possible constraints on a version. This change has severalconsequences:- version constraints now need to be "serializable"- version constraints now consist of a preferred version and a list of rejected versions- only a single item in the rejection list is supported- Gradle module metadata parsing now generates a prefer/reject list- Gradle module metadata writing does **not** yet support writing prefer/reject- the module metadata binary format has been bumped to support prefer/reject in module descriptors- metadata rules can say `useTarget(VersionConstraint)`Issue #3312
Use component id rather than module version id in the 'required by' paths in resolve exceptions. This provides a better description for local components, and also allows for components that don't have a module version id.
Added more detail to the 'could not find any matches for selector' error message, to distinguish between:1. No versions were found.2. Some candidate versions were found but none matched the selector (and what those versions were).3. Some matching versions were found by all were rejected by component selection rules (and what those versions were).Changed ModuleVersionResolveException constructor so that it does not pass the provided message through String.format().