Skip to content

Commit

Permalink
Rename a local variable to avoid proto field name conflicts, re-gener…
Browse files Browse the repository at this point in the history
…ate protos (#869)

- Rename a local variable to avoid proto field name conflicts.

  This fixes an issue we're seeing with the latest version of
  `package:protoc_plugin` and the dartpad proto definitions.

- Re-generate descriptor protos.

- Update CI config to re-run publishing when labels change.
  • Loading branch information
devoncarew authored Aug 15, 2023
1 parent a852ba4 commit 41193fd
Show file tree
Hide file tree
Showing 7 changed files with 754 additions and 38 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
# Trigger on pull requests that target the default branch.
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened, labeled, unlabeled]
# Also, trigger when tags are pushed to the repo.
push:
tags: [ '[A-z]+-v[0-9]+.[0-9]+.[0-9]+*' ]
Expand Down
5 changes: 5 additions & 0 deletions protoc_plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 21.1.1

* Rename a local variable used with message constructors to avoid potential
conflicts with protobuf field names.

## 21.1.0

* Generate code comments for annotated protobuf inputs. ([#161])
Expand Down
28 changes: 26 additions & 2 deletions protoc_plugin/lib/src/generated/dart_options.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,23 @@ import 'package:protobuf/protobuf.dart' as $pb;
/// A mixin that can be used in the 'with' clause of the generated Dart class
/// for a proto message.
class DartMixin extends $pb.GeneratedMessage {
factory DartMixin() => create();
factory DartMixin({
$core.String? name,
$core.String? importFrom,
$core.String? parent,
}) {
final $result = create();
if (name != null) {
$result.name = name;
}
if (importFrom != null) {
$result.importFrom = importFrom;
}
if (parent != null) {
$result.parent = parent;
}
return $result;
}
DartMixin._() : super();
factory DartMixin.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
Expand Down Expand Up @@ -100,7 +116,15 @@ class DartMixin extends $pb.GeneratedMessage {

/// Defines additional Dart imports to be used with messages in this file.
class Imports extends $pb.GeneratedMessage {
factory Imports() => create();
factory Imports({
$core.Iterable<DartMixin>? mixins,
}) {
final $result = create();
if (mixins != null) {
$result.mixins.addAll(mixins);
}
return $result;
}
Imports._() : super();
factory Imports.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
Expand Down
Loading

0 comments on commit 41193fd

Please sign in to comment.