Netflix / Netflix/dgs-codegen

bug: kotlin plugin wrapper not detected in module without version

Open
#219 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
217
Forks
116
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a root build.gradle.kts declaring kotlin("jvm") with a version and a module applying it without one. Start with GenerateJavaTask and the generateJava task's language detection; done means the module generates Kotlin classes without explicitly setting language = "KOTLIN".

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.