diff --git a/analysis_options.yaml b/analysis_options.yaml index 070a4f5e864..db91d770a2a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -18,6 +18,13 @@ analyzer: - '**/build/**' - '**.freezed.dart' - tool/flutter-sdk/ + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** linter: rules: @@ -166,7 +173,6 @@ dart_code_metrics: - integration_test/** # Investigate internal usages of inspector_controller before removing. - lib/src/screens/inspector/**_controller.dart - - lib/src/service/** - lib/src/shared/** - lib/src/standalone_ui/** - test/** diff --git a/packages/devtools_app/analysis_options.yaml b/packages/devtools_app/analysis_options.yaml index e85c2e11cf6..1fb0989e4ce 100644 --- a/packages/devtools_app/analysis_options.yaml +++ b/packages/devtools_app/analysis_options.yaml @@ -13,6 +13,12 @@ analyzer: # these files if you want to ensure code is not invalid except where # expected. - test/test_infra/test_data/syntax_highlighting/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** dart_code_metrics: metrics-exclude: diff --git a/packages/devtools_app/lib/src/service/service_extensions.dart b/packages/devtools_app/lib/src/service/service_extensions.dart index b2bf785eb94..c4fd56a4f0a 100644 --- a/packages/devtools_app/lib/src/service/service_extensions.dart +++ b/packages/devtools_app/lib/src/service/service_extensions.dart @@ -226,15 +226,6 @@ class ServiceExtensionDescription extends extensions.ServiceExtension String get gaItemTooltipLink => '${gaItem}TooltipLink'; } -final debugAllowBanner = ToggleableServiceExtensionDescription.from( - extensions.debugAllowBanner, - title: 'Debug Banner', - iconAsset: 'icons/debug_banner@2x.png', - gaScreenName: gac.inspector, - gaItem: gac.debugBanner, - tooltip: 'Toggle Debug Banner', -); - final invertOversizedImages = ToggleableServiceExtensionDescription.from( extensions.invertOversizedImages, title: 'Highlight Oversized Images', @@ -363,6 +354,8 @@ final slowAnimations = ToggleableServiceExtensionDescription.from( gaDocsItem: gac.slowAnimationDocs, ); +// TODO(https://github.com/flutter/devtools/issues/2780): hook this up in the UI. +// ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/2780). final togglePlatformMode = ServiceExtensionDescription.from( extensions.togglePlatformMode, title: 'Override target platform', diff --git a/packages/devtools_app/lib/src/service/timeline_streams.dart b/packages/devtools_app/lib/src/service/timeline_streams.dart index 57e51d1d12f..6d669a1f097 100644 --- a/packages/devtools_app/lib/src/service/timeline_streams.dart +++ b/packages/devtools_app/lib/src/service/timeline_streams.dart @@ -63,6 +63,7 @@ class TimelineStreamManager with DisposerMixin { List get advancedStreams => _streamsWhere((stream) => stream.advanced); + @visibleForTesting List get recordedStreams => _streamsWhere((stream) => stream.recorded.value); diff --git a/packages/devtools_app/lib/src/service/vm_service_wrapper.dart b/packages/devtools_app/lib/src/service/vm_service_wrapper.dart index a49971fa9d9..87724a96d85 100644 --- a/packages/devtools_app/lib/src/service/vm_service_wrapper.dart +++ b/packages/devtools_app/lib/src/service/vm_service_wrapper.dart @@ -94,8 +94,9 @@ class VmServiceWrapper extends VmService { final _activeStreams = >{}; - final activeFutures = >{}; + final activeFutureNames = []; + @visibleForTesting Future get allFuturesCompleted => _allFuturesCompleter.future; Completer _allFuturesCompleter = Completer() @@ -326,20 +327,6 @@ class VmServiceWrapper extends VmService { // End Dart IO extension method wrappers. - /// Testing only method to indicate that we don't really need to await all - /// currently pending futures. - /// - /// If you use this method be sure to indicate why you believe all pending - /// futures are safe to ignore. Currently the theory is this method should be - /// used after a hot restart to avoid bugs where we have zombie futures lying - /// around causing tests to flake. - @visibleForTesting - void doNotWaitForPendingFuturesBeforeExit() { - _allFuturesCompleter = Completer(); - _allFuturesCompleter.complete(true); - activeFutures.clear(); - } - @visibleForTesting int vmServiceCallCount = 0; @@ -383,15 +370,14 @@ class VmServiceWrapper extends VmService { vmServiceCallCount++; vmServiceCalls.add(name); - final trackedFuture = TrackedFuture(name, localFuture as Future); if (_allFuturesCompleter.isCompleted) { _allFuturesCompleter = Completer(); } - activeFutures.add(trackedFuture); + activeFutureNames.add(name); void futureComplete() { - activeFutures.remove(trackedFuture); - if (activeFutures.isEmpty) { + activeFutureNames.remove(name); + if (activeFutureNames.isEmpty) { _allFuturesCompleter.safeComplete(true); } } @@ -428,10 +414,6 @@ class VmServiceWrapper extends VmService { return parser(result.json); } - /// Forces the VM to perform a full garbage collection. - Future collectAllGarbage() => - _privateRpcInvoke('collectAllGarbage', parser: Success.parse); - Future getReachableSize(String isolateId, String targetId) => _privateRpcInvoke( 'getReachableSize', @@ -512,10 +494,3 @@ class VmServiceWrapper extends VmService { return response.dapResponse.body; } } - -class TrackedFuture { - TrackedFuture(this.name, this.future); - - final String name; - final Future future; -} diff --git a/packages/devtools_app/test/test_infra/flutter_test_environment.dart b/packages/devtools_app/test/test_infra/flutter_test_environment.dart index 54da10aa78d..812853c2b2b 100644 --- a/packages/devtools_app/test/test_infra/flutter_test_environment.dart +++ b/packages/devtools_app/test/test_infra/flutter_test_environment.dart @@ -200,8 +200,8 @@ class FlutterTestEnvironment { const Duration(seconds: 20), onTimeout: () { throw 'Timed out waiting for futures to complete during teardown. ' - '${_service.activeFutures.length} futures remained:\n\n' - ' ${_service.activeFutures.map((tf) => tf.name).join('\n ')}'; + '${_service.activeFutureNames.length} futures remained:\n\n' + ' ${_service.activeFutureNames.join('\\n ')}'; }, ); await _flutter!.stop(); diff --git a/packages/devtools_extensions/example/app_that_uses_foo/analysis_options.yaml b/packages/devtools_extensions/example/app_that_uses_foo/analysis_options.yaml index 0d2902135ca..bf8d421859d 100644 --- a/packages/devtools_extensions/example/app_that_uses_foo/analysis_options.yaml +++ b/packages/devtools_extensions/example/app_that_uses_foo/analysis_options.yaml @@ -7,6 +7,15 @@ # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. +analyzer: + exclude: + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml linter: diff --git a/third_party/packages/widget_icons/analysis_options.yaml b/third_party/packages/widget_icons/analysis_options.yaml index f9b303465f1..743e05ad835 100644 --- a/third_party/packages/widget_icons/analysis_options.yaml +++ b/third_party/packages/widget_icons/analysis_options.yaml @@ -1 +1,10 @@ +analyzer: + exclude: + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml diff --git a/third_party/packages/widget_icons/example/analysis_options.yaml b/third_party/packages/widget_icons/example/analysis_options.yaml index f9b303465f1..743e05ad835 100644 --- a/third_party/packages/widget_icons/example/analysis_options.yaml +++ b/third_party/packages/widget_icons/example/analysis_options.yaml @@ -1 +1,10 @@ +analyzer: + exclude: + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml diff --git a/tool/analysis_options.yaml b/tool/analysis_options.yaml index 81588d9a14a..f4ded48e561 100644 --- a/tool/analysis_options.yaml +++ b/tool/analysis_options.yaml @@ -6,6 +6,13 @@ include: package:lints/recommended.yaml analyzer: exclude: - flutter-sdk/ + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** linter: rules: