Skip to content

Docs: gradle documentation needs to set the main sourcset from the task #1585

@xenoterracide

Description

@xenoterracide

Issue Description

Gradle plugin documentation uses old pattern that can cause some issues. Firstly buildDir is deprecated, but I also have a build issue because my schema in resources, and so it thought I needed to depend on processResource. I suspect this is an old gradle pattern that's changed at some point. Not only is the solution simpler it has less issues because the inputs/outputs are correctly defined.

WRONG

// Automatically generate GraphQL code on project build:
compileJava.dependsOn 'graphqlCodegen'

// Add generated sources to your project source sets:
sourceSets.main.java.srcDir "$buildDir/generated"

RIGHT
groovy

sourceSets.main.java.srcDirs(tasks.graphqlCodegen, "src/main/java")

this is kotlin (this should be doubly verified as I haven't made certain that tasks.graphqCodgen is available, but it should be, I'm currently using groovy.)

sourceSets {
  main {
    java.srcDirs(tasks.graphqlCodegen, "src/main/java")
  }
}

Your Environment and Setup

  • graphql-java-codegen version: 5.10.0
  • Build tool: Gradle

can create a PR if you want

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions