Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Issue 2043913005: Change how to set the Dart name of a field (Closed)

Created:
4 years, 6 months ago by skybrian
Modified:
4 years, 6 months ago
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/dart-protoc-plugin.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Change how to set the Dart name of a field The old way was by passing a --field_name flag to the protoc generator. (However, it's doubtful whether anyone was using it.) The new way is to use the field_name option on the .proto file. For example: optional string some_field = 1 [ (dart_options.dart_name) = "renamedField" ]; Based on a patch by Frederik Mutzel. BUG= R=frederikmutzel@google.com, sgjesse@google.com Committed: https://github.com/dart-lang/dart-protoc-plugin/commit/d72f7601eba02240620da0109ef9b8e2523254eb

Patch Set 1 #

Patch Set 2 : better error checking, clean up pubspec #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+513 lines, -337 lines) Patch
M Makefile View 1 chunk +1 line, -0 lines 0 comments Download
M README.md View 1 chunk +0 lines, -27 lines 0 comments Download
M lib/extension_generator.dart View 3 chunks +5 lines, -3 lines 0 comments Download
M lib/message_generator.dart View 6 chunks +13 lines, -99 lines 0 comments Download
A lib/names.dart View 1 1 chunk +288 lines, -0 lines 2 comments Download
M lib/options.dart View 2 chunks +2 lines, -42 lines 0 comments Download
M lib/protobuf_field.dart View 8 chunks +55 lines, -74 lines 0 comments Download
M lib/protoc.dart View 2 chunks +1 line, -1 line 0 comments Download
M lib/src/dart_options.pb.dart View 1 chunk +6 lines, -3 lines 0 comments Download
M pubspec.yaml View 1 1 chunk +6 lines, -5 lines 0 comments Download
M test/file_generator_test.dart View 1 chunk +0 lines, -64 lines 0 comments Download
A test/names_test.dart View 1 1 chunk +92 lines, -0 lines 4 comments Download
M test/protoc_options_test.dart View 2 chunks +6 lines, -19 lines 0 comments Download
A test/protos/dart_name.proto View 1 1 chunk +31 lines, -0 lines 0 comments Download
M test/protos/dart_options.proto View 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (2 generated)
skybrian
4 years, 6 months ago (2016-06-08 02:24:23 UTC) #2
frederikmutzel
lgtm Thank you!
4 years, 6 months ago (2016-06-08 11:33:58 UTC) #3
skybrian
I realized that there's not much error-checking around the dart_name option, so I wrote some ...
4 years, 6 months ago (2016-06-08 23:40:31 UTC) #4
frederikmutzel
Thanks for adding the tests :) https://codereview.chromium.org/2043913005/diff/20001/lib/names.dart File lib/names.dart (right): https://codereview.chromium.org/2043913005/diff/20001/lib/names.dart#newcode143 lib/names.dart:143: throw throw new ...
4 years, 6 months ago (2016-06-09 07:50:28 UTC) #5
Søren Gjesse
lgtm https://codereview.chromium.org/2043913005/diff/20001/test/names_test.dart File test/names_test.dart (right): https://codereview.chromium.org/2043913005/diff/20001/test/names_test.dart#newcode44 test/names_test.dart:44: expect(msg.getField(2), "one"); Also test the original first field ...
4 years, 6 months ago (2016-06-09 09:07:13 UTC) #6
skybrian
Committed patchset #2 (id:20001) manually as d72f7601eba02240620da0109ef9b8e2523254eb (presubmit successful).
4 years, 6 months ago (2016-06-09 19:09:10 UTC) #8
skybrian
4 years, 6 months ago (2016-06-09 19:10:47 UTC) #9
Message was sent while issue was closed.
https://codereview.chromium.org/2043913005/diff/20001/lib/names.dart
File lib/names.dart (right):

https://codereview.chromium.org/2043913005/diff/20001/lib/names.dart#newcode143
lib/names.dart:143: throw throw new DartNameOptionException(
On 2016/06/09 07:50:28, frederikmutzel wrote:
> double throw

Done.

https://codereview.chromium.org/2043913005/diff/20001/test/names_test.dart
File test/names_test.dart (right):

https://codereview.chromium.org/2043913005/diff/20001/test/names_test.dart#ne...
test/names_test.dart:44: expect(msg.getField(2), "one");
On 2016/06/09 09:07:13, Søren Gjesse wrote:
> Also test the original first field (called first_1 now?)

Done.

https://codereview.chromium.org/2043913005/diff/20001/test/names_test.dart#ne...
test/names_test.dart:50: ..field.addAll([stringField("first", 1, "hello
world"),]);
On 2016/06/09 07:50:28, frederikmutzel wrote:
> just add? (also below)

Done.

Powered by Google App Engine
This is Rietveld 408576698