diff --git a/docs/src/docs/asciidoc/index.adoc b/docs/src/docs/asciidoc/index.adoc index 39ea81ccd..f32e4ca31 100644 --- a/docs/src/docs/asciidoc/index.adoc +++ b/docs/src/docs/asciidoc/index.adoc @@ -24,6 +24,10 @@ If you are using alternative build systems, see < // Register Native Image tasks TaskContainer tasks = project.getTasks(); - JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class); + JavaPluginExtension javaConvention = project.getExtensions().getByType(JavaPluginExtension.class); configureAutomaticTaskCreation(project, graalExtension, tasks, javaConvention.getSourceSets()); TaskProvider imageBuilder = tasks.named(NATIVE_COMPILE_TASK_NAME, BuildNativeImageTask.class); @@ -624,8 +624,7 @@ public void registerTestBinary(Project project, // Testing part begins here. ------------------------------------------- - // In future Gradle releases this becomes a proper DirectoryProperty - File testResultsDir = GradleUtils.getJavaPluginConvention(project).getTestResultsDir(); + DirectoryProperty testResultsDir = GradleUtils.getJavaPluginConvention(project).getTestResultsDir(); DirectoryProperty testListDirectory = project.getObjects().directoryProperty(); // Add DSL extension for testing @@ -633,7 +632,7 @@ public void registerTestBinary(Project project, TaskProvider testTask = config.validate().getTestTask(); testTask.configure(test -> { - File testList = new File(testResultsDir, test.getName() + "/testlist"); + var testList = testResultsDir.dir(test.getName() + "/testlist"); testListDirectory.set(testList); test.getOutputs().dir(testList); // Set system property read by the UniqueIdTrackingListener. diff --git a/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/internal/GradleUtils.java b/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/internal/GradleUtils.java index d60c72578..6d998da56 100644 --- a/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/internal/GradleUtils.java +++ b/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/internal/GradleUtils.java @@ -47,7 +47,7 @@ import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.FileCollection; import org.gradle.api.plugins.JavaPlugin; -import org.gradle.api.plugins.JavaPluginConvention; +import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSetContainer; import org.gradle.util.GradleVersion; @@ -64,8 +64,8 @@ public static SourceSet findSourceSet(Project project, String sourceSetName) { return sourceSetContainer.findByName(sourceSetName); } - public static JavaPluginConvention getJavaPluginConvention(Project project) { - return project.getConvention().getPlugin(JavaPluginConvention.class); + public static JavaPluginExtension getJavaPluginConvention(Project project) { + return project.getExtensions().getByType(JavaPluginExtension.class); }