From 388929067af91baecd785050ca2768d66b05eda8 Mon Sep 17 00:00:00 2001 From: Jakob Andersen Date: Mon, 14 Aug 2017 14:10:12 +0200 Subject: [PATCH] Use real generic syntax instead of comment-based. (#89) Also update pubspec to support v2 dev SDKs. --- CHANGELOG.md | 5 + lib/protobuf_field.dart | 10 +- lib/src/dart_options.pb.dart | 8 +- lib/src/descriptor.pb.dart | 236 +++++++++++++++---------------- lib/src/plugin.pb.dart | 26 ++-- pubspec.yaml | 6 +- test/file_generator_test.dart | 12 +- test/message_generator_test.dart | 6 +- 8 files changed, 157 insertions(+), 152 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8268bc3..50841a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.7.5 - 2017-08-04 + +* Use real generic syntax instead of comment-based. +* Support 2.0.0 dev SDKs. + ## 0.7.4 - 2017-07-07 * Added call options to gRPC client stubs. diff --git a/lib/protobuf_field.dart b/lib/protobuf_field.dart index f7e3159..0238cfc 100644 --- a/lib/protobuf_field.dart +++ b/lib/protobuf_field.dart @@ -106,24 +106,24 @@ class ProtobufField { if (isRepeated) { if (baseType.isMessage || baseType.isGroup) { - return '..pp/*<$type>*/($number, $quotedName, $typeConstant,' + return '..pp<$type>($number, $quotedName, $typeConstant,' ' $type.$checkItem, $type.create)'; } else if (baseType.isEnum) { - return '..pp/*<$type>*/($number, $quotedName, $typeConstant,' + return '..pp<$type>($number, $quotedName, $typeConstant,' ' $type.$checkItem, null, $type.valueOf)'; } else { - return '..p/*<$type>*/($number, $quotedName, $typeConstant)'; + return '..p<$type>($number, $quotedName, $typeConstant)'; } } String makeDefault = generateDefaultFunction(package); if (baseType.isEnum) { String valueOf = '$type.valueOf'; - return '..e/*<$type>*/(' + return '..e<$type>(' '$number, $quotedName, $typeConstant, $makeDefault, $valueOf)'; } - String prefix = '..a/*<$type>*/($number, $quotedName, $typeConstant'; + String prefix = '..a<$type>($number, $quotedName, $typeConstant'; if (makeDefault == null) return prefix + ')'; if (baseType.isMessage || baseType.isGroup) { diff --git a/lib/src/dart_options.pb.dart b/lib/src/dart_options.pb.dart index 6b886eb..0f67d7a 100644 --- a/lib/src/dart_options.pb.dart +++ b/lib/src/dart_options.pb.dart @@ -12,9 +12,9 @@ import 'package:protobuf/protobuf.dart'; class DartMixin extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('DartMixin') - ..a/**/(1, 'name', PbFieldType.OS) - ..a/**/(2, 'importFrom', PbFieldType.OS) - ..a/**/(3, 'parent', PbFieldType.OS) + ..a(1, 'name', PbFieldType.OS) + ..a(2, 'importFrom', PbFieldType.OS) + ..a(3, 'parent', PbFieldType.OS) ..hasRequiredFields = false; DartMixin() : super(); @@ -66,7 +66,7 @@ class _ReadonlyDartMixin extends DartMixin with ReadonlyMessageMixin {} class Imports extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('Imports') - ..pp/**/( + ..pp( 1, 'mixins', PbFieldType.PM, DartMixin.$checkItem, DartMixin.create) ..hasRequiredFields = false; diff --git a/lib/src/descriptor.pb.dart b/lib/src/descriptor.pb.dart index b05e91a..9e0279a 100644 --- a/lib/src/descriptor.pb.dart +++ b/lib/src/descriptor.pb.dart @@ -17,7 +17,7 @@ export 'descriptor.pbenum.dart'; class FileDescriptorSet extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('FileDescriptorSet') - ..pp/**/(1, 'file', PbFieldType.PM, + ..pp(1, 'file', PbFieldType.PM, FileDescriptorProto.$checkItem, FileDescriptorProto.create); FileDescriptorSet() : super(); @@ -51,24 +51,24 @@ class _ReadonlyFileDescriptorSet extends FileDescriptorSet class FileDescriptorProto extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('FileDescriptorProto') - ..a/**/(1, 'name', PbFieldType.OS) - ..a/**/(2, 'package', PbFieldType.OS) - ..p/**/(3, 'dependency', PbFieldType.PS) - ..pp/**/(4, 'messageType', PbFieldType.PM, + ..a(1, 'name', PbFieldType.OS) + ..a(2, 'package', PbFieldType.OS) + ..p(3, 'dependency', PbFieldType.PS) + ..pp(4, 'messageType', PbFieldType.PM, DescriptorProto.$checkItem, DescriptorProto.create) - ..pp/**/(5, 'enumType', PbFieldType.PM, + ..pp(5, 'enumType', PbFieldType.PM, EnumDescriptorProto.$checkItem, EnumDescriptorProto.create) - ..pp/**/(6, 'service', PbFieldType.PM, + ..pp(6, 'service', PbFieldType.PM, ServiceDescriptorProto.$checkItem, ServiceDescriptorProto.create) - ..pp/**/(7, 'extension', PbFieldType.PM, + ..pp(7, 'extension', PbFieldType.PM, FieldDescriptorProto.$checkItem, FieldDescriptorProto.create) - ..a/**/(8, 'options', PbFieldType.OM, FileOptions.getDefault, + ..a(8, 'options', PbFieldType.OM, FileOptions.getDefault, FileOptions.create) - ..a/**/(9, 'sourceCodeInfo', PbFieldType.OM, + ..a(9, 'sourceCodeInfo', PbFieldType.OM, SourceCodeInfo.getDefault, SourceCodeInfo.create) - ..p/**/(10, 'publicDependency', PbFieldType.P3) - ..p/**/(11, 'weakDependency', PbFieldType.P3) - ..a/**/(12, 'syntax', PbFieldType.OS); + ..p(10, 'publicDependency', PbFieldType.P3) + ..p(11, 'weakDependency', PbFieldType.P3) + ..a(12, 'syntax', PbFieldType.OS); FileDescriptorProto() : super(); FileDescriptorProto.fromBuffer(List i, @@ -155,8 +155,8 @@ class _ReadonlyFileDescriptorProto extends FileDescriptorProto class DescriptorProto_ExtensionRange extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('DescriptorProto_ExtensionRange') - ..a/**/(1, 'start', PbFieldType.O3) - ..a/**/(2, 'end', PbFieldType.O3) + ..a(1, 'start', PbFieldType.O3) + ..a(2, 'end', PbFieldType.O3) ..hasRequiredFields = false; DescriptorProto_ExtensionRange() : super(); @@ -207,8 +207,8 @@ class _ReadonlyDescriptorProto_ExtensionRange class DescriptorProto_ReservedRange extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('DescriptorProto_ReservedRange') - ..a/**/(1, 'start', PbFieldType.O3) - ..a/**/(2, 'end', PbFieldType.O3) + ..a(1, 'start', PbFieldType.O3) + ..a(2, 'end', PbFieldType.O3) ..hasRequiredFields = false; DescriptorProto_ReservedRange() : super(); @@ -259,32 +259,32 @@ class _ReadonlyDescriptorProto_ReservedRange class DescriptorProto extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('DescriptorProto') - ..a/**/(1, 'name', PbFieldType.OS) - ..pp/**/(2, 'field', PbFieldType.PM, + ..a(1, 'name', PbFieldType.OS) + ..pp(2, 'field', PbFieldType.PM, FieldDescriptorProto.$checkItem, FieldDescriptorProto.create) - ..pp/**/(3, 'nestedType', PbFieldType.PM, + ..pp(3, 'nestedType', PbFieldType.PM, DescriptorProto.$checkItem, DescriptorProto.create) - ..pp/**/(4, 'enumType', PbFieldType.PM, + ..pp(4, 'enumType', PbFieldType.PM, EnumDescriptorProto.$checkItem, EnumDescriptorProto.create) - ..pp/**/( + ..pp( 5, 'extensionRange', PbFieldType.PM, DescriptorProto_ExtensionRange.$checkItem, DescriptorProto_ExtensionRange.create) - ..pp/**/(6, 'extension', PbFieldType.PM, + ..pp(6, 'extension', PbFieldType.PM, FieldDescriptorProto.$checkItem, FieldDescriptorProto.create) - ..a/**/(7, 'options', PbFieldType.OM, - MessageOptions.getDefault, MessageOptions.create) - ..pp/**/(8, 'oneofDecl', PbFieldType.PM, + ..a(7, 'options', PbFieldType.OM, MessageOptions.getDefault, + MessageOptions.create) + ..pp(8, 'oneofDecl', PbFieldType.PM, OneofDescriptorProto.$checkItem, OneofDescriptorProto.create) - ..pp/**/( + ..pp( 9, 'reservedRange', PbFieldType.PM, DescriptorProto_ReservedRange.$checkItem, DescriptorProto_ReservedRange.create) - ..p/**/(10, 'reservedName', PbFieldType.PS); + ..p(10, 'reservedName', PbFieldType.PS); DescriptorProto() : super(); DescriptorProto.fromBuffer(List i, @@ -347,27 +347,27 @@ class _ReadonlyDescriptorProto extends DescriptorProto class FieldDescriptorProto extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('FieldDescriptorProto') - ..a/**/(1, 'name', PbFieldType.OS) - ..a/**/(2, 'extendee', PbFieldType.OS) - ..a/**/(3, 'number', PbFieldType.O3) - ..e/**/( + ..a(1, 'name', PbFieldType.OS) + ..a(2, 'extendee', PbFieldType.OS) + ..a(3, 'number', PbFieldType.O3) + ..e( 4, 'label', PbFieldType.OE, FieldDescriptorProto_Label.LABEL_OPTIONAL, FieldDescriptorProto_Label.valueOf) - ..e/**/( + ..e( 5, 'type', PbFieldType.OE, FieldDescriptorProto_Type.TYPE_DOUBLE, FieldDescriptorProto_Type.valueOf) - ..a/**/(6, 'typeName', PbFieldType.OS) - ..a/**/(7, 'defaultValue', PbFieldType.OS) - ..a/**/(8, 'options', PbFieldType.OM, FieldOptions.getDefault, + ..a(6, 'typeName', PbFieldType.OS) + ..a(7, 'defaultValue', PbFieldType.OS) + ..a(8, 'options', PbFieldType.OM, FieldOptions.getDefault, FieldOptions.create) - ..a/**/(9, 'oneofIndex', PbFieldType.O3) - ..a/**/(10, 'jsonName', PbFieldType.OS); + ..a(9, 'oneofIndex', PbFieldType.O3) + ..a(10, 'jsonName', PbFieldType.OS); FieldDescriptorProto() : super(); FieldDescriptorProto.fromBuffer(List i, @@ -479,8 +479,8 @@ class _ReadonlyFieldDescriptorProto extends FieldDescriptorProto class OneofDescriptorProto extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('OneofDescriptorProto') - ..a/**/(1, 'name', PbFieldType.OS) - ..a/**/(2, 'options', PbFieldType.OM, OneofOptions.getDefault, + ..a(1, 'name', PbFieldType.OS) + ..a(2, 'options', PbFieldType.OM, OneofOptions.getDefault, OneofOptions.create); OneofDescriptorProto() : super(); @@ -529,10 +529,10 @@ class _ReadonlyOneofDescriptorProto extends OneofDescriptorProto class EnumDescriptorProto extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('EnumDescriptorProto') - ..a/**/(1, 'name', PbFieldType.OS) - ..pp/**/(2, 'value', PbFieldType.PM, + ..a(1, 'name', PbFieldType.OS) + ..pp(2, 'value', PbFieldType.PM, EnumValueDescriptorProto.$checkItem, EnumValueDescriptorProto.create) - ..a/**/(3, 'options', PbFieldType.OM, EnumOptions.getDefault, + ..a(3, 'options', PbFieldType.OM, EnumOptions.getDefault, EnumOptions.create); EnumDescriptorProto() : super(); @@ -583,9 +583,9 @@ class _ReadonlyEnumDescriptorProto extends EnumDescriptorProto class EnumValueDescriptorProto extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('EnumValueDescriptorProto') - ..a/**/(1, 'name', PbFieldType.OS) - ..a/**/(2, 'number', PbFieldType.O3) - ..a/**/(3, 'options', PbFieldType.OM, + ..a(1, 'name', PbFieldType.OS) + ..a(2, 'number', PbFieldType.O3) + ..a(3, 'options', PbFieldType.OM, EnumValueOptions.getDefault, EnumValueOptions.create); EnumValueDescriptorProto() : super(); @@ -643,11 +643,11 @@ class _ReadonlyEnumValueDescriptorProto extends EnumValueDescriptorProto class ServiceDescriptorProto extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('ServiceDescriptorProto') - ..a/**/(1, 'name', PbFieldType.OS) - ..pp/**/(2, 'method', PbFieldType.PM, + ..a(1, 'name', PbFieldType.OS) + ..pp(2, 'method', PbFieldType.PM, MethodDescriptorProto.$checkItem, MethodDescriptorProto.create) - ..a/**/(3, 'options', PbFieldType.OM, - ServiceOptions.getDefault, ServiceOptions.create); + ..a(3, 'options', PbFieldType.OM, ServiceOptions.getDefault, + ServiceOptions.create); ServiceDescriptorProto() : super(); ServiceDescriptorProto.fromBuffer(List i, @@ -698,13 +698,13 @@ class _ReadonlyServiceDescriptorProto extends ServiceDescriptorProto class MethodDescriptorProto extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('MethodDescriptorProto') - ..a/**/(1, 'name', PbFieldType.OS) - ..a/**/(2, 'inputType', PbFieldType.OS) - ..a/**/(3, 'outputType', PbFieldType.OS) - ..a/**/(4, 'options', PbFieldType.OM, - MethodOptions.getDefault, MethodOptions.create) - ..a/**/(5, 'clientStreaming', PbFieldType.OB) - ..a/**/(6, 'serverStreaming', PbFieldType.OB); + ..a(1, 'name', PbFieldType.OS) + ..a(2, 'inputType', PbFieldType.OS) + ..a(3, 'outputType', PbFieldType.OS) + ..a(4, 'options', PbFieldType.OM, MethodOptions.getDefault, + MethodOptions.create) + ..a(5, 'clientStreaming', PbFieldType.OB) + ..a(6, 'serverStreaming', PbFieldType.OB); MethodDescriptorProto() : super(); MethodDescriptorProto.fromBuffer(List i, @@ -785,25 +785,25 @@ class _ReadonlyMethodDescriptorProto extends MethodDescriptorProto class FileOptions extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('FileOptions') - ..a/**/(1, 'javaPackage', PbFieldType.OS) - ..a/**/(8, 'javaOuterClassname', PbFieldType.OS) - ..e/**/(9, 'optimizeFor', PbFieldType.OE, + ..a(1, 'javaPackage', PbFieldType.OS) + ..a(8, 'javaOuterClassname', PbFieldType.OS) + ..e(9, 'optimizeFor', PbFieldType.OE, FileOptions_OptimizeMode.SPEED, FileOptions_OptimizeMode.valueOf) - ..a/**/(10, 'javaMultipleFiles', PbFieldType.OB) - ..a/**/(11, 'goPackage', PbFieldType.OS) - ..a/**/(16, 'ccGenericServices', PbFieldType.OB) - ..a/**/(17, 'javaGenericServices', PbFieldType.OB) - ..a/**/(18, 'pyGenericServices', PbFieldType.OB) - ..a/**/(20, 'javaGenerateEqualsAndHash', PbFieldType.OB) - ..a/**/(23, 'deprecated', PbFieldType.OB) - ..a/**/(27, 'javaStringCheckUtf8', PbFieldType.OB) - ..a/**/(31, 'ccEnableArenas', PbFieldType.OB) - ..a/**/(36, 'objcClassPrefix', PbFieldType.OS) - ..a/**/(37, 'csharpNamespace', PbFieldType.OS) - ..a/**/(39, 'swiftPrefix', PbFieldType.OS) - ..a/**/(40, 'phpClassPrefix', PbFieldType.OS) - ..a/**/(41, 'phpNamespace', PbFieldType.OS) - ..pp/**/(999, 'uninterpretedOption', PbFieldType.PM, + ..a(10, 'javaMultipleFiles', PbFieldType.OB) + ..a(11, 'goPackage', PbFieldType.OS) + ..a(16, 'ccGenericServices', PbFieldType.OB) + ..a(17, 'javaGenericServices', PbFieldType.OB) + ..a(18, 'pyGenericServices', PbFieldType.OB) + ..a(20, 'javaGenerateEqualsAndHash', PbFieldType.OB) + ..a(23, 'deprecated', PbFieldType.OB) + ..a(27, 'javaStringCheckUtf8', PbFieldType.OB) + ..a(31, 'ccEnableArenas', PbFieldType.OB) + ..a(36, 'objcClassPrefix', PbFieldType.OS) + ..a(37, 'csharpNamespace', PbFieldType.OS) + ..a(39, 'swiftPrefix', PbFieldType.OS) + ..a(40, 'phpClassPrefix', PbFieldType.OS) + ..a(41, 'phpNamespace', PbFieldType.OS) + ..pp(999, 'uninterpretedOption', PbFieldType.PM, UninterpretedOption.$checkItem, UninterpretedOption.create) ..hasExtensions = true; @@ -971,11 +971,11 @@ class _ReadonlyFileOptions extends FileOptions with ReadonlyMessageMixin {} class MessageOptions extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('MessageOptions') - ..a/**/(1, 'messageSetWireFormat', PbFieldType.OB) - ..a/**/(2, 'noStandardDescriptorAccessor', PbFieldType.OB) - ..a/**/(3, 'deprecated', PbFieldType.OB) - ..a/**/(7, 'mapEntry', PbFieldType.OB) - ..pp/**/(999, 'uninterpretedOption', PbFieldType.PM, + ..a(1, 'messageSetWireFormat', PbFieldType.OB) + ..a(2, 'noStandardDescriptorAccessor', PbFieldType.OB) + ..a(3, 'deprecated', PbFieldType.OB) + ..a(7, 'mapEntry', PbFieldType.OB) + ..pp(999, 'uninterpretedOption', PbFieldType.PM, UninterpretedOption.$checkItem, UninterpretedOption.create) ..hasExtensions = true; @@ -1042,15 +1042,15 @@ class _ReadonlyMessageOptions extends MessageOptions with ReadonlyMessageMixin { class FieldOptions extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('FieldOptions') - ..e/**/(1, 'ctype', PbFieldType.OE, + ..e(1, 'ctype', PbFieldType.OE, FieldOptions_CType.STRING, FieldOptions_CType.valueOf) - ..a/**/(2, 'packed', PbFieldType.OB) - ..a/**/(3, 'deprecated', PbFieldType.OB) - ..a/**/(5, 'lazy', PbFieldType.OB) - ..e/**/(6, 'jstype', PbFieldType.OE, + ..a(2, 'packed', PbFieldType.OB) + ..a(3, 'deprecated', PbFieldType.OB) + ..a(5, 'lazy', PbFieldType.OB) + ..e(6, 'jstype', PbFieldType.OE, FieldOptions_JSType.JS_NORMAL, FieldOptions_JSType.valueOf) - ..a/**/(10, 'weak', PbFieldType.OB) - ..pp/**/(999, 'uninterpretedOption', PbFieldType.PM, + ..a(10, 'weak', PbFieldType.OB) + ..pp(999, 'uninterpretedOption', PbFieldType.PM, UninterpretedOption.$checkItem, UninterpretedOption.create) ..hasExtensions = true; @@ -1131,7 +1131,7 @@ class _ReadonlyFieldOptions extends FieldOptions with ReadonlyMessageMixin {} class OneofOptions extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('OneofOptions') - ..pp/**/(999, 'uninterpretedOption', PbFieldType.PM, + ..pp(999, 'uninterpretedOption', PbFieldType.PM, UninterpretedOption.$checkItem, UninterpretedOption.create) ..hasExtensions = true; @@ -1164,9 +1164,9 @@ class _ReadonlyOneofOptions extends OneofOptions with ReadonlyMessageMixin {} class EnumOptions extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('EnumOptions') - ..a/**/(2, 'allowAlias', PbFieldType.OB) - ..a/**/(3, 'deprecated', PbFieldType.OB) - ..pp/**/(999, 'uninterpretedOption', PbFieldType.PM, + ..a(2, 'allowAlias', PbFieldType.OB) + ..a(3, 'deprecated', PbFieldType.OB) + ..pp(999, 'uninterpretedOption', PbFieldType.PM, UninterpretedOption.$checkItem, UninterpretedOption.create) ..hasExtensions = true; @@ -1214,8 +1214,8 @@ class _ReadonlyEnumOptions extends EnumOptions with ReadonlyMessageMixin {} class EnumValueOptions extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('EnumValueOptions') - ..a/**/(1, 'deprecated', PbFieldType.OB) - ..pp/**/(999, 'uninterpretedOption', PbFieldType.PM, + ..a(1, 'deprecated', PbFieldType.OB) + ..pp(999, 'uninterpretedOption', PbFieldType.PM, UninterpretedOption.$checkItem, UninterpretedOption.create) ..hasExtensions = true; @@ -1258,8 +1258,8 @@ class _ReadonlyEnumValueOptions extends EnumValueOptions class ServiceOptions extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('ServiceOptions') - ..a/**/(33, 'deprecated', PbFieldType.OB) - ..pp/**/(999, 'uninterpretedOption', PbFieldType.PM, + ..a(33, 'deprecated', PbFieldType.OB) + ..pp(999, 'uninterpretedOption', PbFieldType.PM, UninterpretedOption.$checkItem, UninterpretedOption.create) ..hasExtensions = true; @@ -1302,14 +1302,14 @@ class _ReadonlyServiceOptions extends ServiceOptions with ReadonlyMessageMixin { class MethodOptions extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('MethodOptions') - ..a/**/(33, 'deprecated', PbFieldType.OB) - ..e/**/( + ..a(33, 'deprecated', PbFieldType.OB) + ..e( 34, 'idempotencyLevel', PbFieldType.OE, MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN, MethodOptions_IdempotencyLevel.valueOf) - ..pp/**/(999, 'uninterpretedOption', PbFieldType.PM, + ..pp(999, 'uninterpretedOption', PbFieldType.PM, UninterpretedOption.$checkItem, UninterpretedOption.create) ..hasExtensions = true; @@ -1358,8 +1358,8 @@ class _ReadonlyMethodOptions extends MethodOptions with ReadonlyMessageMixin {} class UninterpretedOption_NamePart extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('UninterpretedOption_NamePart') - ..a/**/(1, 'namePart', PbFieldType.QS) - ..a/**/(2, 'isExtension', PbFieldType.QB); + ..a(1, 'namePart', PbFieldType.QS) + ..a(2, 'isExtension', PbFieldType.QB); UninterpretedOption_NamePart() : super(); UninterpretedOption_NamePart.fromBuffer(List i, @@ -1409,18 +1409,18 @@ class _ReadonlyUninterpretedOption_NamePart extends UninterpretedOption_NamePart class UninterpretedOption extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('UninterpretedOption') - ..pp/**/( + ..pp( 2, 'name', PbFieldType.PM, UninterpretedOption_NamePart.$checkItem, UninterpretedOption_NamePart.create) - ..a/**/(3, 'identifierValue', PbFieldType.OS) - ..a/**/(4, 'positiveIntValue', PbFieldType.OU6, Int64.ZERO) - ..a/**/(5, 'negativeIntValue', PbFieldType.O6, Int64.ZERO) - ..a/**/(6, 'doubleValue', PbFieldType.OD) - ..a/*>*/(7, 'stringValue', PbFieldType.OY) - ..a/**/(8, 'aggregateValue', PbFieldType.OS); + ..a(3, 'identifierValue', PbFieldType.OS) + ..a(4, 'positiveIntValue', PbFieldType.OU6, Int64.ZERO) + ..a(5, 'negativeIntValue', PbFieldType.O6, Int64.ZERO) + ..a(6, 'doubleValue', PbFieldType.OD) + ..a>(7, 'stringValue', PbFieldType.OY) + ..a(8, 'aggregateValue', PbFieldType.OS); UninterpretedOption() : super(); UninterpretedOption.fromBuffer(List i, @@ -1502,11 +1502,11 @@ class _ReadonlyUninterpretedOption extends UninterpretedOption class SourceCodeInfo_Location extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('SourceCodeInfo_Location') - ..p/**/(1, 'path', PbFieldType.K3) - ..p/**/(2, 'span', PbFieldType.K3) - ..a/**/(3, 'leadingComments', PbFieldType.OS) - ..a/**/(4, 'trailingComments', PbFieldType.OS) - ..p/**/(6, 'leadingDetachedComments', PbFieldType.PS) + ..p(1, 'path', PbFieldType.K3) + ..p(2, 'span', PbFieldType.K3) + ..a(3, 'leadingComments', PbFieldType.OS) + ..a(4, 'trailingComments', PbFieldType.OS) + ..p(6, 'leadingDetachedComments', PbFieldType.PS) ..hasRequiredFields = false; SourceCodeInfo_Location() : super(); @@ -1562,7 +1562,7 @@ class _ReadonlySourceCodeInfo_Location extends SourceCodeInfo_Location class SourceCodeInfo extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('SourceCodeInfo') - ..pp/**/(1, 'location', PbFieldType.PM, + ..pp(1, 'location', PbFieldType.PM, SourceCodeInfo_Location.$checkItem, SourceCodeInfo_Location.create) ..hasRequiredFields = false; @@ -1597,10 +1597,10 @@ class _ReadonlySourceCodeInfo extends SourceCodeInfo with ReadonlyMessageMixin { class GeneratedCodeInfo_Annotation extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('GeneratedCodeInfo_Annotation') - ..p/**/(1, 'path', PbFieldType.K3) - ..a/**/(2, 'sourceFile', PbFieldType.OS) - ..a/**/(3, 'begin', PbFieldType.O3) - ..a/**/(4, 'end', PbFieldType.O3) + ..p(1, 'path', PbFieldType.K3) + ..a(2, 'sourceFile', PbFieldType.OS) + ..a(3, 'begin', PbFieldType.O3) + ..a(4, 'end', PbFieldType.O3) ..hasRequiredFields = false; GeneratedCodeInfo_Annotation() : super(); @@ -1661,7 +1661,7 @@ class _ReadonlyGeneratedCodeInfo_Annotation extends GeneratedCodeInfo_Annotation class GeneratedCodeInfo extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('GeneratedCodeInfo') - ..pp/**/( + ..pp( 1, 'annotation', PbFieldType.PM, diff --git a/lib/src/plugin.pb.dart b/lib/src/plugin.pb.dart index 86d7e81..af5a678 100644 --- a/lib/src/plugin.pb.dart +++ b/lib/src/plugin.pb.dart @@ -14,10 +14,10 @@ import 'descriptor.pb.dart' as google$protobuf; class Version extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('Version') - ..a/**/(1, 'major', PbFieldType.O3) - ..a/**/(2, 'minor', PbFieldType.O3) - ..a/**/(3, 'patch', PbFieldType.O3) - ..a/**/(4, 'suffix', PbFieldType.OS) + ..a(1, 'major', PbFieldType.O3) + ..a(2, 'minor', PbFieldType.O3) + ..a(3, 'patch', PbFieldType.O3) + ..a(4, 'suffix', PbFieldType.OS) ..hasRequiredFields = false; Version() : super(); @@ -77,11 +77,11 @@ class _ReadonlyVersion extends Version with ReadonlyMessageMixin {} class CodeGeneratorRequest extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('CodeGeneratorRequest') - ..p/**/(1, 'fileToGenerate', PbFieldType.PS) - ..a/**/(2, 'parameter', PbFieldType.OS) - ..a/**/(3, 'compilerVersion', PbFieldType.OM, Version.getDefault, + ..p(1, 'fileToGenerate', PbFieldType.PS) + ..a(2, 'parameter', PbFieldType.OS) + ..a(3, 'compilerVersion', PbFieldType.OM, Version.getDefault, Version.create) - ..pp/**/( + ..pp( 15, 'protoFile', PbFieldType.PM, @@ -138,9 +138,9 @@ class _ReadonlyCodeGeneratorRequest extends CodeGeneratorRequest class CodeGeneratorResponse_File extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('CodeGeneratorResponse_File') - ..a/**/(1, 'name', PbFieldType.OS) - ..a/**/(2, 'insertionPoint', PbFieldType.OS) - ..a/**/(15, 'content', PbFieldType.OS) + ..a(1, 'name', PbFieldType.OS) + ..a(2, 'insertionPoint', PbFieldType.OS) + ..a(15, 'content', PbFieldType.OS) ..hasRequiredFields = false; CodeGeneratorResponse_File() : super(); @@ -199,8 +199,8 @@ class _ReadonlyCodeGeneratorResponse_File extends CodeGeneratorResponse_File class CodeGeneratorResponse extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('CodeGeneratorResponse') - ..a/**/(1, 'error', PbFieldType.OS) - ..pp/**/( + ..a(1, 'error', PbFieldType.OS) + ..pp( 15, 'file', PbFieldType.PM, diff --git a/pubspec.yaml b/pubspec.yaml index d83ba07..7b64882 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,14 +1,14 @@ name: protoc_plugin -version: 0.7.4 +version: 0.7.5 author: Dart Team description: Protoc compiler plugin to generate Dart code homepage: https://github.com/dart-lang/dart-protoc-plugin environment: - sdk: '>=1.13.0 <2.0.0' + sdk: '>=1.21.0 <2.0.0-dev.infinity' dependencies: fixnum: ^0.10.5 path: ^1.0.0 - protobuf: ^0.5.4 + protobuf: ^0.5.5 dart_style: ^1.0.6 dev_dependencies: browser: any diff --git a/test/file_generator_test.dart b/test/file_generator_test.dart index 8afe19b..3b43215 100644 --- a/test/file_generator_test.dart +++ b/test/file_generator_test.dart @@ -87,9 +87,9 @@ import 'package:protobuf/protobuf.dart'; class PhoneNumber extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('PhoneNumber') - ..a/**/(1, 'number', PbFieldType.QS) - ..a/**/(2, 'type', PbFieldType.O3) - ..a/**/(3, 'name', PbFieldType.OS, '\$') + ..a(1, 'number', PbFieldType.QS) + ..a(2, 'type', PbFieldType.O3) + ..a(3, 'name', PbFieldType.OS, '\$') ; PhoneNumber() : super(); @@ -693,9 +693,9 @@ import 'package2.pb.dart' as p2; class M extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('M') - ..a/**/(1, 'm', PbFieldType.OM, M.getDefault, M.create) - ..a/**/(2, 'm1', PbFieldType.OM, p1.M.getDefault, p1.M.create) - ..a/**/(3, 'm2', PbFieldType.OM, p2.M.getDefault, p2.M.create) + ..a(1, 'm', PbFieldType.OM, M.getDefault, M.create) + ..a(2, 'm1', PbFieldType.OM, p1.M.getDefault, p1.M.create) + ..a(3, 'm2', PbFieldType.OM, p2.M.getDefault, p2.M.create) ..hasRequiredFields = false ; diff --git a/test/message_generator_test.dart b/test/message_generator_test.dart index 7f35be9..5f0d570 100755 --- a/test/message_generator_test.dart +++ b/test/message_generator_test.dart @@ -43,9 +43,9 @@ class PhoneNumber_PhoneType extends ProtobufEnum { String expected = r''' class PhoneNumber extends GeneratedMessage { static final BuilderInfo _i = new BuilderInfo('PhoneNumber') - ..a/**/(1, 'number', PbFieldType.QS) - ..e/**/(2, 'type', PbFieldType.OE, PhoneNumber_PhoneType.MOBILE, PhoneNumber_PhoneType.valueOf) - ..a/**/(3, 'name', PbFieldType.OS, '\$') + ..a(1, 'number', PbFieldType.QS) + ..e(2, 'type', PbFieldType.OE, PhoneNumber_PhoneType.MOBILE, PhoneNumber_PhoneType.valueOf) + ..a(3, 'name', PbFieldType.OS, '\$') ; PhoneNumber() : super();