Skip to content

Commit

Permalink
Prepare Dart Debug Extension for MV3 release (dart-lang#2293)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette authored Nov 29, 2023
1 parent 3bb4a6a commit 8c22555
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 232 deletions.
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mv3_extension
publish_to: none
version: 1.38.0
version: 2.0.0
homepage: https://github.com/dart-lang/webdev
description: >-
A Chrome extension for Dart debugging.
Expand Down
16 changes: 8 additions & 8 deletions dwds/debug_extension_mv3/tool/build_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

// Run from the extension root directory:
// - For dev: dart run tool/build_extension.dart
// - For prod: dart run tool/build_extension.dart prod
// - For MV3: dart run tool/build_extension.dart --mv3
// - For prod: dart run tool/build_extension.dart --prod
// - For MV2: dart run tool/build_extension.dart --mv2

import 'dart:convert';
import 'dart:io';
Expand All @@ -19,26 +19,26 @@ import 'package:args/args.dart';
import 'package:path/path.dart' as p;

const _prodFlag = 'prod';
const _mv3Flag = 'mv3';
const _mv2Flag = 'mv2';

void main(List<String> arguments) async {
final parser = ArgParser()
..addFlag(_prodFlag, negatable: true, defaultsTo: false)
..addFlag(_mv3Flag, negatable: true, defaultsTo: false);
..addFlag(_mv2Flag, negatable: true, defaultsTo: false);
final argResults = parser.parse(arguments);

exitCode = await run(
isProd: argResults[_prodFlag] as bool,
isMV3: argResults[_mv3Flag] as bool,
isMV2: argResults[_mv2Flag] as bool,
);
if (exitCode != 0) {
_logWarning('Run terminated unexpectedly with exit code: $exitCode');
}
}

Future<int> run({required bool isProd, required bool isMV3}) async {
Future<int> run({required bool isProd, required bool isMV2}) async {
_logInfo(
'Building ${isMV3 ? 'MV3' : 'MV2'} extension for ${isProd ? 'prod' : 'dev'}',
'Building ${isMV2 ? 'MV2' : 'MV3'} extension for ${isProd ? 'prod' : 'dev'}',
);
_logInfo('Compiling extension with dart2js to /compiled directory');
final compileStep = await Process.start(
Expand All @@ -50,7 +50,7 @@ Future<int> run({required bool isProd, required bool isMV3}) async {
if (compileExitCode != 0) {
return compileExitCode;
}
final manifestFileName = isMV3 ? 'manifest_mv3' : 'manifest_mv2';
final manifestFileName = isMV2 ? 'manifest_mv2' : 'manifest_mv3';
_logInfo('Copying manifest.json to /compiled directory');
try {
File(p.join('web', '$manifestFileName.json')).copySync(
Expand Down
8 changes: 1 addition & 7 deletions dwds/debug_extension_mv3/web/debug_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import 'cider_connection.dart';
import 'cross_extension_communication.dart';
import 'data_serializers.dart';
import 'data_types.dart';
import 'lifeline_ports.dart';
import 'logger.dart';
import 'messaging.dart';
import 'storage.dart';
Expand Down Expand Up @@ -381,8 +380,6 @@ Future<bool> _connectToDwds({
cancelOnError: true,
);
_debugSessions.add(debugSession);
// Create a connection with the lifeline port to keep the debug session alive:
await maybeCreateLifelinePort(dartAppTabId);
// Send a DevtoolsRequest to the event stream:
final tabUrl = await _getTabUrl(dartAppTabId);
debugSession.sendEvent(
Expand Down Expand Up @@ -592,10 +589,7 @@ void _removeDebugSession(_DebugSession debugSession) {
debugSession.sendEvent(event);
debugSession.close();
final removed = _debugSessions.remove(debugSession);
if (removed) {
// Maybe remove the corresponding lifeline connection:
maybeRemoveLifelinePort(debugSession.appTabId);
} else {
if (!removed) {
debugWarn('Could not remove debug session.');
}
}
Expand Down
27 changes: 0 additions & 27 deletions dwds/debug_extension_mv3/web/lifeline_connection.dart

This file was deleted.

94 changes: 0 additions & 94 deletions dwds/debug_extension_mv3/web/lifeline_ports.dart

This file was deleted.

2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/web/manifest_mv2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart Debug Extension",
"version": "1.40",
"version": "2.0",
"manifest_version": 2,
"devtools_page": "static_assets/devtools.html",
"browser_action": {
Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/web/manifest_mv3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart Debug Extension",
"version": "1.40",
"version": "2.0",
"manifest_version": 3,
"devtools_page": "static_assets/devtools.html",
"action": {
Expand Down
93 changes: 0 additions & 93 deletions dwds/test/puppeteer/lifeline_test.dart

This file was deleted.

0 comments on commit 8c22555

Please sign in to comment.