Skip to content
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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

MrRetroChannel
Copy link

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

@jdneo
Copy link
Member

jdneo commented Nov 6, 2024

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]);
Copy link
Member

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

Copy link
Author

@MrRetroChannel MrRetroChannel Nov 9, 2024

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) {
Copy link
Member

@jdneo jdneo Nov 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants