Support usage in projects using Gradle 8.10 by avoiding using Project.equals #257
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.
I can't find anything in the Gradle 8.10 release notes or issue tracker, but we've found that the affected module detector (both versions 0.3.1 and 0.3.0) stops working on Gradle 8.10.
Using 0.3.1 we are seeing that no tasks will run and AMD always sees that no modules have changed. I downgraded our integration to 0.3.0 to obtain logs and work around #205, and saw that AMD is correctly identifying all the changed modules, but when it goes to identify whether those changed modules should be included in the build, it always returns
false
for every module.I suspected that the cause was the use of
Set<Project>
and subsequent usage ofSet.contains(Project)
, which would rely on theProject
intrinsicequals
implementation. NeitherProject
norDefaultProject
implementequals
, and it seems like separateProject
instances are getting created now in Gradle 8.10 (I'm not sure why). As a result, the defaultequals
implementation is returningfalse
when checking equivalent projects. I added this repository as an included build and updated the usage ofSet<Project>
toMap<String, Project>
whereString
was the project path, and AMD worked as expected.This MR updates the usage of
Set<Project>
toMap<ProjectPath, Project>
whereProjectPath
is a value class that wraps the path. It updates the tests to expectMap<ProjectPath, Project>
instead ofSet<Project>
, but it does not update the Gradle version. Note: I didn't update the Gradle version so that we don't potentially lock out consumers on older Gradle versions from using AMD.I can work on a repro project containing both Gradle 8.9 and 8.10, if needed, to demonstrate the issue.