Skip to content

Update from Upstream Master #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
aece2a4
Typo Correction in README.md (#695)
Curious-x Apr 15, 2024
b05fafe
Add Health workflow (#699)
mosuem Apr 15, 2024
bb8b6e5
Make protobuf generated imports absolute (#696)
mosuem Apr 19, 2024
bdbe5f5
Fix issue 669 (#693)
RubenGarcia Apr 22, 2024
078fd23
Remove generated `StatusCode` (#703)
mosuem Apr 25, 2024
0d02e43
Remove dependency on `package:archive` (#707)
mosuem May 6, 2024
9f65399
Move `codec.dart` to former place (#713)
mosuem May 17, 2024
6586b74
Add `topics` to `pubspec.yaml` (#712)
szakarias May 21, 2024
1495453
Bump dart-lang/setup-dart from 1.6.2 to 1.6.4
dependabot[bot] May 21, 2024
4e65d4b
---
dependabot[bot] May 21, 2024
ebb7368
Bump lints from 3.0.0 to 4.0.0
dependabot[bot] May 22, 2024
52023d4
code fixes
kevmoo May 28, 2024
dee1b2b
Update pubspec.yaml
kevmoo May 30, 2024
4aa4c8c
Bump actions/checkout from 4.1.6 to 4.1.7 (#719)
dependabot[bot] Jul 1, 2024
bf8bbde
Bump dart-lang/setup-dart from 1.6.4 to 1.6.5 (#720)
dependabot[bot] Jul 1, 2024
b999b64
feat: fix hang that occurs when hot restarting (#718)
galenwarren Jul 17, 2024
c18e185
Fix status badge (#726)
kevmoo Jul 24, 2024
4f6fe9b
fix: fix headers not completing when call is terminated (#728)
c-lucera-pvotal Aug 28, 2024
38ca626
Use `Map.of` instead of `Map.from` in grpc client. (#724)
lrhn Sep 2, 2024
8177633
Small fixes (#732)
mosuem Sep 6, 2024
071ebc5
fix: keep alive timeout finishes transport instead of connection shut…
steffenhaak Sep 6, 2024
f8bbdce
ignore unreachable_switch_default in weird switch case (#737)
kevmoo Sep 24, 2024
04ba68e
Rev package:lints (#740)
mosuem Oct 1, 2024
c063010
Bump actions/checkout from 4.1.7 to 4.2.0 (#741)
dependabot[bot] Oct 1, 2024
f61b9a3
Bump actions/checkout from 4.2.0 to 4.2.2 (#744)
dependabot[bot] Nov 4, 2024
6676c20
Bump dart-lang/setup-dart from 1.6.5 to 1.7.0 (#746)
dependabot[bot] Dec 16, 2024
3e94fec
Update health.yaml (#753)
mosuem Dec 17, 2024
9a9c017
Bump vm_service from 14.3.1 to 15.0.0 (#751)
dependabot[bot] Dec 17, 2024
c9d6286
Merge branch 'upstream-master' into update-from-upstream
tsavo-at-pieces Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: [3.0.0, dev]
sdk: [3.5, dev]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- name: Report version
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [3.0.0, dev]
sdk: [3.5, dev]
platform: [vm, chrome]
exclude:
# We only run Chrome tests on Linux. No need to run them
Expand All @@ -70,8 +70,8 @@ jobs:
- os: macos-latest
platform: chrome
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- name: Report version
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Health
on:
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
health:
uses: dart-lang/ecosystem/.github/workflows/health.yaml@main
with:
checks: "changelog,do-not-submit,breaking,coverage,leaking"
ignore_coverage: "example/**,interop/**"
permissions:
pull-requests: write
17 changes: 17 additions & 0 deletions .github/workflows/post_summaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Comment on the pull request

on:
# Trigger this workflow after the Health workflow completes. This workflow will have permissions to
# do things like create comments on the PR, even if the original workflow couldn't.
workflow_run:
workflows:
- Health
- Publish
types:
- completed

jobs:
upload:
uses: dart-lang/ecosystem/.github/workflows/post_summaries.yaml@main
permissions:
pull-requests: write
27 changes: 24 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 4.0.2-wip

* Internal optimization to client code.
* Small fixes, such as ports in testing and enabling `timeline_test.dart`.
* When the keep alive manager runs into a timeout, it will finish the transport instead of closing
the connection, as defined in the gRPC spec.
* Upgrade to `package:lints` version 5.0.0 and Dart SDK version 3.5.0.
* Upgrade `example/grpc-web` code.

## 4.0.1

* Fix header and trailing not completing if the call is terminated. Fixes [#727](https://github.com/grpc/grpc-dart/issues/727)

## 4.0.0

* Set compressed flag correctly for grpc-encoding = identity. Fixes [#669](https://github.com/grpc/grpc-dart/issues/669) (https://github.com/grpc/grpc-dart/pull/693)
* Remove generated status codes.
* Remove dependency on `package:archive`.
* Move `codec.dart`.
* Work around hang during Flutter hot restart by adding default case handler in _GrpcWebConversionSink.add.

## 3.2.4

* Forward internal `GrpcError` on when throwing while sending a request.
Expand All @@ -19,19 +40,19 @@

## 3.2.1

* `package:http` now supports more versions: `>=0.13.0 <2.0.0`.
* `package:http` now supports more versions: `>=0.13.0 <2.0.0`.
* `package:protobuf` new supports more versions: `>=2.0.0 <4.0.0`.

## 3.2.0

* `ChannelOptions` now exposes `connectTimeout`, which is used on the
* `ChannelOptions` now exposes `connectTimeout`, which is used on the
socket connect. This is used to specify the maximum allowed time to wait
for a connection to be established. If `connectTime` is longer than the system
level timeout duration, a timeout may occur sooner than specified in
`connectTimeout`. On timeout, a `SocketException` is thrown.
* Require Dart 2.17 or greater.
* Fix issue [#51](https://github.com/grpc/grpc-dart/issues/51), add support for custom error handling.
* Expose client IP address to server
* Expose client IP address to server
* Add a `channelShutdownHandler` argument to `ClientChannel` and the subclasses.
This callback can be used to react to channel shutdown or termination.
* Export the `Code` protobuf enum from the `grpc.dart` library.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
The [Dart](https://www.dart.dev/) implementation of
[gRPC](https://grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first.

[![CI status](https://github.com/grpc/grpc-dart/workflows/Dart/badge.svg)](https://github.com/grpc/grpc-dart/actions?query=workflow%3A%22Dart%22+branch%3Amaster)
[![Dart](https://github.com/grpc/grpc-dart/actions/workflows/dart.yml/badge.svg)](https://github.com/grpc/grpc-dart/actions/workflows/dart.yml)
[![pub package](https://img.shields.io/pub/v/grpc.svg)](https://pub.dev/packages/grpc)


## Learn more

- [Quick Start](https://grpc.io/docs/languages/dart/quickstart) - get an app running in minutes
- [Examples](example)
- [Examples](https://github.com/grpc/grpc-dart/tree/master/example)
- [API reference](https://grpc.io/docs/languages/dart/api)

For complete documentation, see [Dart gRPC](https://grpc.io/docs/languages/dart).
Expand Down
22 changes: 12 additions & 10 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ analyzer:

linter:
rules:
- always_declare_return_types
- cancel_subscriptions
- close_sinks
- directives_ordering
- omit_local_variable_types
- prefer_final_locals
- prefer_single_quotes
- test_types_in_equals
- use_super_parameters
- prefer_relative_imports
#true
always_declare_return_types: true
cancel_subscriptions: true
close_sinks: true
directives_ordering: true
omit_local_variable_types: true
prefer_final_locals: true
prefer_single_quotes: true
test_types_in_equals: true
prefer_relative_imports: true
#false
unintended_html_in_doc_comment: false
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Four code examples are available:

1. [helloworld](https://github.com/grpc/grpc-dart/tree/master/example/helloworld):
A demonstration of using the Dart gRPC library to perform unary RPs.
A demonstration of using the Dart gRPC library to perform unary RPCs.

1. [googleapis](https://github.com/grpc/grpc-dart/tree/master/example/googleapis):
A demonstration of using the Dart gRPC library to communicate with Google APIs.
Expand Down
15 changes: 15 additions & 0 deletions example/grpc-web/lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Copyright (c) 2024, the gRPC project authors. Please see the AUTHORS file
// for details. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'dart:async';
import 'dart:html';

Expand Down
8 changes: 4 additions & 4 deletions example/grpc-web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ description: Dart gRPC-Web sample client
publish_to: none

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ^3.5.0

dependencies:
grpc:
path: ../../
protobuf: ^3.0.0

dev_dependencies:
build_runner: ^2.0.0
build_web_compilers: '>3.0.0 <5.0.0'
lints: ^2.0.0
build_runner: ^2.4.13
build_web_compilers: ^4.0.11
lints: ^5.0.0
2 changes: 1 addition & 1 deletion example/helloworld/bin/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/// Dart implementation of the gRPC helloworld.Greeter client.
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';

/// Dart implementation of the gRPC helloworld.Greeter client.
Future<void> main(List<String> args) async {
final channel = ClientChannel(
'localhost',
Expand Down
2 changes: 1 addition & 1 deletion example/helloworld/bin/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/// Dart implementation of the gRPC helloworld.Greeter server.
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';

/// Dart implementation of the gRPC helloworld.Greeter server.
class GreeterService extends GreeterServiceBase {
@override
Future<HelloReply> sayHello(ServiceCall call, HelloRequest request) async {
Expand Down
2 changes: 1 addition & 1 deletion example/helloworld/bin/unix_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/// Dart implementation of the gRPC helloworld.Greeter client.
import 'dart:io';

import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';

/// Dart implementation of the gRPC helloworld.Greeter client.
Future<void> main(List<String> args) async {
final udsAddress =
InternetAddress('localhost', type: InternetAddressType.unix);
Expand Down
2 changes: 1 addition & 1 deletion example/helloworld/bin/unix_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/// Dart implementation of the gRPC helloworld.Greeter server.
import 'dart:io';

import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';

/// Dart implementation of the gRPC helloworld.Greeter server.
class GreeterService extends GreeterServiceBase {
@override
Future<HelloReply> sayHello(ServiceCall call, HelloRequest request) async {
Expand Down
4 changes: 2 additions & 2 deletions interop/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class Tester {
final receivedBytes = response.payload.body.length;
if (receivedBytes != 314159) {
throw 'Response payload mismatch. Expected 314159 bytes, '
'got ${receivedBytes}.';
'got $receivedBytes.';
}
}

Expand Down Expand Up @@ -869,7 +869,7 @@ class Tester {
final receivedBytes = response.payload.body.length;
if (receivedBytes != 314159) {
throw 'Response payload mismatch. Expected 314159 bytes, '
'got ${receivedBytes}.';
'got $receivedBytes.';
}
return response;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/grpc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// ignore: dangling_library_doc_comments
/// Status detail types and error codes
export 'package:grpc/src/generated/google/rpc/error_details.pb.dart';

export 'src/auth/auth.dart' show BaseAuthenticator;
export 'src/auth/auth_io.dart'
show
Expand All @@ -39,10 +43,6 @@ export 'src/client/options.dart'
export 'src/client/proxy.dart' show Proxy;
export 'src/client/transport/http2_credentials.dart'
show BadCertificateHandler, allowBadCertificates, ChannelCredentials;

/// Status detail types and error codes
export 'src/generated/google/rpc/code.pbenum.dart';
export 'src/generated/google/rpc/error_details.pb.dart';
export 'src/server/call.dart' show ServiceCall;
export 'src/server/interceptor.dart' show Interceptor;
export 'src/server/server.dart'
Expand Down
2 changes: 1 addition & 1 deletion lib/service_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// Exports the minimum api to define server and client stubs.
///
/// Mainly intended to be imported by generated code.
library service_api;
library;

export 'src/client/call.dart' show CallOptions, MetadataProvider;
export 'src/client/channel.dart' show ClientChannel;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/auth/auth_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class _CredentialsRefreshingAuthenticator extends HttpBasedAuthenticator {
await super.authenticate(metadata, uri);
if (_quotaProject != null) {
// https://cloud.google.com/apis/docs/system-parameters#definitions
metadata['X-Goog-User-Project'] = _quotaProject!;
metadata['X-Goog-User-Project'] = _quotaProject;
}
}

Expand Down
16 changes: 11 additions & 5 deletions lib/src/client/call.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ class CallOptions {

CallOptions mergedWith(CallOptions? other) {
if (other == null) return this;
final mergedMetadata = Map.from(metadata)..addAll(other.metadata);
final mergedMetadata = Map.of(metadata)..addAll(other.metadata);
final mergedTimeout = other.timeout ?? timeout;
final mergedProviders = List.from(metadataProviders)
final mergedProviders = List.of(metadataProviders)
..addAll(other.metadataProviders);
final mergedCompression = other.compression ?? compression;
return CallOptions._(
Expand Down Expand Up @@ -146,9 +146,9 @@ class WebCallOptions extends CallOptions {
CallOptions mergedWith(CallOptions? other) {
if (other == null) return this;

final mergedMetadata = Map.from(metadata)..addAll(other.metadata);
final mergedMetadata = Map.of(metadata)..addAll(other.metadata);
final mergedTimeout = other.timeout ?? timeout;
final mergedProviders = List.from(metadataProviders)
final mergedProviders = List.of(metadataProviders)
..addAll(other.metadataProviders);

if (other is! WebCallOptions) {
Expand Down Expand Up @@ -241,7 +241,7 @@ class ClientCall<Q, R> implements Response {
if (options.metadataProviders.isEmpty) {
_sendRequest(connection, _sanitizeMetadata(options.metadata));
} else {
final metadata = Map<String, String>.from(options.metadata);
final metadata = Map<String, String>.of(options.metadata);
Future.forEach(
options.metadataProviders,
(MetadataProvider provider) => provider(metadata,
Expand Down Expand Up @@ -483,6 +483,12 @@ class ClientCall<Q, R> implements Response {
if (_responseSubscription != null) {
futures.add(_responseSubscription!.cancel());
}
if (!_headers.isCompleted) {
_headers.complete({});
}
if (!_trailers.isCompleted) {
_trailers.complete({});
}
await Future.wait(futures);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/client/http2_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Http2ClientConnection implements connection.ClientConnection {
transport.ping();
}
},
onPingTimeout: () => shutdown(),
onPingTimeout: () => transport.finish(),
);
transport.onFrameReceived
.listen((_) => keepAliveManager?.onFrameReceived());
Expand Down
2 changes: 1 addition & 1 deletion lib/src/client/transport/http2_credentials.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ChannelCredentials {
if (!isSecure) return null;
if (_certificateBytes != null) {
return createSecurityContext(false)
..setTrustedCertificatesBytes(_certificateBytes!,
..setTrustedCertificatesBytes(_certificateBytes,
password: _certificatePassword);
}
final context = SecurityContext(withTrustedRoots: true);
Expand Down
Loading
Loading