twitter/scrooge — pull request #164 by jedesah (2014-12-15 18:36:57+00:00)
Title: [Fix #151] Add thrift files to published artifact in sbt-plugin

Problem

If someone has a project that compiles thrift but that also depends on a librairie that defines it's own thrift as well, this project needs to receive the thrift files of the dependency somehow. My understanding is that this functionality is part of the Scrooge maven plugin but not the sbt plugin currently.

Solution

On the publishing side, the sbt-plugin now adds the thrift source files into the published jar file where both the maven plugin and the sbt plugin are already programmed to look for them.

On the receiving side, the plugin does not consider the thrift files extracted from the jar as source but as includes so that it will not re-generate source files for these definitions as the class files for these classes exist already as per the dependency.

Result

It is now possible for a project defining it's own thrift to depend on a "thrift" librairie using the Scrooge sbt-plugin to publish it's artifacts.

Also, this change makes it easier to create fat jars for large downstream projects that depend on many thrift repos (like we have at Whitepages and I am sure at Twitter). Without this change, you end up with multiple versions of the same classes that were generated by many of the dependencies.