In my android app I use proto files. For example, I have proto file Stats.proto
syntax = "proto3";
package com.me.test;
message Stat {
string a = 1;
string b = 2;
string c = 3;
string d = 4;
}
I need to register package in the each proto file itself, and this is uncomfortable, because I have a lot of files. I want to register default package in gradle, for example, 'package com.me.test', which uses each file that I create. I found solution in javanano
nano {
proto {
// Selects between --java_out and --javanano_out, default is 'java'
mode 'javanano'
// Options added to --java_out or --javanano_out
option 'java_package=src/proto/simple-data.proto|my_package'
option 'java_outer_classname=src/proto/simple-data.proto|OuterName'
// Apply the 'grpc' plugin defined in protobufNativeCodeGenPluginDeps
plugin 'grpc' {
// Options added to --grpc_out
option 'nano=true'
}
}
But I need to use javalite
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins {
javalite {
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
}
task.plugins {
javalite { }
}
}
}
}
And I want to have analogous logic
option 'java_package=src/proto/simple-data.proto|my_package'
like javanano in javalite
Can I implement that?
from Register a package for the class generated from the proto file in the gradle by default , not in proto file
No comments:
Post a Comment