Skip to content

Commit

Permalink
Remove deprecated use of getConvention
Browse files Browse the repository at this point in the history
  • Loading branch information
melix committed Oct 11, 2023
1 parent de9ffd9 commit dc3f30b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ If you are using alternative build systems, see <<alternative-build-systems.adoc
* Update JUnit configuration for native testing on GraalVM for JDK 21 with `--strict-image-heap` mode.
* Fix path escaping problem for Windows users

==== Gradle plugin

- Remove use of deprecated `getConvention` APIs

=== Release 0.9.26

* Relax GraalVM version check for dev versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
import org.gradle.api.plugins.JavaApplication;
import org.gradle.api.plugins.JavaLibraryPlugin;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.MapProperty;
import org.gradle.api.provider.Property;
Expand Down Expand Up @@ -259,7 +259,7 @@ private void configureJavaProject(Project project, Provider<NativeImageService>

// 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<BuildNativeImageTask> imageBuilder = tasks.named(NATIVE_COMPILE_TASK_NAME, BuildNativeImageTask.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}


Expand Down

0 comments on commit dc3f30b

Please sign in to comment.