Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated JavaPluginConvention #316

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -41,7 +41,14 @@ class CodegenPlugin : Plugin<Project> {
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
Expand Down