dgs-codegen icon indicating copy to clipboard operation
dgs-codegen copied to clipboard

bug: kotlin plugin wrapper not detected in module without version

Open Gosunet opened this issue 3 years ago • 0 comments

Hello,

I use version 5.0.6 dgs codegen gradle plugin. And I have a project with two kotlin modules in it.

I applied the kotlin plugin in the root build.gradle.kts like that :

plugins {
    kotlin("jvm") version "1.5.30" apply false
}

And in my module like that :

plugins {
    kotlin("jvm")

In this situation the generateJava task in my module generate java classes and not kotlin classes. Forcing 'language' in the GenerateJavaTask resolve the issue :

tasks.withType<com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask> {
    packageName = "org.example"
    language = "KOTLIN"
}

Importing kotlin("jvm") version "1.5.30" in each module also resolve the issue, but It's not recommanded.

Expected behavior

Kotlin classes generated without language = "KOTLIN" argument in GenerateJavaTask.

Actual behavior

Java classes generated.

Steps to reproduce

Create a module in a Kotlin project, in build.gradle.kts root apply kotlin plugin with version. In your module build.gradle.kts apply the kotlin module without version and generate some classes with generateJava task.

Gosunet avatar Sep 10 '21 14:09 Gosunet