Skip to content
A Thrift parser/generator
Scala Java HTML Thrift Objective-C Shell Other
Latest commit 212ac9a Jun 28, 2016 Stefan Lance committed with jenkins scrooge-sbt-plugin, finagle: Handle compiling for multiple languages …
…and update Finagle Build.scala to build Java and Scala bindings

Problem:

The Scrooge SBT plugin fails to build the `finagle-thriftmux` and
`finagle-thrift` tests, because they require both Scala and Java bindings, but
Scrooge can only to generate bindings for one language. After fixing this
problem, the "ThriftMux client to Thrift server " test fails with an
OutOfMemoryError.

Solution:

Change the Scrooge language SettingKey from a `SettingKey[String]` to a
`SettingKey[Seq[String]]`, and set `scroogeLanguages` to `Seq("java", "scala")`
in Finagle's `Build.scala` file. Also, increase Finagle's SBT memory limit from
2G to 4G.

Result:

Now the Scrooge SBT plugin can generate bindings for multiple languages.

RB_ID=846198
Failed to load latest commit information.
.github Add PULL_REQUEST_TEMPLATEs Mar 10, 2016
bin finagle/finatra/scrooge/twitter-server: bin/travisci updates and fixes Apr 21, 2016
demos/scrooge-maven-demo Twitter OSS: Prepare libraries for next release Apr 27, 2016
doc/src/sphinx scrooge-docs: how to get scrooge-sbt-plugin Jun 6, 2016
project scrooge: fix crossScalaVersion for scrooge-generator-tests Jun 27, 2016
scrooge-benchmark source: fix more unused imports for scala 2.11.8 Mar 29, 2016
scrooge-core scrooge-generator: Revert `HasThriftStructCodec3` changes May 30, 2016
scrooge-generator-tests scrooge-generator-tests: Disable Lua test Jun 9, 2016
scrooge-generator Cross build for Scala 2.12 Jun 27, 2016
scrooge-linter scrooge: cleanup various build warnings Dec 21, 2015
scrooge-maven-plugin Twitter OSS: Prepare libraries for next release Apr 27, 2016
scrooge-sbt-plugin scrooge-sbt-plugin, finagle: Handle compiling for multiple languages … Jun 29, 2016
scrooge-serializer scrooge: cleanup various build warnings Dec 21, 2015
.gitignore [split] scrooge: Cache mustache resources to improve generation perfo… Oct 7, 2014
.travis.yml scrooge: fix crossScalaVersion for scrooge-generator-tests Jun 27, 2016
CHANGES scrooge-sbt-plugin, finagle: Handle compiling for multiple languages … Jun 29, 2016
CONFIG.ini [split] improve SocialGraphUtil exception logging Sep 11, 2014
CONTRIBUTING.md Add PULL_REQUEST_TEMPLATEs Mar 10, 2016
GROUPS [split] improve SocialGraphUtil exception logging Sep 11, 2014
LICENSE [split] improve SocialGraphUtil exception logging Sep 11, 2014
OWNERS util, finagle, scrooge: Add ryano to More Owners Files Feb 4, 2016
README.md scrooge-sbt-plugin, finagle: Handle compiling for multiple languages … Jun 29, 2016
pushsite.bash [split] improve SocialGraphUtil exception logging Sep 11, 2014
sbt Switch to Java 8 and Scala 2.11 May 9, 2016

README.md

Scrooge

Build status Codecov branch Project status Gitter Maven Central

Scrooge is a thrift code generator written in Scala, which currently generates code for Scala, Java, Cocoa, Android and Lua.

It's meant to be a replacement for the apache thrift code generator, and generates conforming, compatible binary codecs by building on top of libthrift. It integrates with the finagle project, exporting stats and finagle APIs, and makes it easy to build high throughput, low latency, robust thrift servers and clients.

Part of the motivation behind scrooge's scala implementation is that since Scala is API-compatible with Java, you can use the apache thrift code generator to generate Java files and use them from within Scala, but the generated code uses Java collections and mutable "bean" classes, causing some annoying boilerplate conversions to be hand-written. Scrooge bypasses the problem by generating Scala code directly. It also uses Scala syntax so the generated code is much more compact.

There is a comprehensive set of unit tests, which generate code, compile it, and execute it to verify expectations, as well as gold files to make it easy to review the effects of changes to the generator.

Status

This project is used in production at Twitter (and many other organizations), and is actively developed and maintained.

Building the develop branch locally

You will need the develop branch of util.

Finagle depends on scrooge-core, so the order in which you build dependencies should be:

  • in util: ./sbt publishLocal
  • in scrooge: ./sbt publishLocal
  • in finagle: ./sbt publishLocal

You will need the develop branch of finagle to run tests in scrooge-generator-tests, but you do not need it to build scrooge otherwise.

Full Documentation

https://twitter.github.io/scrooge/

Something went wrong with that request. Please try again.