From b5a80e2978619f6028bcdecc4cbf17dadd162ec6 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Mon, 17 Jan 2022 11:10:48 -0800 Subject: [PATCH 1/2] Replace deprecated JavaPluginConvention --- .../graphql/dgs/codegen/gradle/CodegenPlugin.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/graphql-dgs-codegen-gradle/src/main/kotlin/com/netflix/graphql/dgs/codegen/gradle/CodegenPlugin.kt b/graphql-dgs-codegen-gradle/src/main/kotlin/com/netflix/graphql/dgs/codegen/gradle/CodegenPlugin.kt index 9bcfdd879..58837ab2a 100644 --- a/graphql-dgs-codegen-gradle/src/main/kotlin/com/netflix/graphql/dgs/codegen/gradle/CodegenPlugin.kt +++ b/graphql-dgs-codegen-gradle/src/main/kotlin/com/netflix/graphql/dgs/codegen/gradle/CodegenPlugin.kt @@ -22,7 +22,7 @@ import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.logging.Logging 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 java.util.Optional @@ -41,7 +41,14 @@ class CodegenPlugin : Plugin { val generateJavaTaskProvider = project.tasks.register("generateJava", GenerateJavaTask::class.java) generateJavaTaskProvider.configure { it.group = GRADLE_GROUP } - val javaConvention = project.convention.getPlugin(JavaPluginConvention::class.java) + project.getTasksByName("compileJava", false).forEach { + it.dependsOn(generateJavaTaskProvider.get()) + } + project.getTasksByName("compileKotlin", false).forEach { + it.dependsOn(generateJavaTaskProvider.get()) + } + + val javaConvention = project.extensions.getByType(JavaPluginExtension::class.java) val sourceSets = javaConvention.sourceSets val mainSourceSet = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME) val outputDir = generateJavaTaskProvider.map(GenerateJavaTask::getOutputDir) From 1e8746be8888e5cefa676170ead2524f06d0d2c3 Mon Sep 17 00:00:00 2001 From: Bernardo Gomez Palacio Date: Thu, 7 Jul 2022 21:05:54 -0700 Subject: [PATCH 2/2] Drop support for Gradle 6.x and 7.0 --- .../netflix/graphql/dgs/CodegenGradlePluginCompatibilityTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql-dgs-codegen-gradle/src/test/kotlin/com/netflix/graphql/dgs/CodegenGradlePluginCompatibilityTest.kt b/graphql-dgs-codegen-gradle/src/test/kotlin/com/netflix/graphql/dgs/CodegenGradlePluginCompatibilityTest.kt index 3f387420a..0f61e8b66 100644 --- a/graphql-dgs-codegen-gradle/src/test/kotlin/com/netflix/graphql/dgs/CodegenGradlePluginCompatibilityTest.kt +++ b/graphql-dgs-codegen-gradle/src/test/kotlin/com/netflix/graphql/dgs/CodegenGradlePluginCompatibilityTest.kt @@ -40,7 +40,7 @@ class CodegenGradlePluginCompatibilityTest { lateinit var projectDir: File @ParameterizedTest - @ValueSource(strings = ["6.8.1", "7.0.2", "7.1.1", "7.2"]) + @ValueSource(strings = ["7.1", "7.2", "7.3", "7.4"]) fun `Test generateJava against multiple Gradle Versions`(gradleVersion: String) { prepareBuildGraphQLSchema( """