Simplify `DynamicVersionResolver` This commit merges `RepositoryResolveState` with `ComponentSelectionContext`. This makes the code easier to read, by avoiding incomprehensible back references. Unit tests are also clearer since they now clearly show which versions were tested, rejected and not found.
Changed the way that the target configuration for a project dependency is calculated, to always select only from the configurations of the target project that have attributes attached, regardless of whether the consumer has defined any attributes or not. Fall back to `default` only when the target project has no configurations with attributes defined. This introduces a breaking change when consuming the output of a project with the Java plugin applied from a project that does not have the Java plugin applied. Previously, the `default` configuration would be selected, now the `runtimeElements` configuration is selected. However, this is consistent with the case where the consuming project is also using the Java plugin or is using the Android plugin. It also means that custom configurations in these projects will select the same thing as the runtime classpath configuration.