Posts

Showing posts from January, 2020

sbt plugin to generate apollo graphql scala sources

sbt plugin to generate apollo graphql scala sources I modified the apollo-codegen-scala sources to output generic scala sources. At the moment, it is dependent on slinky. With my changes it is not dependent on slinky. Along the way, I created a plugin to generate the sources from the npx apollo codegen:generate command. Since it is my second plugin I’ve ever written, it took forever to write. There is an add occurance in that the JvmPlugin reset the sourceGenerators setting. Tracknig that down cost me a day of time. Anyway, the plugin is below and I’ll try to turn it into a real plugin shortly. For the moment, just copy this into a .scala file such as [your project]/project/apollo_codegen.scala and add the plugin to your project. Read the keys below to see what settings are available. If you need see the actual command generated, use the sbt last command or turn on debugging for this task via [your project]/Compile/apolloCodeGenerator/logLevel := Level.Debug