-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support --experimental_allow_proto3_optional option #415
Comments
I looked for a way to configure protoc gradle tasks with |
I think I have a PR that adds this but I confess I cannot get tests working (even on master) edit: tests are passing in CI |
The experimental flag is intended to allow time for plugin implementors to support optional. We explicitly want to discourage users going off and adding the flag. Implementors generally can run protoc manually without too much heart-ache, or they can use the In general, passing flags to protoc yields ecosystem issues, as everyone really needs to agree on one set of options. For example, that was one of the issues with javanano. We understand you're excited about optional fields in proto, but they are still not supported at this time. |
Please reconsider, this is such a valuable feature, I promise I'll be responsible and move to whatever new syntax you want when it's officially supported. |
+1 |
As now this is impossible to build google ads protos with gradle and this plugin :| protobuf {
def versionOverride = '3.12.0'
Map<String, String> notation = [
group : 'com.google.protobuf',
name : 'protoc',
version : versionOverride,
classifier: project.osdetector.classifier,
ext : 'exe',
]
Dependency dep = project.dependencies.add('protobuf', notation)
File protocFile = configurations['protobuf'].fileCollection(dep).singleFile
if (!protocFile.canExecute() && !protocFile.setExecutable(true))
throw new GradleException("Cannot set ${protocFile} as executable")
println "Using protoc: ${protocFile}"
def myProtoc = new File("$projectDir/my-protoc.sh");
myProtoc.delete();
if(myProtoc.exists())
throw new GradleException("Cannot set delete ${myProtoc}")
myProtoc << "#!/bin/bash\n"
myProtoc << "$protocFile " + '--experimental_allow_proto3_optional $@'
myProtoc << "\n"
if(!myProtoc.setExecutable(true))
throw new GradleException("Cannot set ${myProtoc} as executable")
protoc {
path = "${protocFile}"
}
} Just add |
It is no longer experimental. https://github.com/protocolbuffers/protobuf/releases/tag/v3.15.0 |
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment) Also need newer binutils.
--experimental_allow_proto3_optional requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment) Also explicitly include gcc - rust may be installing an older version which doesn't like the new `.relr.dyn` section
Note: `--experimental_allow_proto3_optional` requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
Note: `--experimental_allow_proto3_optional` requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
Note: `--experimental_allow_proto3_optional` requires protbuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
Note: `--experimental_allow_proto3_optional` requires protobuf 3.15 or later google/protobuf-gradle-plugin#415 (comment)
Since protoc version 3.12.0, this option enables the use of
optional
in proto3 for explicit field presence.https://github.com/protocolbuffers/protobuf/blob/master/docs/field_presence.md
When I try to use this option, it’s unrecognized in IntelliJ, and the
optional
keyword is still forbidden.The text was updated successfully, but these errors were encountered: