Open michaelbull opened 3 months ago
A couple of options come to mind:
Settings#getRootProject
and ProjectDescriptor#getChildren
to figure out the names of all of the projects.Assuming that it works, one is probably preferable.
With regards to option 2, I think we can still have it analysing local projects, but only those ones that are subprojects of the project the plugin is applied to. According to the build logic constraints, we can still safely call Project.getAllprojects
, which returns "the set containing this project and its subprojects". This does however result in different behaviour for projects that are siblings of the one you've applied the plugin to, vs ones that are children (the siblings aren't checked, the children are).
I'll test a local project with a call to getRootProject
and see if it complains.
Gradle has introduced the isolated projects feature that is currently in pre-alpha.
Enabling this pre-alpha feature with the
io.spring.dependency-management
plugin applied reports the following problems:The stacktrace points towards the
VersionConfiguringAction
.This code ends up only being used by this method:
It seems like it is collecting all dependency names by asking the root project for all subproject names and then comparing their names to ensure that the plugin does not apply to local subproject dependency resolution. Collecting all the names via the root project is breaking the principal of project isolation.
I wonder if there is a simpler way to determine whether the plugin is a local project dependency, to accordingly ignore it when applying a controlled version? To comply with the project isolation feature, the plugin fundamentally cannot break out of the subproject it's applied to and query the root project for its subprojects, however this may not be feasible with the design of the plugin.
Let me know if you have any ideas and I'd be happy to help make the changes necessary to support the feature.