Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

sbt 0.12 plugin for generating and compiling thrift files

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 project
Octocat-spinner-32 src
Octocat-spinner-32 target
Octocat-spinner-32 .cache
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 build.sbt
Octocat-spinner-32 changelog
README.md

Thrift plugin for sbt 0.12+

Instructions for use:

Step 1: Include the plugin in your build

Add the following to your project/plugins.sbt:

resolvers += "bigtoast-github" at "http://bigtoast.github.com/repo/"

addSbtPlugin("com.github.bigtoast" % "sbt-thrift" % "0.6")

Step 2: Add sbt-thrift settings to your build

Add the following to your 'build.sbt' ( if you are using build.sbt )

import com.github.bigtoast.sbtthrift.ThriftPlugin

seq(ThriftPlugin.thriftSettings: _*)

Or if you are using a build object extending from Build:

import sbt._
import Keys._
import com.github.bigtoast.sbtthrift.ThriftPlugin

class BuildWithThriftShiz extends Build {
     lazy val seniorProject = Project("hola", file("."), settings = 
      Defaults.defaultSettings ++ ThriftPlugin.thriftSettings ++ Seq(/* custom settings go here */))
}

Settings

thrift Thrift executable. This defaults to just 'thrift'
thrift := "/some/other/path/to/thrift"
thriftSourceDir Directory containing thrift sources. This defaults to 'src/main/thrift'.
thriftSourceDir <<= baseDirectory( _ / "other" / "thrift" / "sourceDir" )
thriftOutputDir The output dir for the generated sources. This directory will be added to sourceManaged so it will be automatically get compiled when you run compile. This defaults to 'target/generated-sources'.
thriftJavaOptions Additional options to thrift compiler for java generation.
thriftJavaEnabled Are we generating java source (?) Default is true.
thriftJsEnabled Are we generating javascript source (?) Default is false.
thriftJsOutputDir The output dir for the generated javascript. This directory will be added to resourceManaged so it will be automatically get compiled during generation of resources. This defaults to 'target/gen-js'.
thriftJsOptions Additional options to thrift compiler for javascript generation.
thriftRubyEnabled Are we generating ruby source (?) Default is false.
thriftRubyOutputDir The output dir for the generated Ruby. This directory will be added to sourceManaged so it will be automatically get compiled during generation of resources. This defaults to 'target/gen-rb'.
thriftRubyOptions Additional options to thrift compiler for Ruby generation.
thriftPythonEnabled Are we generating Python source (?) Default is false.
thriftPythonOutputDir The output dir for the generated Python. This directory will be added to sourceManaged so it will be automatically get compiled during generation of resources. This defaults to 'target/gen-py'.
thriftPythonOptions Additional options to thrift compiler for Python generation.

Tasks

thrift:generate-java This will run generate java sources from the thrift sources. This task is automatically executed when compile is run.
thrift:generate-js This will run generate javascript sources from the thrift sources. This task is automatically executed during the compile phase if thriftJsEnabled is set to true /td>
thrift:generate-ruby This will run generate Ruby sources from the thrift sources. This task is automatically executed during the compile phase if thriftRubyEnabled is set to true /td>
thrift:generate-python This will run generate Python sources from the thrift sources. This task is automatically executed during the compile phase if thriftPythonEnabled is set to true /td>

Notes

If any bugs are found or features wanted please file an issue in the github project. I will do my best to accommodate.

Acknoledgements

I used the following plugins as reference

  • my sbt-liquibase plugin
  • sbt-protobuf plugin for sbt 0.10

Contributors

Andrew Headrick bigtoast Ruslan Shevchenko rssh

Something went wrong with that request. Please try again.