Gradle proto build

plugins

(Joseph Fota) #1

SrcDir doesn’t appear to work with protobuf. All my *.proto exist in ps/proto. I’m trying to have the generated *.cc, *h, and *.o files end up in build/ps/proto. Unfortunately, I all I get are errors.


build.gradle
buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
  }
}

apply plugin: ‘c’
apply plugin: ‘cpp’
apply plugin: ‘java’
apply plugin: ‘com.google.protobuf’

sourceSets {
main {
proto {
srcDir ‘ps/proto’
}
}
}

protobuf {
generateProtoTasks {
all()*.builtins {
cpp {
}
}
}
generatedFilesBaseDir = “$buildDir”
}


The errors show directories that aren't needed, but wanted. Proto file that aren't found, but do exist. And "not defined" errors which I don't recognize.

# gradle build
:extractIncludeProto
:extractProto
:generateProto FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:generateProto’.

protoc: stdout: . stderr: /home/workarea/ps/src/src/main/proto: warning: directory does not exist.
/home/workarea/ps/src/build/extracted-protos/main: warning: directory does not exist.
/home/workarea/ps/src/build/extracted-include-protos/main: warning: directory does not exist.
ps/proto/security.proto: File not found.
ps/proto/common.proto: File not found.
ps/proto/cli.proto: File not found.
ps/proto/volumemirrorcommon.proto: File not found.
ps/proto/metrics.proto: File not found.
cldb.proto: Import “ps/proto/security.proto” was not found or had errors.
cldb.proto: Import “ps/proto/common.proto” was not found or had errors.
cldb.proto: Import “ps/proto/cli.proto” was not found or had errors.
cldb.proto: Import “ps/proto/volumemirrorcommon.proto” was not found or had errors.
cldb.proto: Import “ps/proto/metrics.proto” was not found or had errors.
cldb.proto:214:12: “CredentialsMsg” is not defined.
cldb.proto:218:12: “CredentialsMsg” is not defined.
cldb.proto:220:12: “TicketAndKey” is not defined.
cldb.proto:224:12: “CredentialsMsg” is not defined.
cldb.proto:230:12: “TicketAndKey” is not defined.
[…]
cldb.proto:3612:12: “CredentialsMsg” is not defined.
cldb.proto:3614:12: “Key” is not defined.
cldb.proto:3618:12: “CredentialsMsg” is not defined.
cldb.proto:3619:12: “ServerKeyType” is not defined.
cldb.proto:3625:12: “TicketAndKey” is not defined.
cldb.proto:3629:12: “CredentialsMsg” is not defined.
cldb.proto:3636:12: “CredentialsMsg” is not defined.
cldb.proto:3650:12: “CredentialsMsg” is not defined.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.172 secs