Is it possible to skip code generation for included thrift files in Scrooge?

270 Views Asked by At

The Scrooge SBT plugin has the option to include Thrift IDL files from library dependencies (jar files). Often these jar files already contain the generated sources. If I include a Thrift IDL, I don't want to generate these sources again. Otherwise they will be duplicated.

shared.thift

namespace java me.shared

struct Foo {
  1: string id
}

shared.jar

me
  shared
    Foo.scala
shared.thrift

So when my project depends on shared.jar and I include shared.thrift in another Thrift IDL file, I don't want Scrooge to generate Foo.scala again. What's the most straight-forward way to archive this?

1

There are 1 best solutions below

0
On

It was actually straight-forward.

scroogeThriftSources in Compile ~= { sources: Seq[File] =>
  sources filter { case file =>
    !file.getName.contains("shared.thrift")
  }
}