fix: Getting tasks for Gradle < 5.0#1619
fix: Getting tasks for Gradle < 5.0#1619MrRetroChannel wants to merge 2 commits intomicrosoft:developfrom
Conversation
|
Thank you for your contribution, will review it recently. |
| subModels, tasks, node, plugins, closures, scriptClasspaths); | ||
| } | ||
|
|
||
| private List<GradleTask> getGradleTasks(Project rootProject, Project project) { |
There was a problem hiding this comment.
Can we just directly fetch the tasks with this approach no matter the project's gradle version is > or < 5? Since they look very similar.
// The original code is not implemented by me so I'm not aware of the history of it.
There was a problem hiding this comment.
Sorry for long response, as far as I understand plugin's local gradle project model does not support some lazy tasks, so this commit was made as fix #1302 in which now plugin uses gradle built in model. I couldn't reproduce this bug though so I can try to unify these methods to be compatible with everything, but it surely will need more testing
There was a problem hiding this comment.
I think this PR is still relevant for users on Gradle 4.x.
I’m also running into what appears to be this same issue with a Gradle 4.10.3 project.
From the discussion (and to my understanding), it sounds like #1302 moved task discovery toward Gradle's built-in model to avoid lazy task/configuration-resolution issues like #1275. That makes sense for newer Gradle versions.
The problem is that Gradle 4.10.3 does not appear to support the same DefaultGradleProject API path, so the extension can fail task discovery for legacy projects even though ./gradlew tasks --all works from the terminal.
My environment:
- OS: Windows 11
- VS Code: 1.117.0
- vscode-gradle: 3.7.13
- Gradle wrapper: 4.10.3
- Java: Temurin/OpenJDK 8
Any leads would be greatly appreciated.
Thank you!
Addressing #1331.
DefaultGradleProjectwas introduced to the API only in Gradle 5.0, so it does not support older versions. This implementation includes both ways for retrieving tasks