Conversation
We already pre-compile the well known types into the runtimes so they shouldn't be re-compiled. protocolbuffers#8925
| command_line = "--java_out=lite:$(OUT)", | ||
| runtime = ":lite", | ||
| visibility = ["//visibility:public"], | ||
| # keep this in sync w/ LITE_WELL_KNOWN_PROTO_MAP in //:BUILD |
There was a problem hiding this comment.
compiler and descriptor are missing here but present above.
There was a problem hiding this comment.
They aren't available in lite.
|
I'm going to close this since it appears to be unnecessary now that #8925 has been resolved, but please let me know if I am mistaken. |
@acozzette It's valid. It's a minor issue, since the well known types don't take up much space and are probably identical anyways, but you get duplicates which waste space and introduce uncertainty which version is used. That said, it's a long standing bug and probably not easy to fix, so it's not high priority. But IMHO the issue shouldn't be closed. |
protobuf / protobuf8942 Signed-off-by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
|
See also the demonstration in brach 8942 : https://github.com/eikemeier/proto-java/tree/8942 |
|
@eikemeier Thanks for letting me know. Do you know if this pull request solves this problem? Based on the comments on #8925, it sounded like we were just waiting on a Bazel release. |
The issue is still present in Bazel 5.0rc1, Protobuf 3.19.1, see #9192. Should I try the latest |
|
I'm not sure what release that bazel patch came in through, can you check
with them if it's present in that release? Try head as well.
…On Fri, Nov 5, 2021 at 8:06 AM Oliver Eikemeier ***@***.***> wrote:
@eikemeier <https://github.com/eikemeier> Thanks for letting me know. Do
you know if this pull request solves this problem? Based on the comments on
#8925 <#8925>, it
sounded like we were just waiting on a Bazel release.
The issue is still present in Bazel 5.0rc1, Protobuf 3.19.1, see #9192
<#9192>. Should I try
the latest HEAD?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8942 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAFA5VDP4GIQOJBRJHPZB3UKPXH3ANCNFSM5DFEXVGQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
With HEAD (+PR #9195) and Bazel 5.0rc1 I see no duplicates any more, see the latest version of https://github.com/eikemeier/proto-java2 Fine so far, is there any documentation that you're supposed to do or should I open a PR for that, too? |
|
good catch, please do! |
The runtime already supplies pre-compiled implementations for these.
Compiling the well-known types is always redundant work, but this
duplication really becomes a problem when we resolve a proto runtime
from Maven that's newer than the `protoc` used by `rules_proto`. When
that happens, we get many compilation errors of the form
```
error: name clash: clearExtension(GeneratedExtension<ExtensionRangeOptions,?>) in Builder and clearExtension(GeneratedExtension<ExtensionRangeOptions,T>) in ExtendableBuilder have the same erasure, yet neither overrides the other
public <Type> Builder clearExtension(
^
where T,MessageT,BuilderT are type-variables:
T extends Object declared in method <T>clearExtension(GeneratedExtension<MessageT,T>)
MessageT extends ExtendableMessage<MessageT> declared in class ExtendableBuilder
BuilderT extends ExtendableBuilder<MessageT,BuilderT> declared in class ExtendableBuilder
```
This particular error was produced by introducing
`build.buf:protovalidate:0.0.1` (depends on
`com.google.protobuf:protobuf-java:3.23.4`) to the Maven deps of a
workspace that uses `rules_proto-4.0.0-3.20.0`, as exhibited by the
repo contained in this
[gist](https://gist.github.com/plobsing/290f099fbc98e797013c990957f17f56)
when using an unpatched `rules_proto`.
I had expected that using a protoc version of 3.20.0 and a runtime
version of 3.23.4 should work based on the
[overall protobuf compatibility guarantee](https://protobuf.dev/support/cross-version-runtime-guarantee/)
and the [java-specific statement](https://github.com/protocolbuffers/protobuf/blob/main/java/README.md#compatibility-notice).
And, aside from this compilation issue, it does seem to.
This fix mirrors protocolbuffers/protobuf#8942
made to the protobuf repo.
We already pre-compile the well known types into the runtimes so they shouldn't be re-compiled. #8925.