Skip to content

Commit

Permalink
Migrate DevTools to use pub workspaces (#8549)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll authored Nov 27, 2024
1 parent db3597d commit e1ead3d
Show file tree
Hide file tree
Showing 49 changed files with 199 additions and 189 deletions.
File renamed without changes.
38 changes: 19 additions & 19 deletions packages/.vscode/launch.json → .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
"configurations": [
{
"name": "opened test or devtools",
"cwd": "devtools_app",
"cwd": "packages/devtools_app",
"request": "launch",
"type": "dart",
},
{
"name": "devtools",
"request": "launch",
"type": "dart",
"program": "devtools_app/lib/main.dart",
"program": "packages/devtools_app/lib/main.dart",
},
{
"name": "devtools + experiments",
"request": "launch",
"type": "dart",
"program": "devtools_app/lib/main.dart",
"program": "packages/devtools_app/lib/main.dart",
"args": [
"--dart-define",
"memory_disconnect_experience=true",
Expand All @@ -32,21 +32,21 @@
"name": "devtools + profile",
"request": "launch",
"type": "dart",
"program": "devtools_app/lib/main.dart",
"program": "packages/devtools_app/lib/main.dart",
"flutterMode": "profile",
},
{
"name": "devtools + release",
"request": "launch",
"type": "dart",
"program": "devtools_app/lib/main.dart",
"program": "packages/devtools_app/lib/main.dart",
"flutterMode": "release",
},
{
"name": "devtools + profile + experiments",
"request": "launch",
"type": "dart",
"program": "devtools_app/lib/main.dart",
"program": "packages/devtools_app/lib/main.dart",
"flutterMode": "profile",
"args": [
"--dart-define=enable_experiments=true"
Expand All @@ -56,50 +56,50 @@
"name": "devtools + release",
"request": "launch",
"type": "dart",
"program": "devtools_app/lib/main.dart",
"program": "packages/devtools_app/lib/main.dart",
"flutterMode": "release",
},
{
"name": "memory/default",
"request": "launch",
"type": "dart",
"program": "devtools_app/test/test_infra/scenes/memory/default.stager_app.g.dart",
"program": "packages/devtools_app/test/test_infra/scenes/memory/default.stager_app.g.dart",
},
{
"name": "memory/diff_snapshot",
"request": "launch",
"type": "dart",
"program": "devtools_app/test/test_infra/scenes/memory/diff_snapshot.stager_app.g.dart",
"program": "packages/devtools_app/test/test_infra/scenes/memory/diff_snapshot.stager_app.g.dart",
},
{
"name": "performance/default",
"request": "launch",
"type": "dart",
"program": "devtools_app/test/test_infra/scenes/performance/default.stager_app.g.dart",
"program": "packages/devtools_app/test/test_infra/scenes/performance/default.stager_app.g.dart",
},
{
"name": "profiler/default",
"request": "launch",
"type": "dart",
"program": "devtools_app/test/test_infra/scenes/cpu_profiler/default.stager_app.g.dart",
"program": "packages/devtools_app/test/test_infra/scenes/cpu_profiler/default.stager_app.g.dart",
},
{
"name": "fixtures/flutter_app",
"request": "launch",
"type": "dart",
"program": "devtools_app/test/test_infra/fixtures/flutter_app/lib/main.dart",
"program": "packages/devtools_app/test/test_infra/fixtures/flutter_app/lib/main.dart",
},
{
"name": "fixtures/memory_app",
"request": "launch",
"type": "dart",
"program": "devtools_app/test/test_infra/fixtures/memory_app/lib/main.dart",
"program": "packages/devtools_app/test/test_infra/fixtures/memory_app/lib/main.dart",
},
{
"name": "standalone_ui/editor_sidebar",
"request": "launch",
"type": "dart",
"program": "devtools_app/test/test_infra/scenes/standalone_ui/editor_sidebar.stager_app.g.dart",
"program": "packages/devtools_app/test/test_infra/scenes/standalone_ui/editor_sidebar.stager_app.g.dart",
"preLaunchTask": "Start DTD on Port 8500",
},
{
Expand All @@ -116,7 +116,7 @@
"name": "devtools_extensions: foo + sim",
"request": "launch",
"type": "dart",
"program": "devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/lib/main.dart",
"program": "packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/lib/main.dart",
"args": [
"--dart-define=use_simulated_environment=true"
],
Expand All @@ -125,7 +125,7 @@
"name": "devtools_extensions: dart_foo + sim",
"request": "launch",
"type": "dart",
"program": "devtools_extensions/example/packages_with_extensions/dart_foo/packages/dart_foo_devtools_extension/lib/main.dart",
"program": "packages/devtools_extensions/example/packages_with_extensions/dart_foo/packages/dart_foo_devtools_extension/lib/main.dart",
"args": [
"--dart-define=use_simulated_environment=true"
],
Expand All @@ -134,13 +134,13 @@
"name": "devtools_extensions: app_that_uses_foo",
"request": "launch",
"type": "dart",
"program": "devtools_extensions/example/app_that_uses_foo/lib/main.dart",
"program": "packages/devtools_extensions/example/app_that_uses_foo/lib/main.dart",
},
{
"name": "devtools_extensions: app_that_uses_foo - bin",
"request": "launch",
"type": "dart",
"program": "devtools_extensions/example/app_that_uses_foo/bin/script.dart",
"program": "packages/devtools_extensions/example/app_that_uses_foo/bin/script.dart",
},
{
"name": "attach",
Expand All @@ -151,7 +151,7 @@
"name": "foo_devtools_extension example + simulated environment",
"request": "launch",
"type": "dart",
"program": "devtools_extensions/example/foo/packages/foo_devtools_extension/lib/main.dart",
"program": "packages/devtools_extensions/example/foo/packages/foo_devtools_extension/lib/main.dart",
"args": [
"--dart-define=use_simulated_environment=true"
],
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions packages/analysis_options.yaml → analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ analyzer:
# treat missing required parameters as a warning (not a hint)
missing_required_param: warning
exclude:
- build/**
- '**/build/**'
- '**.freezed.dart'
- flutter-sdk/
- tool/flutter-sdk/

linter:
rules:
Expand Down Expand Up @@ -85,7 +85,6 @@ linter:
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
# - parameter_assignments # we do this commonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';

class Animals extends StatelessWidget {
const Animals({super.key});

@override
Widget build(BuildContext context) {
return ListView(
Expand Down
8 changes: 5 additions & 3 deletions case_study/code_size/optimized/code_size_images/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import 'package:flutter/material.dart';
import 'animals.dart';

void main() {
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
Expand All @@ -22,7 +24,7 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
const MyHomePage({super.key});

@override
State<MyHomePage> createState() => _MyHomePageState();
Expand All @@ -35,7 +37,7 @@ class _MyHomePageState extends State<MyHomePage> {
appBar: AppBar(
title: const Text('Code Size Demo'),
),
body: Center(
body: const Center(
child: Animals(),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
await tester.pumpWidget(const MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import 'package:flutter/material.dart';
import 'package:steel_crypt/steel_crypt.dart' as encrypt;

void main() {
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand All @@ -22,7 +24,7 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
const MyHomePage({super.key, required this.title});

final String title;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
await tester.pumpWidget(const MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';

class Animals extends StatelessWidget {
const Animals({super.key});

@override
Widget build(BuildContext context) {
return ListView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import 'package:flutter/material.dart';
import 'animals.dart';

void main() {
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
Expand All @@ -22,7 +24,7 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
const MyHomePage({super.key});

@override
State<MyHomePage> createState() => _MyHomePageState();
Expand All @@ -35,7 +37,7 @@ class _MyHomePageState extends State<MyHomePage> {
appBar: AppBar(
title: const Text('Code Size Demo'),
),
body: Center(
body: const Center(
child: Animals(),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
await tester.pumpWidget(const MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import 'package:encrypt/encrypt.dart' as encrypt;
import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand All @@ -19,7 +21,7 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
const MyHomePage({super.key, required this.title});

final String title;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
await tester.pumpWidget(const MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
Expand Down
17 changes: 10 additions & 7 deletions case_study/memory_leaks/memory_leak_app/lib/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import 'package:flutter/material.dart';
import 'common.dart';

class About extends StatefulWidget {
// ignore: prefer_const_constructors_in_immutables, intentional example code.
About({super.key});

@override
State<About> createState() => AboutState();
}

class AboutState extends State<About> {
static const String heading = '$aboutMenu\n\n';
static const String helpText = '''
static const heading = '$aboutMenu\n\n';
static const helpText = '''
This application makes Restful HTTP GET
requests to three different Restful servers.
Selecting a request e.g., Weather will
Expand All @@ -23,13 +26,13 @@ page to select another Restful request.
The menu, on the main page, has options:
''';
static const String logOption = '\n $logMenu';
static const String aboutOption = '\n $aboutMenu';
static const logOption = '\n $logMenu';
static const aboutOption = '\n $aboutMenu';

static const String logDescr = ' display all messages.';
static const String aboutDescr = ' display this page.';
static const logDescr = ' display all messages.';
static const aboutDescr = ' display this page.';

final TextStyle defaultStyle = const TextStyle(
final defaultStyle = const TextStyle(
fontSize: 20,
color: Colors.blueGrey,
);
Expand Down
5 changes: 4 additions & 1 deletion case_study/memory_leaks/memory_leak_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {
Logging.logging.add('Starting...');

runApp(
MaterialApp(
const MaterialApp(
// Title
title: appName,
// Home
Expand All @@ -26,6 +26,8 @@ void main() {
}

class MyHome extends StatefulWidget {
const MyHome({super.key});

@override
State<MyHome> createState() => MyHomeState();
}
Expand Down Expand Up @@ -101,6 +103,7 @@ class MyHomeState extends State<MyHome> with SingleTickerProviderStateMixin {
);
break;
default:
// ignore: avoid_print, fine for example app.
print('ERROR: Unhandled Menu.');
}
}
Expand Down
Loading

0 comments on commit e1ead3d

Please sign in to comment.