Skip to content

Conversation

@osa1
Copy link
Member

@osa1 osa1 commented Nov 14, 2025

With this we can finally have the same formatting in the internal version and the open source version.

This also syncs some simple changes from internal to the open source.

With this the library code is almost identical internally and in the open source. There are still a few changes that need to be synced (enum names, reflection callbacks), which I'll do separately.

cl/832251175 adds the pragmas internally and reformats internal code. Also includes some trivial syncs from this version to the internal.

To avoid bumping SDK dependency from 3.7 to 3.10, we format with 3.7 instead of 3.10. However note that SDK 3.9 cannot be used to format the repo as it has a bug and the formatter in 3.9 does not respect the @dart=... lines.

@github-actions
Copy link

github-actions bot commented Nov 14, 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.

@natebosch
Copy link
Member

This is not safe to land. This breaks compatibility with older SDKs. It's troubling that we don't have CI set up to catch this.

We must either pin to language version 3.7 or change the constraint in the pubspec

environment:
  sdk: ^3.10.0

@osa1
Copy link
Member Author

osa1 commented Nov 15, 2025

Why 3.7?

Why can't users who can't upgrade to 3.10 use the older version of the library?

The formatter in 3.9 doesn't respect the // @dart=... lines, that's why I waited until 3.10 to add these lines. We can add 3.7 as long as we always format with 3.10 or newer.

Why do you want to support 3.7 @natebosch?

You're right that if we have a min. supported version policy there should be checks to enforce it.

I've been maintaining this library for the past 3.5 years and I'm not aware of any such policy.

@sigurdm
Copy link
Collaborator

sigurdm commented Nov 17, 2025

Why can't users who can't upgrade to 3.10 use the older version of the library?

They can use the old version, but they can also accidentally get this new one by pub upgrade which is unfortunate, as it won't work.

In other words the @dart= pragmas should not be higher than the minimum allowed by the sdk constraint at https://github.com/google/protobuf.dart/blob/master/protobuf/pubspec.yaml#L9.

@osa1
Copy link
Member Author

osa1 commented Nov 17, 2025

Good point, we should make sure the pubspec is in sync with the @dart comments.

What should be the oldest supported SDK version? Do we have a policy in ecosystem packages for the min. supported version?

@sigurdm
Copy link
Collaborator

sigurdm commented Nov 17, 2025

I don't think we have a policy. The lower bound cannot be lower than the target of the generated code. So I guess it would make sense to make it ^3.10.0.

That means older darts won't benefit from the new protobuf improvements, but I think that is acceptable.

@osa1 osa1 changed the title Add dart=3.10 pragmas to protobuf lib code Add dart=3.7 pragmas to protobuf lib code Nov 17, 2025
Copy link
Member

@natebosch natebosch left a comment

Choose a reason for hiding this comment

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

I don't think we should land this without some mechanism to prevent incorrect updates. Maybe it's sufficient to add a CI run on the lowest supported SDK?

@osa1 osa1 closed this Nov 18, 2025
@osa1 osa1 reopened this Nov 18, 2025
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.

3 participants