Skip to content

Commit

Permalink
fix: Limit minimal Gradle version to get plugin closure(#1239)
Browse files Browse the repository at this point in the history
  • Loading branch information
CsCherrYY committed Jun 30, 2022
1 parent 377b83c commit f02192d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@
import org.gradle.api.tasks.testing.Test;
import org.gradle.internal.classpath.ClassPath;
import org.gradle.tooling.provider.model.ToolingModelBuilder;
import org.gradle.util.GradleVersion;

public class GradleProjectModelBuilder implements ToolingModelBuilder {

private static String MINIMAL_SUPPORTED_PLUGIN_CLOSURE_VERSION = "5.0";

private Set<GradleTask> cachedTasks = new HashSet<>();

public boolean canBuild(String modelName) {
Expand Down Expand Up @@ -161,6 +164,10 @@ private List<String> getPlugins(Project project) {
}

private List<GradleClosure> getPluginClosures(Project project) {
if (GradleVersion.version(project.getGradle().getGradleVersion())
.compareTo(GradleVersion.version(MINIMAL_SUPPORTED_PLUGIN_CLOSURE_VERSION)) < 0) {
return Collections.emptyList();
}
Convention convention = project.getConvention();
ExtensionsSchema extensionsSchema = convention.getExtensionsSchema();
List<GradleClosure> closures = new ArrayList<>();
Expand Down

0 comments on commit f02192d

Please sign in to comment.