Incomplete reason explanation on multi capabilities #1170
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If there is more than one dependency per sourceSet to the same module, but with different capabilities (like default one vs
testFixtures
), thereason --id :module
explanation is incomplete. It shows only a single explanation of possible routes to dependency instead of all.Root cause analysis: problem with ComputeAdviceTask toStringCoordinates
The problem is in
ComputeAdviceTask:206
. ThedependencyUsages
object is valid before serialization, but the stored object is first wrapped viatoStringCoordinates
call and there is a problem:Each calculated via
toCoordinatesKey
repeated key is simply lost in favor of the last one which just rewrites the map.Root cause analysis: problem with ReasonTask getUsageFor
The fix of
toStringCoordinates
is not enough as there is the second place where the reason explanation blocks are squashed as well. There is a sorting methodwhich calls
toSortedSet
and it usesTreeSet
under the hood. The problem is that even if there areUsage
elements which are non-equal viaequals
, they are squashed ifcompareTo()==0
from sorting comparator. So it should be addressed too.Before and after
The sample difference of
reason
task explanations before the fix:vs after
Further plan
Once we agree on how to approach the issue I'd like to implement a functional test covering it. Existing functional tests seem to be fine.
Also it makes sense to enhance the output reason task explanation in case if
Source: x
is repeated, e.g.Source: x (via module-dependency-test-fixtures)
specifying the according capabilities.