mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Use program during attach if provided (#118130)
This commit is contained in:
parent
5bf6357d34
commit
46e48ba3b4
@ -148,6 +148,7 @@ class FlutterDebugAdapter extends FlutterBaseDebugAdapter {
|
|||||||
customTool: args.customTool,
|
customTool: args.customTool,
|
||||||
customToolReplacesArgs: args.customToolReplacesArgs,
|
customToolReplacesArgs: args.customToolReplacesArgs,
|
||||||
userToolArgs: args.toolArgs,
|
userToolArgs: args.toolArgs,
|
||||||
|
targetProgram: args.program,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ class FlutterAttachRequestArguments
|
|||||||
this.customTool,
|
this.customTool,
|
||||||
this.customToolReplacesArgs,
|
this.customToolReplacesArgs,
|
||||||
this.vmServiceUri,
|
this.vmServiceUri,
|
||||||
|
this.program,
|
||||||
super.restart,
|
super.restart,
|
||||||
super.name,
|
super.name,
|
||||||
super.cwd,
|
super.cwd,
|
||||||
@ -35,6 +36,7 @@ class FlutterAttachRequestArguments
|
|||||||
customTool = obj['customTool'] as String?,
|
customTool = obj['customTool'] as String?,
|
||||||
customToolReplacesArgs = obj['customToolReplacesArgs'] as int?,
|
customToolReplacesArgs = obj['customToolReplacesArgs'] as int?,
|
||||||
vmServiceUri = obj['vmServiceUri'] as String?,
|
vmServiceUri = obj['vmServiceUri'] as String?,
|
||||||
|
program = obj['program'] as String?,
|
||||||
super.fromMap();
|
super.fromMap();
|
||||||
|
|
||||||
static FlutterAttachRequestArguments fromJson(Map<String, Object?> obj) =>
|
static FlutterAttachRequestArguments fromJson(Map<String, Object?> obj) =>
|
||||||
@ -64,6 +66,9 @@ class FlutterAttachRequestArguments
|
|||||||
/// The VM Service URI of the running Flutter app to connect to.
|
/// The VM Service URI of the running Flutter app to connect to.
|
||||||
final String? vmServiceUri;
|
final String? vmServiceUri;
|
||||||
|
|
||||||
|
/// The program/Flutter app to be run.
|
||||||
|
final String? program;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() => <String, Object?>{
|
Map<String, Object?> toJson() => <String, Object?>{
|
||||||
...super.toJson(),
|
...super.toJson(),
|
||||||
@ -151,7 +156,8 @@ class FlutterLaunchRequestArguments
|
|||||||
if (args != null) 'args': args,
|
if (args != null) 'args': args,
|
||||||
if (toolArgs != null) 'toolArgs': toolArgs,
|
if (toolArgs != null) 'toolArgs': toolArgs,
|
||||||
if (customTool != null) 'customTool': customTool,
|
if (customTool != null) 'customTool': customTool,
|
||||||
if (customToolReplacesArgs != null) 'customToolReplacesArgs': customToolReplacesArgs,
|
if (customToolReplacesArgs != null)
|
||||||
|
'customToolReplacesArgs': customToolReplacesArgs,
|
||||||
};
|
};
|
||||||
|
|
||||||
static FlutterLaunchRequestArguments fromJson(Map<String, Object?> obj) =>
|
static FlutterLaunchRequestArguments fromJson(Map<String, Object?> obj) =>
|
||||||
|
@ -209,6 +209,34 @@ void main() {
|
|||||||
expect(adapter.processArgs, containsAllInOrder(<String>['attach', '--machine']));
|
expect(adapter.processArgs, containsAllInOrder(<String>['attach', '--machine']));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('runs "flutter attach" with program if passed in', () async {
|
||||||
|
final MockFlutterDebugAdapter adapter = MockFlutterDebugAdapter(
|
||||||
|
fileSystem: MemoryFileSystem.test(style: fsStyle),
|
||||||
|
platform: platform,
|
||||||
|
);
|
||||||
|
final Completer<void> responseCompleter = Completer<void>();
|
||||||
|
|
||||||
|
final FlutterAttachRequestArguments args =
|
||||||
|
FlutterAttachRequestArguments(
|
||||||
|
cwd: '/project',
|
||||||
|
program: 'program/main.dart',
|
||||||
|
);
|
||||||
|
|
||||||
|
await adapter.configurationDoneRequest(MockRequest(), null, () {});
|
||||||
|
await adapter.attachRequest(
|
||||||
|
MockRequest(), args, responseCompleter.complete);
|
||||||
|
await responseCompleter.future;
|
||||||
|
|
||||||
|
expect(
|
||||||
|
adapter.processArgs,
|
||||||
|
containsAllInOrder(<String>[
|
||||||
|
'attach',
|
||||||
|
'--machine',
|
||||||
|
'--target',
|
||||||
|
'program/main.dart'
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
test('does not record the VMs PID for terminating', () async {
|
test('does not record the VMs PID for terminating', () async {
|
||||||
final MockFlutterDebugAdapter adapter = MockFlutterDebugAdapter(
|
final MockFlutterDebugAdapter adapter = MockFlutterDebugAdapter(
|
||||||
fileSystem: MemoryFileSystem.test(style: fsStyle),
|
fileSystem: MemoryFileSystem.test(style: fsStyle),
|
||||||
|
Loading…
Reference in New Issue
Block a user