Skip to content
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

Add prefix to classpath of generated protobuf files #169

Conversation

jeromesklar-toast
Copy link

@jeromesklar-toast jeromesklar-toast commented May 4, 2022

Adds a protokt specific prefix to classpath of generated protobuf files to avoid conflicts in projects that use both protokt and another protobuf library, such as that of google. This will allow projects to safely use protokt and another protobuf library and not have conflicts (which can lead to RuntimeExceptions) between generated file paths.

Note: this is a breaking change and upgrading to this version of protokt will involve making changes to add the "protokt." to certain imports

Testing: Verified this fixes at least one runtime exception that was occurring with google protobuf and protokt libraries in the same service

Future changes:
In the future, we plan on potentially doing some more package cleanup to:

  • remove some extraneous "com." prefixes
  • remove the special case that converts com.google.protobuf --> com.toasttab.protokt and just universally add the "protokt." prefix solution in all cases. (so, com.google.protobuf --> protokt.com.google.protobuf)

Copy link
Collaborator

@andrewparmet andrewparmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

Copy link
Collaborator

@andrewparmet andrewparmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two tiny things and then this is ready to merge.

testing/android-test-configurations/build.gradle.kts Outdated Show resolved Hide resolved
testing/plugin-options/lite/build.gradle.kts Outdated Show resolved Hide resolved
Copy link
Member

@ogolberg ogolberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's punt till 1.0.

  • The cost of propagating this backwards-incompatible change through systems that use protokt is substantial.
  • Current behavior is consistent with Wire and ScalaPB (other protobuf codegens that target JVM languages)

@andrewparmet
Copy link
Collaborator

superseded by #168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants