A Thrift parser/generator
Scala Java HTML Thrift Objective-C Shell Other
Latest commit 2271a73 Sep 22, 2016 @pinsri pinsri committed with jenkins scrooge-generator: Resolve self referencing types.
Problem

Scrooge currently doesn't support self-referencing types. This is
useful for a number of cases.

Solution

Change the type resolver's scope to include the current type. Add unit
tests.

Result

Self-referencing types no longer result in TypeNotFoundException.
This should resolve #243 and
partially resolve #160. This
change doesn't yet support recursive types which is needed to fully
resolve #160.

This should be a backward compatible change since all the thrift files
that are resolved correctly now will continue to get resolved
correctly.

One caveat though is that we don't enforce the self-reference type to
be optional or collection type. We just depend on the generated`
language's compiler to enforce that (i.e. we expect that compiler to
generate an error if a self-referencing type is specified as
required).

Signed-off-by: Kevin Oliver <koliver@twitter.com>

RB_ID=873802
Permalink
Failed to load latest commit information.
.github Twitter OSS: Add ISSUE_TEMPLATE Jul 7, 2016
demos/scrooge-maven-demo twitter-oss: Prepare OSS libraries for release Sep 7, 2016
doc/src/sphinx scrooge-docs: how to get scrooge-sbt-plugin Jun 6, 2016
project twitter-oss: Prepare OSS libraries for release Sep 7, 2016
scrooge-benchmark DPB-7244: Cleanup existing unused deps in source Aug 29, 2016
scrooge-core Allow generic access to ThriftStructCodec3 from instances of ThriftSt… Sep 3, 2016
scrooge-generator-tests scrooge-generator: Resolve self referencing types. Sep 26, 2016
scrooge-generator scrooge-generator: Resolve self referencing types. Sep 26, 2016
scrooge-linter DPB-7244: Cleanup existing unused deps in source Aug 29, 2016
scrooge-maven-plugin twitter-oss: Prepare OSS libraries for release Sep 7, 2016
scrooge-sbt-plugin scrooge-sbt-plugin: Include generated sources in packageSrc Aug 1, 2016
scrooge-serializer DPB-7244: Cleanup existing unused deps in source Aug 29, 2016
.gitignore [split] scrooge: Cache mustache resources to improve generation perfo… Oct 7, 2014
.travis.yml oss: Remove --error from travis commands Sep 19, 2016
CHANGES scrooge-generator: Resolve self referencing types. Sep 26, 2016
CONFIG.ini [split] improve SocialGraphUtil exception logging Sep 11, 2014
CONTRIBUTING.md Update docs on contributing Sep 7, 2016
GROUPS [split] improve SocialGraphUtil exception logging Sep 11, 2014
LICENSE [split] improve SocialGraphUtil exception logging Sep 11, 2014
OWNERS remove marius from OWNERS Aug 8, 2016
README.md Update docs on contributing Sep 7, 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

We are not currently publishing snapshots for Scrooge's dependencies, which means that it may be necessary to publish the develop branches of these libraries locally in order to work on Scrooge's develop branch. To do so you can use our build tool, dodo.

curl -s https://raw.githubusercontent.com/twitter/dodo/develop/bin/build | bash -s -- --no-test scrooge

If you have any questions or run into any problems, please create an issue here, tweet at us at @finagle, or email the Finaglers mailing list.

Full Documentation

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