-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Isolated Projects #380
Comments
A couple of options come to mind:
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 I'll test a local project with a call to |
How did you get on with this, @michaelbull? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
+1 for this feature request. In general, the CONFIGURING stage of Gradle can be quite long for projects that have hundreds of modules, so this new Isolated Projects feature looks promising. Regarding the violations of current plugin implementation I see there are some comments already in the thread. AFAIK it's okay to iterate other projects, but there are methods that cannot be called, e.g. I made some research on possible approaches. WDYT changing this private boolean isDirectDependency(ModuleVersionSelector selector) {
if (this.directDependencies == null) {
Set<String> directDependencies = new HashSet<>();
for (Dependency dependency : this.configuration.getAllDependencies()) {
directDependencies.add(dependency.getGroup() + ":" + dependency.getName());
}
this.directDependencies = directDependencies;
}
return this.directDependencies.contains(getId(selector));
} to this import org.gradle.api.artifacts.ExternalDependency;
...
private boolean isDirectExternalDependency(ModuleVersionSelector selector) {
if (this.directDependencies == null) {
Set<String> directDependencies = new HashSet<>();
for (Dependency dependency : this.configuration.getAllDependencies()) {
if (dependency instanceof ExternalDependency) {
directDependencies.add(dependency.getGroup() + ":" + dependency.getName());
}
}
this.directDependencies = directDependencies;
}
return this.directDependencies.contains(getId(selector));
} AFAIK it's possible to access other module of the same project by |
Iterating over projects and getting their name is not a violation of Isolated Projects constraints. Only accessing the Because of this |
I think only considering One example is detecting local projects as described in this issue's opening description. Unfortunately, using Another problem is a violation that's reported when calling |
@alllex is it possible to consider guarantee in Gradle initialization cycle that parent project is configured before current project (I can submit a Gradle project feature request if needed) with Isolated Projects enabled? |
The changes in this branch should address all of this plugin's violations, at least in @seregamorph's sample project. However, they come at the cost of some changes in behaviour when project isolation is enabled as property resolution is different and detection of local projects is disabled. As such, I'm reluctant to merge them as those differences are likely to cause confusion and increase the support burden. Instead, I see them as away to highlight where alternative approaches in this plugin or improvements in Gradle are needed. |
I checked out the commit and built locally via
It's much better than it was and I really appreciate the fix is ready that fast. |
If you look at the report, I think you’ll see that the remaining problems are caused by Spring Boot’s plugin, not this one. |
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.
The text was updated successfully, but these errors were encountered: