Mike McFarland
Mike McFarland

Reputation: 657

How do I generate thrift implementations in both scala and java using scrooge and sbt

lets say I have a thrift file

#@namespace scala com.project.artifact.thrift
namespace java com.project.artifact.java.thrift 

service SomeService {
  string helloWorld()
}

where different name spaces are provided for java and scala. Now I know i can make scrooge compile in java by changing the language

scroogeLanguage in Compile := "java"

But how can I have generation tasks for both java and scala

The reason I want to do this is so I can provide pre-made clients for both java and scala projects, without them having to pull in scrooge or thrift.

I know that's generally considered an anti pattern to bundle the generated classes rather then having consumers use the idl to build what they need, but existing non thrift projects we've produced follow the pattern of including clients so it makes things more consistent (many of the consuming projects won't be using thrift/scrooge anyway).

Upvotes: 4

Views: 590

Answers (0)

Related Questions