Skip to content

Commit ce0e74a

Browse files
authored
Merge branch 'master' into update_package_analysis
2 parents e84b96a + d3f9ad1 commit ce0e74a

File tree

12 files changed

+27
-39
lines changed

12 files changed

+27
-39
lines changed

.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44
.packages
55
.pub
66
build/
7-
**/lib/generated/**
8-
packages
97
pubspec.lock
10-
benchmarks/out
118
doc/
129

1310
# `dart compile exe` outputs
1411
*.exe
1512

1613
# `dart compile js` outputs
17-
*.js*
14+
*.js
15+
*.js.deps
16+
*.js.map
1817

1918
# `dart compile wasm` outputs
2019
*.wasm

README.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
[![CI status](https://github.com/google/protobuf.dart/workflows/Dart%20CI/badge.svg)](https://github.com/google/protobuf.dart/actions?query=workflow%3A%22Dart%22+branch%3Amaster)
2-
31
## Protobuf support for Dart
42

53
[Protocol Buffers](https://developers.google.com/protocol-buffers) (protobuf)
64
are Google's language-neutral, platform-neutral, extensible mechanism for
75
serializing structured data.
86

97
This repository is home to packages related to
10-
[protobuf for Dart](https://pub.dev/documentation/protobuf/latest/).
8+
[protobuf support for Dart](https://pub.dev/documentation/protobuf/latest/).
119

12-
Package | Description | Published Version
13-
--- | --- | ---
14-
[protobuf](protobuf/) | A support library for the generated code | [![pub package](https://img.shields.io/pub/v/protobuf.svg)](https://pub.dev/packages/protobuf)
15-
[protoc_plugin](protoc_plugin/) | A Dart back-end for the protoc compiler | [![pub package](https://img.shields.io/pub/v/protoc_plugin.svg)](https://pub.dev/packages/protoc_plugin)
16-
[api_benchmark](api_benchmark/) | Benchmarking for various API calls |
17-
[query_benchmark](query_benchmark/) | Benchmark for encoding and decoding of a "real-world" protobuf |
10+
| Package | Description | Published Version |
11+
| --- | --- | --- |
12+
| [protobuf](protobuf/) | Runtime library for protocol buffers support. | [![pub package](https://img.shields.io/pub/v/protobuf.svg)](https://pub.dev/packages/protobuf) |
13+
| [protoc_plugin](protoc_plugin/) | A protobuf protoc compiler plugin used to generate Dart code. | [![pub package] |(https://img.shields.io/pub/v/protoc_plugin.svg)](https://pub.dev/packages/protoc_plugin)
14+
| [api_benchmark](api_benchmark/) | Benchmarking a number of different api calls. | |
15+
| [benchmarks](benchmarks/) | Benchmarks for various protobuf functions. | |
1816

1917
## Publishing automation
2018

api_benchmark/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib/generated/**

benchmarks/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib/generated/
2+
out/

benchmarks/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# BSD-style license that can be found in the LICENSE file.
44

55
name: protobuf_benchmarks
6-
description: Benchmarks various protobuf functions
6+
description: Benchmarks for various protobuf functions.
77
publish_to: none
88

99
environment:

protobuf/lib/src/protobuf/coded_buffer.dart

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ void _writeToCodedBufferWriter(_FieldSet fs, CodedBufferWriter out) {
3131

3232
void _mergeFromCodedBufferReader(BuilderInfo meta, _FieldSet fs,
3333
CodedBufferReader input, ExtensionRegistry registry) {
34-
ArgumentError.checkNotNull(registry);
3534
fs._ensureWritable();
3635
while (true) {
3736
final tag = input.readTag();

protobuf/lib/src/protobuf/extension.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Extension<T> extends FieldInfo<T> {
2222
protoName: protoName);
2323

2424
Extension.repeated(this.extendee, String name, int tagNumber, int fieldType,
25-
{CheckFunc<T>? check,
25+
{required CheckFunc<T> check,
2626
CreateBuilderFunc? subBuilder,
2727
ValueOfFunc? valueOf,
2828
List<ProtobufEnum>? enumValues,

protobuf/lib/src/protobuf/field_info.dart

+7-13
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,12 @@ class FieldInfo<T> {
128128
subBuilder = null;
129129

130130
FieldInfo.repeated(this.name, this.tagNumber, this.index, this.type,
131-
this.check, this.subBuilder,
131+
CheckFunc<T> this.check, this.subBuilder,
132132
{this.valueOf, this.enumValues, this.defaultEnumValue, String? protoName})
133-
: makeDefault = (() => PbList<T>(check: check!)),
134-
_protoName = protoName {
135-
ArgumentError.checkNotNull(name, 'name');
136-
ArgumentError.checkNotNull(tagNumber, 'tagNumber');
137-
assert(_isRepeated(type));
138-
assert(check != null);
139-
assert(!_isEnum(type) || valueOf != null);
140-
}
133+
: makeDefault = (() => PbList<T>(check: check)),
134+
_protoName = protoName,
135+
assert(_isRepeated(type)),
136+
assert(!_isEnum(type) || valueOf != null);
141137

142138
static MakeDefaultFunc? findMakeDefault(int type, dynamic defaultOrMaker) {
143139
if (defaultOrMaker == null) return PbFieldType._defaultForType(type);
@@ -276,13 +272,11 @@ class MapFieldInfo<K, V> extends FieldInfo<PbMap<K, V>?> {
276272
this.valueCreator,
277273
{ProtobufEnum? defaultEnumValue,
278274
String? protoName})
279-
: super(name, tagNumber, index, type,
275+
: assert(_isMapField(type)),
276+
super(name, tagNumber, index, type,
280277
defaultOrMaker: () => PbMap<K, V>(keyFieldType, valueFieldType),
281278
defaultEnumValue: defaultEnumValue,
282279
protoName: protoName) {
283-
ArgumentError.checkNotNull(name, 'name');
284-
ArgumentError.checkNotNull(tagNumber, 'tagNumber');
285-
assert(_isMapField(type));
286280
assert(!_isEnum(type) || valueOf != null);
287281
}
288282

protobuf/lib/src/protobuf/field_set.dart

-3
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,6 @@ class _FieldSet {
258258
/// Works for both extended and non-extended fields.
259259
/// Suitable for public API.
260260
void _setField(int tagNumber, Object value) {
261-
ArgumentError.checkNotNull(value, 'value');
262-
263261
final meta = _meta;
264262
final fi = _nonExtensionInfo(meta, tagNumber);
265263
if (fi == null) {
@@ -284,7 +282,6 @@ class _FieldSet {
284282
/// Works for both extended and non-extended fields.
285283
/// Suitable for decoders that do their own validation.
286284
void _setFieldUnchecked(BuilderInfo meta, FieldInfo fi, value) {
287-
ArgumentError.checkNotNull(fi, 'fi');
288285
assert(!fi.isRepeated);
289286
if (fi.index == null) {
290287
_ensureExtensions()

protobuf/lib/src/protobuf/generated_message.dart

-4
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ abstract class GeneratedMessage {
396396

397397
/// Sets the value of a non-repeated extension field to [value].
398398
void setExtension(Extension extension, Object value) {
399-
ArgumentError.checkNotNull(value, 'value');
400399
if (_isRepeated(extension.type)) {
401400
throw ArgumentError(_fieldSet._setFieldFailedMessage(
402401
extension, value, 'repeating field (use get + .add())'));
@@ -489,7 +488,6 @@ abstract class GeneratedMessage {
489488
/// For generated code only.
490489
/// @nodoc
491490
void $_setFloat(int index, double value) {
492-
ArgumentError.checkNotNull(value, 'value');
493491
if (!_isFloat32(value)) {
494492
_fieldSet._$check(index, value);
495493
}
@@ -503,7 +501,6 @@ abstract class GeneratedMessage {
503501
/// For generated code only.
504502
/// @nodoc
505503
void $_setSignedInt32(int index, int value) {
506-
ArgumentError.checkNotNull(value, 'value');
507504
if (!_isSigned32(value)) {
508505
_fieldSet._$check(index, value);
509506
}
@@ -513,7 +510,6 @@ abstract class GeneratedMessage {
513510
/// For generated code only.
514511
/// @nodoc
515512
void $_setUnsignedInt32(int index, int value) {
516-
ArgumentError.checkNotNull(value, 'value');
517513
if (!_isUnsigned32(value)) {
518514
_fieldSet._$check(index, value);
519515
}

protoc_plugin/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ benchmark/data/pubspec.link.lock
99
benchmark/data/hostname.txt
1010
benchmark/data/latest_vm.pb.json
1111
benchmark/lib/generated
12-
out
12+
out/

tool/setup.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
22

3-
wget -O protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip
3+
wget -O protoc.zip \
4+
https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip
45
unzip -d protoc protoc.zip
6+
57
if [[ -z "${GITHUB_ENV}" ]]; then
6-
# Local mono_repo presubmit run
8+
# Local run
79
export PATH=$PWD/protoc/bin:$PATH
810
else
911
# GitHub Actions

0 commit comments

Comments
 (0)