-
Notifications
You must be signed in to change notification settings - Fork 53
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
fix: Getting tasks for Gradle < 5.0 #1619
base: develop
Are you sure you want to change the base?
Conversation
Thank you for your contribution, will review it recently. |
@@ -63,13 +63,20 @@ public boolean canBuild(String modelName) { | |||
} | |||
|
|||
public Object buildAll(String modelName, Project project) { | |||
int majorVersion = Integer.parseInt(project.getGradle().getGradleVersion().split("\\.")[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the value of project.getGradle().getGradleVersion()
same as GradleVersion.current()
?
If not, I think we can use
GradleVersion.version(project.getGradle().getGradleVersion())
to do the comparison
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, it makes more sense this way
subModels, tasks, node, plugins, closures, scriptClasspaths); | ||
} | ||
|
||
private List<GradleTask> getGradleTasks(Project rootProject, Project project) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Addressing #1331.
DefaultGradleProject
was introduced to the API only in Gradle 5.0, so it does not support older versions. This implementation includes both ways for retrieving tasks