yodle / griddle Goto Github PK
View Code? Open in Web Editor NEWA gradle plugin that enables it to handle .thrift idl files and generate them with Thrift or Scrooge
License: Other
A gradle plugin that enables it to handle .thrift idl files and generate them with Thrift or Scrooge
License: Other
java 8
gradle 2.14.1
use a more easily available thrift version
switch to gradle functional tests instead of having a separate set of 'test projects'
Hi!
I'm developer of https://github.com/bsideup/GradleThrift
I think your project is nice and promising, and if we will merge them (mine can propose crossplatform auto-downloading of thrift binaries at least) result should be awesome:)
Do you have any plans to continue support your project? If no, I'm asking for permission to grab your codebase to continue development by myself.
Thanks!
Hi,
I've setup the following
apply plugin: 'idl'
apply plugin: 'scrooge-java'
dependencies {
idl project.getParent()
scroogeGen "com.twitter:scrooge-generator_2.11:4.3.0"
compile "org.scala-lang:scala-library:2.11.7"
compile "com.twitter:scrooge-runtime_2.11:4.3.0"
compile "org.apache.thrift:libthrift:0.5.0"
}
repositories {
mavenCentral()
maven { url "http://maven.twttr.com" }
}
apply plugin: 'idea'
dependencies {
compile project(':idl-base:scrooge')
}
Hello. I'm trying to use the griddle plugin to generate the default Java classes that you normally get from Thrift (ie. without Scrooge). To do this I configured my build.gradle file like so:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.7.7'
classpath 'com.yodle.griddle:griddle:1.7'
}
}
plugins {
id "com.commercehub.gradle.plugin.avro" version "0.8.0"
}
apply plugin: 'idl'
apply plugin: 'thrift'
apply plugin: 'scala'
apply plugin: "com.google.protobuf"
apply plugin: 'idea'
repositories {
mavenCentral()
}
dependencies {
compile 'org.scala-lang:scala-library:2.11.7',
'com.google.protobuf:protobuf-java:3.0.0-beta-2',
'com.google.protobuf:protobuf-java-util:3.0.0-beta-2',
'org.apache.tinkerpop:tinkerpop:3.2.0-incubating',
'org.apache.tinkerpop:gremlin-core:3.2.0-incubating',
'com.michaelpollmeier:gremlin-scala_2.11:3.1.0-incubating.2',
'com.trueaccord.scalapb:scalapb-runtime_2.11:0.5.26',
'com.trueaccord.scalapb:scalapb-json4s_2.11:0.1.1',
'org.apache.avro:avro:1.7.7'
compile 'org.apache.thrift:libthrift:0.9.3'
}
sourceSets {
main {
proto {
srcDirs = ['src/main/protobuf']
}
scala {
srcDirs = ['src/main/scala', "$protobuf.generatedFilesBaseDir", "$thriftGenDir"]
}
}
test {
proto {
srcDirs = ['src/test/protobuf']
}
scala {
srcDirs = ['src/test/scala', "$protobuf.generatedFilesBaseDir", "$thriftGenDir"]
}
}
}
idea {
module {
sourceDirs += file("$protobuf.generatedFilesBaseDir");
}
}
protobuf {
// Configure the protoc executable
protoc {
// Download from repositories
artifact = 'com.google.protobuf:protoc:3.0.0-beta-2'
}
// generatedFilesBaseDir = "$buildDir/generated-sources/main"
}
avro {
createSetters = false
fieldVisibility = "PRIVATE"
}
/**
* Task will use the ScalaPB binary to generate Scala classes using the .proto IDL files
* */
task generateScalaPB(type: Exec) {
workingDir 'src/main/protobuf'
commandLine './scalapbc-0.5.26/bin/scalapbc'
def protoFiles = fileTree(dir: "src/main/protobuf", include: '**/*.proto').
getFiles().
collect() { file -> file.name }
args = [protoFiles, "--scala_out=flat_package:$protobuf.generatedFilesBaseDir"].flatten()
}
compileScala {
dependsOn generateScalaPB
}
thriftSrcDir = "${projectDir}/src/main/idl"
Excuse the length build.gradle file. I'm in the process of testing out Protobuf and Avro in addition to Thrift but I thought I would provide the entire file in case there is a known compatibility issue in any of that.
Anyways, when I go to run the generateInterfaces task for gradle, I get the following output:
Note: That I'm running Gradle 2.13 on IntelliJ but the command above I ran from the terminal.
bash$ ./gradlew generateInterfaces --info
...
os.detected.name=osx
os.detected.arch=x86_64
os.detected.classifier=osx-x86_64
All projects evaluated.
Selected primary task 'generateInterfaces' from project :
Tasks to be executed: [task ':copyDependencyIdl', task ':copyIncludedIdl', task ':generateInterfaces']
:copyDependencyIdl (Thread[main,5,main]) started.
:copyDependencyIdl
Skipping task ':copyDependencyIdl' as it is up-to-date (took 0.017 secs).
:copyDependencyIdl UP-TO-DATE
:copyDependencyIdl (Thread[main,5,main]) completed. Took 0.022 secs.
:copyIncludedIdl (Thread[main,5,main]) started.
:copyIncludedIdl
Skipping task ':copyIncludedIdl' as it is up-to-date (took 0.001 secs).
:copyIncludedIdl UP-TO-DATE
:copyIncludedIdl (Thread[main,5,main]) completed. Took 0.002 secs.
:generateInterfaces (Thread[main,5,main]) started.
:generateInterfaces
Executing task ':generateInterfaces' (up-to-date check took 0.005 secs) due to:
Task ':generateInterfaces' has changed type from 'com.yodle.griddle.GenerateInterfacesScroogeTask_Decorated' to 'com.yodle.griddle.GenerateInterfacesThriftTask_Decorated'.
Starting process 'command 'thrift''. Working directory: /Users/luis.medina/code/protobuf Command: thrift -o /Users/luis.medina/code/protobuf/build/gen-src --gen java:hashcode -I /Users/luis.medina/code/protobuf/build/idl/dependency -I /Users/luis.medina/code/protobuf/build/idl/included /Users/luis.medina/code/protobuf/src/main/idl/test.thrift
:generateInterfaces FAILED
:generateInterfaces (Thread[main,5,main]) completed. Took 0.044 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generateInterfaces'.
> A problem occurred starting process 'command 'thrift''
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 3.366 secs
Stopped 0 compiler daemon(s).
Any idea what might be going on when it says that the "generateInterfaces" task changed type?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.