Incomplete reason explanation on multi capabilities#1170
Merged
autonomousapps merged 1 commit intoautonomousapps:mainfrom May 7, 2024
seregamorph:reason-multi-dependencies
Merged
Incomplete reason explanation on multi capabilities#1170autonomousapps merged 1 commit intoautonomousapps:mainfrom seregamorph:reason-multi-dependencies
autonomousapps merged 1 commit intoautonomousapps:mainfrom
seregamorph:reason-multi-dependencies
Conversation
jjohannes
approved these changes
May 3, 2024
Collaborator
jjohannes
left a comment
There was a problem hiding this comment.
These changes look very reasonable to me. Good find!
Adding some test for this would be great! (But since there has been no test coverage before and all current tests are still passing, this could be done in a follow up I think.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 :moduleexplanation 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. ThedependencyUsagesobject is valid before serialization, but the stored object is first wrapped viatoStringCoordinatescall and there is a problem:Each calculated via
toCoordinatesKeyrepeated 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
toStringCoordinatesis not enough as there is the second place where the reason explanation blocks are squashed as well. There is a sorting methodwhich calls
toSortedSetand it usesTreeSetunder the hood. The problem is that even if there areUsageelements which are non-equal viaequals, they are squashed ifcompareTo()==0from sorting comparator. So it should be addressed too.Before and after
The sample difference of
reasontask 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: xis repeated, e.g.Source: x (via module-dependency-test-fixtures)specifying the according capabilities.