From aacce2a9f747385da9822148611e1240d4977744 Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Tue, 2 Jul 2024 10:29:40 -0400 Subject: [PATCH 1/2] Adds a testing block to jvm software types --- .../api/experimental/java/JavaApplication.java | 11 +++++++++++ .../api/experimental/java/JavaLibrary.java | 11 +++++++++++ .../api/experimental/jvm/HasJvmApplication.java | 4 ---- .../gradle/api/experimental/jvm/JvmTarget.java | 8 ++++++++ .../extensions/testing/JvmTestDependencies.java | 13 +++++++++++++ .../jvm/extensions/testing/Testing.java | 17 +++++++++++++++++ 6 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/JvmTestDependencies.java create mode 100644 unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/Testing.java diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/JavaApplication.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/JavaApplication.java index a0966ea8..6954a15f 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/JavaApplication.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/JavaApplication.java @@ -1,8 +1,12 @@ package org.gradle.api.experimental.java; +import org.gradle.api.Action; import org.gradle.api.experimental.common.HasCliExecutables; import org.gradle.api.experimental.jvm.HasJavaTarget; import org.gradle.api.experimental.jvm.HasJvmApplication; +import org.gradle.api.experimental.jvm.extensions.testing.Testing; +import org.gradle.api.tasks.Nested; +import org.gradle.declarative.dsl.model.annotations.Configuring; import org.gradle.declarative.dsl.model.annotations.Restricted; /** @@ -10,4 +14,11 @@ */ @Restricted public interface JavaApplication extends HasJavaTarget, HasJvmApplication, HasCliExecutables { + @Nested + Testing getTesting(); + + @Configuring + default void testing(Action action) { + action.execute(getTesting()); + } } diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/JavaLibrary.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/JavaLibrary.java index e5e38c2f..de414f55 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/JavaLibrary.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/JavaLibrary.java @@ -1,7 +1,11 @@ package org.gradle.api.experimental.java; +import org.gradle.api.Action; import org.gradle.api.experimental.jvm.HasJavaTarget; import org.gradle.api.experimental.common.HasLibraryDependencies; +import org.gradle.api.experimental.jvm.extensions.testing.Testing; +import org.gradle.api.tasks.Nested; +import org.gradle.declarative.dsl.model.annotations.Configuring; import org.gradle.declarative.dsl.model.annotations.Restricted; /** @@ -9,4 +13,11 @@ */ @Restricted public interface JavaLibrary extends HasJavaTarget, HasLibraryDependencies { + @Nested + Testing getTesting(); + + @Configuring + default void testing(Action action) { + action.execute(getTesting()); + } } diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/HasJvmApplication.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/HasJvmApplication.java index 9767ed05..2b3dc063 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/HasJvmApplication.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/HasJvmApplication.java @@ -1,11 +1,7 @@ package org.gradle.api.experimental.jvm; -import org.gradle.api.Action; -import org.gradle.api.experimental.common.ApplicationDependencies; import org.gradle.api.experimental.common.HasApplicationDependencies; import org.gradle.api.provider.Property; -import org.gradle.api.tasks.Nested; -import org.gradle.declarative.dsl.model.annotations.Configuring; import org.gradle.declarative.dsl.model.annotations.Restricted; /** diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/JvmTarget.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/JvmTarget.java index e1412b13..8e023698 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/JvmTarget.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/JvmTarget.java @@ -3,6 +3,7 @@ import org.gradle.api.Action; import org.gradle.api.Named; import org.gradle.api.experimental.common.LibraryDependencies; +import org.gradle.api.experimental.jvm.extensions.testing.Testing; import org.gradle.api.tasks.Nested; import org.gradle.declarative.dsl.model.annotations.Configuring; import org.gradle.declarative.dsl.model.annotations.Restricted; @@ -18,4 +19,11 @@ default void dependencies(Action action) { action.execute(getDependencies()); } + @Nested + Testing getTesting(); + + @Configuring + default void testing(Action action) { + action.execute(getTesting()); + } } diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/JvmTestDependencies.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/JvmTestDependencies.java new file mode 100644 index 00000000..62e788ee --- /dev/null +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/JvmTestDependencies.java @@ -0,0 +1,13 @@ +package org.gradle.api.experimental.jvm.extensions.testing; + +import org.gradle.api.artifacts.dsl.Dependencies; +import org.gradle.api.artifacts.dsl.DependencyCollector; +import org.gradle.declarative.dsl.model.annotations.Restricted; + +@SuppressWarnings("UnstableApiUsage") +@Restricted +public interface JvmTestDependencies extends Dependencies { + DependencyCollector getImplementation(); + DependencyCollector getCompileOnly(); + DependencyCollector getRuntimeOnly(); +} diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/Testing.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/Testing.java new file mode 100644 index 00000000..5189b923 --- /dev/null +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/Testing.java @@ -0,0 +1,17 @@ +package org.gradle.api.experimental.jvm.extensions.testing; + +import org.gradle.api.Action; +import org.gradle.api.tasks.Nested; +import org.gradle.declarative.dsl.model.annotations.Configuring; +import org.gradle.declarative.dsl.model.annotations.Restricted; + +@Restricted +public interface Testing { + @Nested + JvmTestDependencies getDependencies(); + + @Configuring + default void dependencies(Action action) { + action.execute(getDependencies()); + } +} From c7c7d33325ed6dbdef78ac7367947e46adf5544d Mon Sep 17 00:00:00 2001 From: Tom Tresansky Date: Tue, 2 Jul 2024 14:43:16 -0400 Subject: [PATCH 2/2] Fully setup and link support for test dependencies --- .../common/ApplicationDependencies.java | 9 +--- .../common/BasicDependencies.java} | 12 ++--- .../common/LibraryDependencies.java | 6 +-- .../java/StandaloneJavaApplicationPlugin.java | 1 + .../java/StandaloneJavaLibraryPlugin.java | 1 + .../jvm/StandaloneJvmApplicationPlugin.java | 1 + .../jvm/StandaloneJvmLibraryPlugin.java | 1 + .../extensions/testing/TestDependencies.java | 7 +++ .../jvm/extensions/testing/Testing.java | 4 +- .../jvm/internal/JvmPluginSupport.java | 45 ++++++++++--------- 10 files changed, 47 insertions(+), 40 deletions(-) rename unified-prototype/unified-plugin/{plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/JvmTestDependencies.java => plugin-common/src/main/java/org/gradle/api/experimental/common/BasicDependencies.java} (56%) create mode 100644 unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/TestDependencies.java diff --git a/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/ApplicationDependencies.java b/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/ApplicationDependencies.java index 2c63be9f..f94c9efc 100644 --- a/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/ApplicationDependencies.java +++ b/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/ApplicationDependencies.java @@ -1,16 +1,9 @@ package org.gradle.api.experimental.common; -import org.gradle.api.artifacts.dsl.Dependencies; -import org.gradle.api.artifacts.dsl.DependencyCollector; import org.gradle.declarative.dsl.model.annotations.Restricted; /** * The declarative dependencies DSL block for an application. */ -@SuppressWarnings("UnstableApiUsage") @Restricted -public interface ApplicationDependencies extends Dependencies { - DependencyCollector getImplementation(); - DependencyCollector getRuntimeOnly(); - DependencyCollector getCompileOnly(); -} +public interface ApplicationDependencies extends BasicDependencies {} diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/JvmTestDependencies.java b/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/BasicDependencies.java similarity index 56% rename from unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/JvmTestDependencies.java rename to unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/BasicDependencies.java index 62e788ee..d7695a81 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/JvmTestDependencies.java +++ b/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/BasicDependencies.java @@ -1,13 +1,15 @@ -package org.gradle.api.experimental.jvm.extensions.testing; +package org.gradle.api.experimental.common; + import org.gradle.api.artifacts.dsl.Dependencies; import org.gradle.api.artifacts.dsl.DependencyCollector; -import org.gradle.declarative.dsl.model.annotations.Restricted; +/** + * Basic types of dependencies used by either an application or library, for production or test code. + */ @SuppressWarnings("UnstableApiUsage") -@Restricted -public interface JvmTestDependencies extends Dependencies { +public interface BasicDependencies extends Dependencies { DependencyCollector getImplementation(); - DependencyCollector getCompileOnly(); DependencyCollector getRuntimeOnly(); + DependencyCollector getCompileOnly(); } diff --git a/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/LibraryDependencies.java b/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/LibraryDependencies.java index 2bbf8999..121811b3 100644 --- a/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/LibraryDependencies.java +++ b/unified-prototype/unified-plugin/plugin-common/src/main/java/org/gradle/api/experimental/common/LibraryDependencies.java @@ -1,6 +1,5 @@ package org.gradle.api.experimental.common; -import org.gradle.api.artifacts.dsl.Dependencies; import org.gradle.api.artifacts.dsl.DependencyCollector; import org.gradle.declarative.dsl.model.annotations.Restricted; @@ -9,11 +8,8 @@ */ @SuppressWarnings("UnstableApiUsage") @Restricted -public interface LibraryDependencies extends Dependencies { +public interface LibraryDependencies extends BasicDependencies { DependencyCollector getApi(); - DependencyCollector getImplementation(); - DependencyCollector getRuntimeOnly(); - DependencyCollector getCompileOnly(); // CompileOnlyApi is not included here, since both Android and KMP do not support it. // Does that mean we should also reconsider if we should support it? Or, should we diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/StandaloneJavaApplicationPlugin.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/StandaloneJavaApplicationPlugin.java index 4bb8e7d2..fbbefc52 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/StandaloneJavaApplicationPlugin.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/StandaloneJavaApplicationPlugin.java @@ -33,6 +33,7 @@ private void linkDslModelToPlugin(Project project, JavaApplication dslModel) { JvmPluginSupport.linkJavaVersion(project, dslModel); JvmPluginSupport.linkApplicationMainClass(project, dslModel); JvmPluginSupport.linkMainSourceSourceSetDependencies(project, dslModel.getDependencies()); + JvmPluginSupport.linkTestSourceSourceSetDependencies(project, dslModel.getTesting().getDependencies()); dslModel.getRunTasks().add(project.getTasks().named("run")); } diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/StandaloneJavaLibraryPlugin.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/StandaloneJavaLibraryPlugin.java index 8bf2d2c0..d0672061 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/StandaloneJavaLibraryPlugin.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/java/StandaloneJavaLibraryPlugin.java @@ -29,5 +29,6 @@ public void apply(Project project) { private void linkDslModelToPlugin(Project project, JavaLibrary dslModel) { JvmPluginSupport.linkJavaVersion(project, dslModel); JvmPluginSupport.linkMainSourceSourceSetDependencies(project, dslModel.getDependencies()); + JvmPluginSupport.linkTestSourceSourceSetDependencies(project, dslModel.getTesting().getDependencies()); } } diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/StandaloneJvmApplicationPlugin.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/StandaloneJvmApplicationPlugin.java index 7c2d50f3..29f4a58a 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/StandaloneJvmApplicationPlugin.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/StandaloneJvmApplicationPlugin.java @@ -21,6 +21,7 @@ abstract public class StandaloneJvmApplicationPlugin implements Plugin public static final String JVM_APPLICATION = "jvmApplication"; + @SuppressWarnings("UnstableApiUsage") @SoftwareType(name = JVM_APPLICATION, modelPublicType = JvmApplication.class) abstract public JvmApplication getJvmApplication(); diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/StandaloneJvmLibraryPlugin.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/StandaloneJvmLibraryPlugin.java index 62ad8d95..d10adeec 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/StandaloneJvmLibraryPlugin.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/StandaloneJvmLibraryPlugin.java @@ -18,6 +18,7 @@ abstract public class StandaloneJvmLibraryPlugin implements Plugin { public static final String JVM_LIBRARY = "jvmLibrary"; + @SuppressWarnings("UnstableApiUsage") @SoftwareType(name = JVM_LIBRARY, modelPublicType = JvmLibrary.class) abstract public JvmLibrary getJvmLibrary(); diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/TestDependencies.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/TestDependencies.java new file mode 100644 index 00000000..85c60c7f --- /dev/null +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/TestDependencies.java @@ -0,0 +1,7 @@ +package org.gradle.api.experimental.jvm.extensions.testing; + +import org.gradle.api.experimental.common.BasicDependencies; +import org.gradle.declarative.dsl.model.annotations.Restricted; + +@Restricted +public interface TestDependencies extends BasicDependencies {} diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/Testing.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/Testing.java index 5189b923..3d8d9907 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/Testing.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/extensions/testing/Testing.java @@ -8,10 +8,10 @@ @Restricted public interface Testing { @Nested - JvmTestDependencies getDependencies(); + TestDependencies getDependencies(); @Configuring - default void dependencies(Action action) { + default void dependencies(Action action) { action.execute(getDependencies()); } } diff --git a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/internal/JvmPluginSupport.java b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/internal/JvmPluginSupport.java index c2cd20fb..5e8b52c1 100644 --- a/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/internal/JvmPluginSupport.java +++ b/unified-prototype/unified-plugin/plugin-jvm/src/main/java/org/gradle/api/experimental/jvm/internal/JvmPluginSupport.java @@ -2,11 +2,13 @@ import org.gradle.api.Project; import org.gradle.api.experimental.common.ApplicationDependencies; +import org.gradle.api.experimental.common.BasicDependencies; import org.gradle.api.experimental.common.LibraryDependencies; import org.gradle.api.experimental.jvm.HasJavaTarget; import org.gradle.api.experimental.jvm.HasJavaTargets; import org.gradle.api.experimental.jvm.HasJvmApplication; import org.gradle.api.experimental.jvm.JavaTarget; +import org.gradle.api.experimental.jvm.extensions.testing.TestDependencies; import org.gradle.api.file.Directory; import org.gradle.api.plugins.JavaApplication; import org.gradle.api.plugins.JavaPluginExtension; @@ -19,26 +21,6 @@ import java.util.Collections; public class JvmPluginSupport { - public static void linkSourceSetToDependencies(Project project, SourceSet sourceSet, LibraryDependencies dependencies) { - project.getConfigurations().getByName(sourceSet.getImplementationConfigurationName()) - .getDependencies().addAllLater(dependencies.getImplementation().getDependencies()); - project.getConfigurations().getByName(sourceSet.getCompileOnlyConfigurationName()) - .getDependencies().addAllLater(dependencies.getCompileOnly().getDependencies()); - project.getConfigurations().getByName(sourceSet.getRuntimeOnlyConfigurationName()) - .getDependencies().addAllLater(dependencies.getRuntimeOnly().getDependencies()); - project.getConfigurations().getByName(sourceSet.getApiConfigurationName()) - .getDependencies().addAllLater(dependencies.getApi().getDependencies()); - } - - public static void linkSourceSetToDependencies(Project project, SourceSet sourceSet, ApplicationDependencies dependencies) { - project.getConfigurations().getByName(sourceSet.getImplementationConfigurationName()) - .getDependencies().addAllLater(dependencies.getImplementation().getDependencies()); - project.getConfigurations().getByName(sourceSet.getCompileOnlyConfigurationName()) - .getDependencies().addAllLater(dependencies.getCompileOnly().getDependencies()); - project.getConfigurations().getByName(sourceSet.getRuntimeOnlyConfigurationName()) - .getDependencies().addAllLater(dependencies.getRuntimeOnly().getDependencies()); - } - public static void linkMainSourceSourceSetDependencies(Project project, LibraryDependencies dependencies) { JavaPluginExtension java = project.getExtensions().getByType(JavaPluginExtension.class); linkSourceSetToDependencies(project, java.getSourceSets().getByName("main"), dependencies); @@ -49,11 +31,34 @@ public static void linkMainSourceSourceSetDependencies(Project project, Applicat linkSourceSetToDependencies(project, java.getSourceSets().getByName("main"), dependencies); } + public static void linkTestSourceSourceSetDependencies(Project project, TestDependencies dependencies) { + JavaPluginExtension java = project.getExtensions().getByType(JavaPluginExtension.class); + linkSourceSetToDependencies(project, java.getSourceSets().getByName("main"), dependencies); + } + + @SuppressWarnings("UnstableApiUsage") + public static void linkSourceSetToDependencies(Project project, SourceSet sourceSet, BasicDependencies dependencies) { + project.getConfigurations().getByName(sourceSet.getImplementationConfigurationName()) + .getDependencies().addAllLater(dependencies.getImplementation().getDependencies()); + project.getConfigurations().getByName(sourceSet.getCompileOnlyConfigurationName()) + .getDependencies().addAllLater(dependencies.getCompileOnly().getDependencies()); + project.getConfigurations().getByName(sourceSet.getRuntimeOnlyConfigurationName()) + .getDependencies().addAllLater(dependencies.getRuntimeOnly().getDependencies()); + } + + @SuppressWarnings("UnstableApiUsage") + public static void linkSourceSetToDependencies(Project project, SourceSet sourceSet, LibraryDependencies dependencies) { + linkSourceSetToDependencies(project, sourceSet, (BasicDependencies) dependencies); + project.getConfigurations().getByName(sourceSet.getApiConfigurationName()) + .getDependencies().addAllLater(dependencies.getApi().getDependencies()); + } + public static void linkJavaVersion(Project project, HasJavaTarget dslModel) { JavaPluginExtension java = project.getExtensions().getByType(JavaPluginExtension.class); java.getToolchain().getLanguageVersion().set(dslModel.getJavaVersion().map(JavaLanguageVersion::of)); } + @SuppressWarnings("OptionalGetWithoutIsPresent") public static void linkJavaVersion(Project project, HasJavaTargets dslModel) { JavaPluginExtension java = project.getExtensions().getByType(JavaPluginExtension.class); java.getToolchain().getLanguageVersion().set(project.provider(() ->