Skip to content

Commit

Permalink
Create package:devtools_app_shared (#6210)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll authored Aug 18, 2023
1 parent 0dfcda3 commit d0db8ae
Show file tree
Hide file tree
Showing 408 changed files with 4,011 additions and 3,167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ void main() {
final evalTester = _EvalAndBrowseTester(tester);
await evalTester.prepareMemoryUI();

logStatus('test basic evaluation');
await _testBasicEval(evalTester);

logStatus('test variable assignment');
await _testAssignment(evalTester);

logStatus('test dump one instance to console');
await _profileOneInstance(evalTester);

logStatus('test dump all instances to console');
await _profileAllInstances(evalTester);

logStatus('test take a snapshot');
await evalTester.switchToSnapshotsAndTakeOne();

logStatus('test inbound references are listed on console instance');
await _inboundReferencesAreListed(evalTester);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import 'package:collection/collection.dart';
import 'package:devtools_app/devtools_app.dart';
import 'package:devtools_app/src/service/service_extension_widgets.dart';
import 'package:devtools_app/src/service/service_extensions.dart' as extensions;
import 'package:devtools_app/src/shared/eval_on_dart_library.dart';
import 'package:devtools_app_shared/service.dart';
import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_test/devtools_integration_test.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -188,6 +190,7 @@ Future<void> _verifyBooleanExtension(WidgetTester tester) async {
final library = EvalOnDartLibrary(
'package:flutter/src/rendering/debug.dart',
serviceManager.service!,
serviceManager: serviceManager,
);
await _verifyExtension(
tester,
Expand All @@ -205,6 +208,7 @@ Future<void> _verifyNumericExtension(WidgetTester tester) async {
final library = EvalOnDartLibrary(
'package:flutter/src/scheduler/binding.dart',
serviceManager.service!,
serviceManager: serviceManager,
);
await _verifyExtension(
tester,
Expand All @@ -225,6 +229,7 @@ Future<void> _verifyStringExtension(WidgetTester tester) async {
final library = EvalOnDartLibrary(
'package:flutter/src/foundation/platform.dart',
serviceManager.service!,
serviceManager: serviceManager,
);
await _verifyExtension(
tester,
Expand All @@ -247,6 +252,7 @@ Future<void> _verifyHotReloadAndHotRestart() async {
final library = EvalOnDartLibrary(
'package:flutter_app/main.dart',
serviceManager.service!,
serviceManager: serviceManager,
);

// Verify the initial value of [topLevelFieldForTest].
Expand Down
10 changes: 1 addition & 9 deletions packages/devtools_app/lib/devtools_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export 'src/screens/performance/panes/timeline_events/timeline_events_controller
export 'src/screens/performance/performance_controller.dart';
export 'src/screens/performance/performance_model.dart';
export 'src/screens/performance/performance_screen.dart';
export 'src/screens/performance/timeline_streams.dart';
export 'src/screens/profiler/cpu_profile_model.dart';
export 'src/screens/profiler/profiler_screen.dart';
export 'src/screens/profiler/profiler_screen_controller.dart';
Expand All @@ -52,21 +51,18 @@ export 'src/screens/vm_developer/object_inspector/vm_object_model.dart';
export 'src/screens/vm_developer/vm_developer_tools_controller.dart';
export 'src/screens/vm_developer/vm_developer_tools_screen.dart';
export 'src/screens/vm_developer/vm_service_private_extensions.dart';
export 'src/service/isolate_manager.dart';
export 'src/service/isolate_state.dart';
export 'src/service/json_to_service_cache.dart';
export 'src/service/resolved_uri_manager.dart';
export 'src/service/service_extension_manager.dart';
export 'src/service/service_extensions.dart';
export 'src/service/service_manager.dart';
export 'src/service/timeline_streams.dart';
export 'src/service/vm_flags.dart';
export 'src/service/vm_service_wrapper.dart';
export 'src/shared/analytics/analytics.dart';
export 'src/shared/analytics/analytics_controller.dart';
export 'src/shared/banner_messages.dart';
export 'src/shared/charts/treemap.dart';
export 'src/shared/common_widgets.dart';
export 'src/shared/config_specific/ide_theme/ide_theme.dart';
export 'src/shared/connected_app.dart';
export 'src/shared/connection_info.dart';
export 'src/shared/console/console_service.dart';
Expand All @@ -84,7 +80,6 @@ export 'src/shared/http/http_request_data.dart';
export 'src/shared/notifications.dart';
export 'src/shared/offline_mode.dart';
export 'src/shared/preferences.dart';
export 'src/shared/primitives/auto_dispose.dart';
export 'src/shared/primitives/listenable.dart';
export 'src/shared/primitives/simple_items.dart';
export 'src/shared/primitives/storage.dart';
Expand All @@ -95,11 +90,8 @@ export 'src/shared/routing.dart';
export 'src/shared/screen.dart';
export 'src/shared/scripts/script_manager.dart';
export 'src/shared/side_panel.dart';
export 'src/shared/split.dart';
export 'src/shared/theme.dart';
export 'src/shared/ui/filter.dart';
export 'src/shared/ui/hover.dart';
export 'src/shared/ui/icons.dart';
export 'src/shared/ui/search.dart';
export 'src/shared/utils.dart';
export 'src/shared/version.dart';
4 changes: 2 additions & 2 deletions packages/devtools_app/lib/initialization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
Expand All @@ -12,9 +14,7 @@ import 'src/screens/debugger/syntax_highlighter.dart';
import 'src/screens/provider/riverpod_error_logger_observer.dart';
import 'src/shared/analytics/analytics_controller.dart';
import 'src/shared/config_specific/framework_initialize/framework_initialize.dart';
import 'src/shared/config_specific/ide_theme/ide_theme.dart';
import 'src/shared/config_specific/logger/logger_helpers.dart';
import 'src/shared/config_specific/url/url.dart';
import 'src/shared/feature_flags.dart';
import 'src/shared/globals.dart';
import 'src/shared/preferences.dart';
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:devtools_app_shared/utils.dart';
import 'package:flutter/foundation.dart';

import 'initialization.dart';
import 'src/shared/environment_parameters/environment_parameters_base.dart';
import 'src/shared/environment_parameters/environment_parameters_external.dart';
import 'src/shared/globals.dart';
import 'src/shared/primitives/utils.dart';

/// This is the entrypoint for running DevTools externally.
Expand Down
7 changes: 2 additions & 5 deletions packages/devtools_app/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import 'dart:async';

import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -48,11 +50,9 @@ import 'shared/console/primitives/simple_items.dart';
import 'shared/feature_flags.dart';
import 'shared/globals.dart';
import 'shared/offline_screen.dart';
import 'shared/primitives/auto_dispose.dart';
import 'shared/primitives/utils.dart';
import 'shared/routing.dart';
import 'shared/screen.dart';
import 'shared/theme.dart';
import 'shared/ui/hover.dart';
import 'standalone_ui/standalone_screen.dart';

Expand Down Expand Up @@ -94,9 +94,6 @@ class DevToolsAppState extends State<DevToolsApp> with AutoDisposeMixin {
List<Screen> get _originalScreens =>
widget.originalScreens.map((s) => s.screen).toList();

/// TODO(kenz): use [extensionService.visibleExtensions] instead of
/// [extensionService.availableExtensions] and verify tabs are added / removed
/// propertly based on the enabled state of extensions.
Iterable<Screen> get _extensionScreens =>
extensionService.visibleExtensions.value.map(
(e) => DevToolsScreen<void>(ExtensionScreen(e)).screen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import 'dart:async';

import 'package:devtools_app_shared/utils.dart';
import 'package:flutter/material.dart';

import '../shared/globals.dart';
import '../shared/offline_mode.dart';
import '../shared/primitives/auto_dispose.dart';
import '../shared/screen.dart';
import '../shared/utils.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class EmbeddedExtensionControllerImpl extends EmbeddedExtensionController {
/// in the id.
late final viewId = 'ext-${extensionConfig.name}-${_viewIdIncrementer++}';

// TODO(kenz): pass along IDE theme query parameters from the DevTools URL.
String get extensionUrl {
return path.join(
html.window.location.origin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import 'dart:async';
// ignore: avoid_web_libraries_in_flutter, as designed
import 'dart:html' as html;

import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_extensions/api.dart';
import 'package:flutter/material.dart';

import '../../shared/globals.dart';
import '../../shared/primitives/auto_dispose.dart';
import '_controller_web.dart';
import 'controller.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_extensions/api.dart';
import 'package:devtools_shared/devtools_extensions.dart';

import '../../shared/primitives/auto_dispose.dart';
import '_controller_desktop.dart' if (dart.library.html) '_controller_web.dart';

EmbeddedExtensionControllerImpl createEmbeddedExtensionController(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_shared/devtools_extensions.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

import 'dart:async';

import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_shared/devtools_extensions.dart';
import 'package:flutter/material.dart';

import '../shared/analytics/constants.dart' as gac;
import '../shared/common_widgets.dart';
import '../shared/dialogs.dart';
import '../shared/globals.dart';
import '../shared/routing.dart';
import '../shared/theme.dart';

class EmbeddedExtensionHeader extends StatelessWidget {
const EmbeddedExtensionHeader({super.key, required this.extension});
Expand Down Expand Up @@ -77,7 +76,7 @@ class DisableExtensionButton extends StatelessWidget {

@override
Widget build(BuildContext context) {
return DevToolsButton.iconOnly(
return GaDevToolsButton.iconOnly(
icon: Icons.extension_off_outlined,
outlined: false,
tooltip: 'Disable extension',
Expand Down Expand Up @@ -200,11 +199,11 @@ class EnableExtensionPrompt extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
DevToolsButton(
GaDevToolsButton(
label: 'Enable',
gaScreen: gac.extensionScreenId,
gaSelection: gac.extensionEnable(extensionName),
elevatedButton: true,
elevated: true,
onPressed: () {
unawaited(
extensionService.setExtensionEnabledState(
Expand All @@ -215,7 +214,7 @@ class EnableExtensionPrompt extends StatelessWidget {
},
),
const SizedBox(width: defaultSpacing),
DevToolsButton(
GaDevToolsButton(
label: 'No, hide this screen',
gaScreen: gac.extensionScreenId,
gaSelection: gac.extensionDisable(extensionName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_shared/devtools_extensions.dart';
import 'package:flutter/foundation.dart';

import '../shared/config_specific/server/server.dart' as server;
import '../shared/globals.dart';
import '../shared/primitives/auto_dispose.dart';

class ExtensionService extends DisposableController
with AutoDisposeControllerMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

import 'dart:async';

import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_shared/devtools_extensions.dart';
import 'package:flutter/material.dart';

import '../shared/analytics/analytics.dart' as ga;
import '../shared/analytics/constants.dart' as gac;
import '../shared/common_widgets.dart';
import '../shared/dialogs.dart';
import '../shared/globals.dart';
import '../shared/theme.dart';
import '../shared/utils.dart';

/// A [ScaffoldAction] that, when clicked, will open a dialog menu for
/// managing DevTools extension states.
Expand Down
3 changes: 1 addition & 2 deletions packages/devtools_app/lib/src/framework/about_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

import 'dart:async';

import 'package:devtools_app_shared/ui.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../devtools.dart' as devtools;
import '../shared/analytics/constants.dart' as gac;
import '../shared/common_widgets.dart';
import '../shared/dialogs.dart';
import '../shared/globals.dart';
import '../shared/theme.dart';
import 'release_notes/release_notes.dart';

class DevToolsAboutDialog extends StatelessWidget {
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/lib/src/framework/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

import 'dart:math' as math;

import 'package:devtools_app_shared/ui.dart';
import 'package:flutter/material.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';

import '../shared/common_widgets.dart';
import '../shared/primitives/utils.dart';
import '../shared/screen.dart';
import '../shared/theme.dart';

class DevToolsAppBar extends StatelessWidget {
const DevToolsAppBar({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'dart:async';

import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_shared/service.dart';
import 'package:logging/logging.dart';

Expand Down
6 changes: 2 additions & 4 deletions packages/devtools_app/lib/src/framework/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import 'dart:async';

import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_shared/devtools_shared.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand All @@ -17,16 +19,12 @@ import '../shared/config_specific/import_export/import_export.dart';
import '../shared/connection_info.dart';
import '../shared/feature_flags.dart';
import '../shared/globals.dart';
import '../shared/primitives/auto_dispose.dart';
import '../shared/primitives/blocking_action_mixin.dart';
import '../shared/primitives/utils.dart';
import '../shared/routing.dart';
import '../shared/screen.dart';
import '../shared/theme.dart';
import '../shared/title.dart';
import '../shared/ui/label.dart';
import '../shared/ui/vm_flag_widgets.dart';
import '../shared/utils.dart';
import 'framework_core.dart';

class HomeScreen extends Screen {
Expand Down
Loading

0 comments on commit d0db8ae

Please sign in to comment.