graphql-kotlin icon indicating copy to clipboard operation
graphql-kotlin copied to clipboard

Add plugin configuration option to allow generating test client files into testFixtures sources root

Open jonnymags opened this issue 11 months ago • 0 comments

Is your feature request related to a problem? Please describe. I have test code in a Gradle project that I need shared across submodules, so it lives in a TestFixtures source directory. I'd like my code that's generated by the GraphQLGenerateTestClientTask to also exist in a TestFixtures sources directory so that I can share it across modules. Currently, there is no option to specify that a directory is a TestFixtures sources directory in the plugin, since it automatically marks the output directory as a Test sources root.

Describe the solution you'd like A plugin configuration option that allows me to specify whether I want to generate the resulting code into a test sources root or a testFixtures sources root.

Describe alternatives you've considered I've been able to get around this by overwriting the test sources root and adding the output directory to the testFixtures source set, like so:

sourceSets.testFixtures.get().java.srcDir(graphqlGenerateTestClient.get().outputDirectory)
sourceSets.test.get().java.setSrcDirs(listOf("src/test/java"))

Additional context Add any other context or screenshots about the feature request here.

jonnymags avatar Mar 05 '24 15:03 jonnymags