Skip to content

Commit f838595

Browse files
authored
appengine: update dependencies, use latest lints (#243)
1 parent 8d91394 commit f838595

26 files changed

+175
-149
lines changed

pkgs/appengine/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.13.11
2+
3+
* Update dependency on `googleapis_auth` and `http`.
4+
15
## 0.13.10
26

37
* Upgrade `package:grpc` to `^4.0.1`.

pkgs/appengine/analysis_options.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
include: package:lints/core.yaml
1+
include: package:lints/recommended.yaml
22

33
analyzer:
44
errors:
55
# TODO: We need to update the grpc generator to escape html entities in
66
# proto comments.
77
unintended_html_in_doc_comment: ignore
8+
# proto files import these
9+
implementation_imports: ignore
10+
# Breaking change to fix
11+
constant_identifier_names: ignore
812

913
exclude:
1014
- tmp/**
15+
16+
linter:
17+
rules:
18+
- unnecessary_library_directive

pkgs/appengine/lib/appengine.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library appengine;
6-
75
import 'dart:async';
86
import 'dart:io';
97

@@ -57,11 +55,11 @@ const Symbol _APPENGINE_CONTEXT = #appengine.context;
5755
/// The returned `Future` will complete when the HTTP server has been shutdown
5856
/// and is no longer serving requests.
5957
Future runAppEngine(
60-
void handler(HttpRequest request), {
58+
void Function(HttpRequest request) handler, {
6159
Function? onError,
6260
int port = 8080,
6361
bool shared = false,
64-
void onAcceptingConnections(InternetAddress address, int port)?,
62+
void Function(InternetAddress address, int port)? onAcceptingConnections,
6563
}) {
6664
void Function(Object, StackTrace)? errorHandler;
6765
if (onError != null) {
@@ -147,7 +145,7 @@ bool isCronJobRequest(HttpRequest request) {
147145
/// ]);
148146
/// });
149147
/// }
150-
Future withAppEngineServices(Future callback()) {
148+
Future withAppEngineServices(Future Function() callback) {
151149
return appengine_internal.withAppEngineServices(callback);
152150
}
153151

pkgs/appengine/lib/src/api_impl/stderr_logging_impl.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library stderr_logging;
65

76
import 'dart:async';
87
import 'dart:io' as io;

pkgs/appengine/lib/src/appengine_context.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library appengine.appengine_context;
6-
75
class AppEngineContext {
86
final String applicationID;
97
final String partition;

pkgs/appengine/lib/src/appengine_internal.dart

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library appengine.internal;
65

76
import 'dart:async';
87
import 'dart:io';
@@ -33,7 +32,7 @@ bool _loggingPackageEnabled = false;
3332

3433
/// Runs the given [callback] inside a new service scope and makes AppEngine
3534
/// services available within that scope.
36-
Future withAppEngineServices(Future callback()) =>
35+
Future withAppEngineServices(Future Function() callback) =>
3736
_withAppEngineServicesInternal((_) => callback());
3837

3938
/// Runs the AppEngine http server and uses the given request [handler] to
@@ -42,11 +41,11 @@ Future withAppEngineServices(Future callback()) =>
4241
/// The given request [handler] is run inside a new service scope and has all
4342
/// AppEngine services available within that scope.
4443
Future runAppEngine(
45-
void handler(HttpRequest request, ClientContext context),
46-
void onError(Object e, StackTrace s)?, {
44+
void Function(HttpRequest request, ClientContext context) handler,
45+
void Function(Object e, StackTrace s)? onError, {
4746
int port = 8080,
4847
bool shared = false,
49-
void onAcceptingConnections(InternetAddress address, int port)?,
48+
void Function(InternetAddress address, int port)? onAcceptingConnections,
5049
}) {
5150
return _withAppEngineServicesInternal((ContextRegistry contextRegistry) {
5251
final appengineServer = AppEngineHttpServer(contextRegistry,
@@ -97,7 +96,7 @@ Future runAppEngine(
9796
}
9897

9998
Future _withAppEngineServicesInternal(
100-
Future callback(ContextRegistry contextRegistry)) {
99+
Future Function(ContextRegistry contextRegistry) callback) {
101100
return ss.fork(() async {
102101
final ContextRegistry contextRegistry = await _initializeAppEngine();
103102
final bgServices = contextRegistry.newBackgroundServices();
@@ -130,7 +129,7 @@ Future<ContextRegistry> _initializeAppEngine() async {
130129
zoneId ??= 'dev-machine';
131130
final bool isProdEnvironment = !isDevEnvironment;
132131

133-
String? _findEnvironmentVariable(String name,
132+
String? findEnvironmentVariable(String name,
134133
{bool onlyInProd = false, bool onlyInDev = false, bool needed = true}) {
135134
if (onlyInProd && !isProdEnvironment) return null;
136135
if (onlyInDev && !isDevEnvironment) return null;
@@ -142,23 +141,23 @@ Future<ContextRegistry> _initializeAppEngine() async {
142141
return value;
143142
}
144143

145-
final projectId = _findEnvironmentVariable(
144+
final projectId = findEnvironmentVariable(
146145
'GOOGLE_CLOUD_PROJECT',
147146
needed: true,
148147
)!;
149148

150149
// For local testing the gcloud sdk brings now a gRPC-ready datastore
151150
// emulator which will tell the user to use this environment variable.
152-
final dbEmulatorHost = _findEnvironmentVariable('DATASTORE_EMULATOR_HOST',
151+
final dbEmulatorHost = findEnvironmentVariable('DATASTORE_EMULATOR_HOST',
153152
onlyInDev: false, needed: false);
154153

155154
final serviceId =
156-
_findEnvironmentVariable('GAE_SERVICE', onlyInProd: true, needed: true) ??
155+
findEnvironmentVariable('GAE_SERVICE', onlyInProd: true, needed: true) ??
157156
'dummy-service';
158157
final versionId =
159-
_findEnvironmentVariable('GAE_VERSION', onlyInProd: true, needed: true) ??
158+
findEnvironmentVariable('GAE_VERSION', onlyInProd: true, needed: true) ??
160159
'dummy-version';
161-
final instance = _findEnvironmentVariable('GAE_INSTANCE',
160+
final instance = findEnvironmentVariable('GAE_INSTANCE',
162161
onlyInProd: true, needed: true) ??
163162
'dummy-instance';
164163

pkgs/appengine/lib/src/client_context.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library appengine.client_context;
65

76
import 'package:gcloud/db.dart';
87
import 'package:gcloud/storage.dart';

pkgs/appengine/lib/src/errors.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library appengine.api.errors;
65

76
import 'dart:io';
87

@@ -16,7 +15,7 @@ class AppEngineError implements Exception {
1615
}
1716

1817
class NetworkError extends AppEngineError implements IOException {
19-
NetworkError(String message) : super(message);
18+
NetworkError(super.message);
2019

2120
@override
2221
String toString() => 'NetworkError: $message';
@@ -26,7 +25,7 @@ class ProtocolError extends AppEngineError implements IOException {
2625
static const ProtocolError INVALID_RESPONSE =
2726
ProtocolError('Invalid response');
2827

29-
const ProtocolError(String message) : super(message);
28+
const ProtocolError(super.message);
3029

3130
@override
3231
String toString() => 'ProtocolError: $message';
@@ -35,15 +34,14 @@ class ProtocolError extends AppEngineError implements IOException {
3534
class ServiceError extends AppEngineError {
3635
final String serviceName;
3736

38-
ServiceError(String message, {this.serviceName = 'ServiceError'})
39-
: super(message);
37+
ServiceError(super.message, {this.serviceName = 'ServiceError'});
4038

4139
@override
4240
String toString() => '$serviceName: $message';
4341
}
4442

4543
class ApplicationError extends AppEngineError {
46-
ApplicationError(String message) : super(message);
44+
ApplicationError(super.message);
4745

4846
@override
4947
String toString() => 'ApplicationError: $message';

pkgs/appengine/lib/src/grpc_api/datastore_api.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library grpc_api;
65

76
export 'package:fixnum/fixnum.dart' show Int32, Int64;
87

pkgs/appengine/lib/src/grpc_api/logging_api.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library logging_api;
65

76
export 'package:fixnum/fixnum.dart' show Int64;
87

pkgs/appengine/lib/src/grpc_api_impl/auth_utils.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
// TODO(kustermann): At some point we should integrate this library
66
// into `package:googleapis_auth`.
7-
library auth_utils;
87

98
import 'dart:async';
109

pkgs/appengine/lib/src/grpc_api_impl/datastore_impl.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library grpc_datastore;
65

76
import 'dart:async';
87

pkgs/appengine/lib/src/grpc_api_impl/logging_impl.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library grpc_logging;
65

76
import 'dart:async';
87
import 'dart:io';
@@ -451,8 +450,7 @@ api.LogSeverity _severityFromLogLevel(LogLevel level) {
451450
///
452451
/// See: https://cloud.google.com/error-reporting/docs/formatting-error-messages
453452
String _formatStackTrace(Object error, StackTrace stackTrace) =>
454-
'Error: $error\n' +
455-
Trace.from(stackTrace).frames.map((f) {
453+
'Error: $error\n${Trace.from(stackTrace).frames.map((f) {
456454
// Find member
457455
String? member = f.member;
458456
if (member == '<fn>') {
@@ -468,4 +466,4 @@ String _formatStackTrace(Object error, StackTrace stackTrace) =>
468466
}
469467
470468
return ' at $member ($loc)\n';
471-
}).join('');
469+
}).join('')}';

pkgs/appengine/lib/src/logging.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library appengine.api.logging;
6-
75
import 'dart:async';
86

97
import 'package:gcloud/service_scope.dart' as ss;

pkgs/appengine/lib/src/server/context_registry.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library appengine.context_registry;
65

76
import 'dart:async';
87
import 'dart:io';

pkgs/appengine/lib/src/server/logging_package_adaptor.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library appengine.server.logging_package_adaptor;
65

76
import 'package:logging/logging.dart';
87

pkgs/appengine/lib/src/server/server.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library application;
65

76
import 'dart:async';
87
import 'dart:convert' show utf8;
@@ -37,8 +36,8 @@ class AppEngineHttpServer {
3736
Future get done => _shutdownCompleter.future;
3837

3938
void run(
40-
applicationHandler(HttpRequest request, ClientContext context), {
41-
void onAcceptingConnections(InternetAddress address, int port)?,
39+
Function(HttpRequest request, ClientContext context) applicationHandler, {
40+
void Function(InternetAddress address, int port)? onAcceptingConnections,
4241
}) {
4342
final serviceHandlers = {
4443
'/_ah/start': _start,

pkgs/appengine/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: appengine
2-
version: 0.13.10
2+
version: 0.13.11
33
description: >-
44
Support for using Dart as a custom runtime on Google App Engine Flexible
55
Environment.
@@ -16,9 +16,9 @@ environment:
1616
dependencies:
1717
fixnum: ^1.0.0
1818
gcloud: ^0.8.10
19-
googleapis_auth: ^1.1.0
19+
googleapis_auth: ^2.0.0
2020
grpc: ^4.0.1
21-
http: '>=0.13.3 <2.0.0'
21+
http: ^1.0.0
2222
logging: ^1.0.1
2323
path: ^1.8.0
2424
protobuf: ^3.1.0

pkgs/appengine/test/enable_logging_package_test.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ class LoggingMock extends LoggingBase {
1717

1818
LoggingMock();
1919

20+
@override
2021
void log(LogLevel level, String message, {DateTime? timestamp}) {
2122
_logFunctionMock(level, message, timestamp);
2223
}
2324

25+
@override
2426
void reportError(LogLevel level, Object error, StackTrace stackTrace,
2527
{DateTime? timestamp}) {
2628
_reportErrorFunctionMock(
@@ -32,8 +34,8 @@ class LoggingMock extends LoggingBase {
3234
}
3335

3436
void expectReportError(
35-
void func(
36-
LogLevel level, Object error, StackTrace stackTrace, DateTime c)) {
37+
void Function(
38+
LogLevel level, Object error, StackTrace stackTrace, DateTime c) func) {
3739
_reportErrorFunctionMock = expectAsync4(func);
3840
}
3941

@@ -43,7 +45,7 @@ class LoggingMock extends LoggingBase {
4345
};
4446
}
4547

46-
void expectLog(void func(LogLevel a, String b, DateTime c)) {
48+
void expectLog(void Function(LogLevel a, String b, DateTime c) func) {
4749
_logFunctionMock = expectAsync3(func);
4850
}
4951

@@ -53,12 +55,14 @@ class LoggingMock extends LoggingBase {
5355
};
5456
}
5557

58+
@override
5659
Future flush() {
5760
throw "Unexpected method call";
5861
}
5962
}
6063

6164
class CustomStackTrace implements StackTrace {
65+
@override
6266
String toString() => 'custom-stack-trace';
6367
}
6468

pkgs/appengine/test/integration/common_e2e.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library test.integration.common_e2e;
65

76
import 'dart:async';
87
import 'dart:io';
@@ -32,7 +31,7 @@ bool onBot() {
3231

3332
Future<dynamic> withAuthenticator(
3433
List<String> scopes,
35-
Future callback(String project, grpc.HttpBasedAuthenticator authenticator),
34+
Future Function(String project, grpc.HttpBasedAuthenticator authenticator) callback,
3635
) async {
3736
var project = Platform.environment[PROJECT_ENV];
3837

0 commit comments

Comments
 (0)