Removing protobuf dependency #1008
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Description:
Bug fix - Since this module has a dependency on OTel Java proto it means that it also gets Protobuf's java lib as a transitive dependency. The protobuf-java library is not ideal for Android projects due to its size which is why there's another version of it, called protobuf-javalite, that aims to be more suitable for Android use cases due to its smaller size.
Given that the
protobuf-javalitedependency is better for Android projects, some projects might have it included already which causes a problem if they later add thedisk-bufferingdependency as well, since it comes with the "regular protobuf dependency". This is an issue because both, the regular and lite versions of the protobuf libs, contain classes that have the exact same fully qualified names, which makes Gradle raise a compilation error due to the "duplicated classes" it finds across different dependencies.This was discussed in the latest Java SIG meeting where a couple of interesting ideas were proposed to avoid this issue such as:
disk-bufferingdependency into a project that already has the protobuf-javalite dependency. Ideally, I'd like this lib to be easy to use.The approach I'm proposing to go with in this PR is to not use any of the protobuf dependencies, neither the "regular" nor the "lite" one, in
disk-buffering. Instead, we can use Wire, which is a third-party tool (already being used in other OTel Java projects) that takes care of generating the Java sources from the proto files without having any dependency on Google's protobuf libraries. As a bonus side of using this tool, we get smaller generated sources since Wire makes them a bit more android friendly by reducing the number of methods for each generated class.Existing Issue(s):
#1009
Testing:
Unit, integration, manual tests.
Documentation:
No documentation changes are needed as part of this PR since the changes are only internal.
Outstanding items: