Skip to content

Conversation

@osa1
Copy link
Member

@osa1 osa1 commented Nov 11, 2025

  • Add generated Dart for the well-known protos to the package.

  • Special case google/protobuf/... imports in the plugin to generate imports
    to the libraries in the protobuf package.

    Note: protoc already special cases these imports, you don't have to specify
    paths to them with -I....

    With this change you also don't have to manually compile them to Dart
    classes.

Fixes #1073.
Fixes #817.
Fixes #780.
Fixes #483.


Changes to test files to use internal wkt protos: cl/831301744 (merged)
Output configuration change tested in: cl/831310910

@github-actions
Copy link

github-actions bot commented Nov 11, 2025

Package publishing

Package Version Status Publish tag (post-merge)
package:protobuf 5.2.0 ready to publish protobuf-v5.2.0
package:protoc_plugin 25.0.0 ready to publish protoc_plugin-v25.0.0

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

@osa1
Copy link
Member Author

osa1 commented Nov 13, 2025

So with this change any breaking change in protoc_plugin becomes a breaking change in protobuf too, because protobuf now exports generated code. This wasn't the case before, we could update protoc_plugin without updating protobuf.

Not sure if this is a big deal in practice, but for example when we merge all of the generated files into one in the future it'll require a major version bump in protobuf with this change.

@osa1 osa1 requested a review from sigurdm November 17, 2025 12:05
@osa1 osa1 marked this pull request as ready for review November 17, 2025 12:05
dart_style: ^3.0.0
fixnum: ^1.0.0
path: ^1.8.0
protobuf: ^5.0.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
protobuf: ^5.2.0

Copy link
Collaborator

Choose a reason for hiding this comment

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

This would make the solver help out and avoid mismatches.

Copy link
Collaborator

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

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

It would even better if we could add a dart_package option to the protos - but this is clearly an improvement over the status quo.

Really nice.

@osa1
Copy link
Member Author

osa1 commented Nov 17, 2025

It would even better if we could add a dart_package option to the protos - but this is clearly an improvement over the status quo.

I agree, but that's also more work, and it needs to be done by the C++ protobuf team.

If we do it in the future it should be a backwards compatible change: the descriptors (those in the json files) in the protobuf package will get the new options (once we update the wkt protos in the repo, re-generate the compiled files, publish). This should be backwards compatible unless your code is handling the non-existent dart_package option today. The plugin will generate the same Dart imports for the same proto imports for the wkts so the generated files won't need to be updated.

@osa1 osa1 merged commit 3ed04a9 into google:master Nov 17, 2025
12 checks passed
@osa1 osa1 deleted the wkts branch November 17, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants