Gradle Thrift Plugin
Gradle Thrift Plugin uses thrift compiler to compile Thrift IDL files.
Usage
To use this plugin, add the following to your build script.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.org.jruyi.gradle:thrift-gradle-plugin:0.3.1"
}
}
apply plugin: "org.jruyi.thrift"
Or for gradle 2.1+
plugins {
id "org.jruyi.thrift" version "0.3.1"
}
Tasks
The Thrift plugin adds compileThrift task which compiles Thrift IDL files using thrift compiler.
Task Property | Type | Default Value |
---|---|---|
thriftExecutable | String | thrift |
sourceDir | File | src/main/thrift |
outputDir | File | buildDir/generated-sources/thrift |
includeDirs | Set | [] |
generators | Map | ['java':''] if JavaPlugin is applied, otherwise [] |
nowarn | boolean | false |
strict | boolean | false |
verbose | boolean | false |
recurse | boolean | false |
debug | boolean | false |
allowNegKeys | boolean | false |
allow64bitsConsts | boolean | false |
createGenFolder | boolean | true |
If createGenFolder is set to false, no gen-* folder will be created.
Example
compileThrift {
recurse true
generator 'html'
generator 'java', 'private-members'
}
Default Behaviors
When JavaPlugin is applied, generator 'java' will be created and the generated java code will be added to java source automatically.