mirror of
https://github.com/flutter/flutter.git
synced 2026-02-15 23:33:36 +08:00
[dap] Remove some code that's not longer required (#98928)
This commit is contained in:
parent
4b819782fb
commit
ea8aeb7427
@ -5,7 +5,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:dds/dap.dart' hide PidTracker, PackageConfigUtils;
|
||||
import 'package:dds/dap.dart' hide PidTracker;
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:vm_service/vm_service.dart' as vm;
|
||||
|
||||
@ -19,7 +19,7 @@ import 'mixins.dart';
|
||||
|
||||
/// A DAP Debug Adapter for running and debugging Flutter applications.
|
||||
class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments, FlutterAttachRequestArguments>
|
||||
with PidTracker, PackageConfigUtils {
|
||||
with PidTracker {
|
||||
FlutterDebugAdapter(
|
||||
ByteStreamServerChannel channel, {
|
||||
required this.fileSystem,
|
||||
@ -36,7 +36,6 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
|
||||
logger: logger,
|
||||
);
|
||||
|
||||
@override
|
||||
FileSystem fileSystem;
|
||||
Platform platform;
|
||||
Process? _process;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:dds/dap.dart' hide PidTracker, PackageConfigUtils;
|
||||
import 'package:dds/dap.dart' hide PidTracker;
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:vm_service/vm_service.dart' as vm;
|
||||
|
||||
@ -19,7 +19,7 @@ import 'mixins.dart';
|
||||
|
||||
/// A DAP Debug Adapter for running and debugging Flutter tests.
|
||||
class FlutterTestDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments, FlutterAttachRequestArguments>
|
||||
with PidTracker, PackageConfigUtils, TestAdapter {
|
||||
with PidTracker, TestAdapter {
|
||||
FlutterTestDebugAdapter(
|
||||
ByteStreamServerChannel channel, {
|
||||
required this.fileSystem,
|
||||
@ -36,7 +36,6 @@ class FlutterTestDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArgum
|
||||
logger: logger,
|
||||
);
|
||||
|
||||
@override
|
||||
FileSystem fileSystem;
|
||||
Platform platform;
|
||||
Process? _process;
|
||||
|
||||
@ -2,48 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import '../base/file_system.dart';
|
||||
import '../base/io.dart';
|
||||
|
||||
/// A mixin providing some utility functions for locating/working with
|
||||
/// package_config.json files.
|
||||
///
|
||||
/// Adapted from package:dds/src/dap/adapters/mixins.dart to use Flutter's
|
||||
/// dart:io wrappers.
|
||||
mixin PackageConfigUtils {
|
||||
abstract FileSystem fileSystem;
|
||||
|
||||
/// Find the `package_config.json` file for the program being launched.
|
||||
File? findPackageConfigFile(String possibleRoot) {
|
||||
// TODO(dantup): Remove this once
|
||||
// https://github.com/dart-lang/sdk/issues/45530 is done as it will not be
|
||||
// necessary.
|
||||
File? packageConfig;
|
||||
while (true) {
|
||||
packageConfig = fileSystem.file(
|
||||
fileSystem.path.join(possibleRoot, '.dart_tool', 'package_config.json'),
|
||||
);
|
||||
|
||||
// If this packageconfig exists, use it.
|
||||
if (packageConfig.existsSync()) {
|
||||
break;
|
||||
}
|
||||
|
||||
final String parent = fileSystem.path.dirname(possibleRoot);
|
||||
|
||||
// If we can't go up anymore, the search failed.
|
||||
if (parent == possibleRoot) {
|
||||
packageConfig = null;
|
||||
break;
|
||||
}
|
||||
|
||||
possibleRoot = parent;
|
||||
}
|
||||
|
||||
return packageConfig;
|
||||
}
|
||||
}
|
||||
|
||||
/// A mixin for tracking additional PIDs that can be shut down at the end of a debug session.
|
||||
///
|
||||
/// Adapted from package:dds/src/dap/adapters/mixins.dart to use Flutter's
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user