Skip to content

Development Proxy & Web Configuration File #172020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/flutter/test/material/radio_list_tile_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,9 @@ void main() {
const BorderSide side = BorderSide(color: Colors.red, width: 3.0);
await tester.pumpWidget(
const MaterialApp(
home: Material(child: Center(child: RadioListTile<bool>(value: true, radioSide: side))),
home: Material(
child: Center(child: RadioListTile<bool>(value: true, radioSide: side)),
),
),
);

Expand Down
21 changes: 10 additions & 11 deletions packages/flutter/test/widgets/tap_region_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1201,18 +1201,17 @@ void main() {
Navigator.push(
tester.element(find.byType(GestureDetector)),
MaterialPageRoute<void>(
builder:
(BuildContext context) => Scaffold(
body: Center(
child: ElevatedButton(
key: buttonKey,
onPressed: () {
buttonTapped = true;
},
child: const Text('Test Button'),
),
),
builder: (BuildContext context) => Scaffold(
body: Center(
child: ElevatedButton(
key: buttonKey,
onPressed: () {
buttonTapped = true;
},
child: const Text('Test Button'),
),
),
),
),
);
},
Expand Down
18 changes: 14 additions & 4 deletions packages/flutter_tools/lib/src/commands/drive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import '../drive/drive_service.dart';
import '../drive/web_driver_service.dart' show Browser;
import '../globals.dart' as globals;
import '../ios/devices.dart';
import '../isolated/devfs_config.dart';
import '../resident_runner.dart';
import '../runner/flutter_command.dart'
show FlutterCommandCategory, FlutterCommandResult, FlutterOptions;
Expand Down Expand Up @@ -304,7 +305,14 @@ class DriveCommand extends RunCommandBase {
_logger.printError('Screenshot not supported for ${device.displayName}.');
}

final bool web = device is WebServerDevice || device is ChromiumDevice;
final DevConfig? devConfig = (device is WebServerDevice || device is ChromiumDevice)
? await loadDevConfig(
hostname: stringArg('web-hostname'),
port: stringArg('web-port'),
tlsCertPath: stringArg('web-tls-cert-path'),
tlsCertKeyPath: stringArg('web-tls-cert-key-path'),
)
: null;
_flutterDriverFactory ??= FlutterDriverFactory(
applicationPackageFactory: ApplicationPackageFactory.instance!,
logger: _logger,
Expand All @@ -322,9 +330,11 @@ class DriveCommand extends RunCommandBase {
logger: _logger,
throwOnError: false,
);
final DriverService driverService = _flutterDriverFactory!.createDriverService(web);
final DriverService driverService = _flutterDriverFactory!.createDriverService(
devConfig != null,
);
final BuildInfo buildInfo = await getBuildInfo();
final DebuggingOptions debuggingOptions = await createDebuggingOptions(web);
final DebuggingOptions debuggingOptions = await createDebuggingOptions(devConfig: devConfig);
final File? applicationBinary = applicationBinaryPath == null
? null
: _fileSystem.file(applicationBinaryPath);
Expand All @@ -342,7 +352,7 @@ class DriveCommand extends RunCommandBase {
mainPath: targetFile,
platformArgs: <String, Object>{
if (traceStartup) 'trace-startup': traceStartup,
if (web) '--no-launch-chrome': true,
if (devConfig != null) '--no-launch-chrome': true,
},
);
} else {
Expand Down
54 changes: 28 additions & 26 deletions packages/flutter_tools/lib/src/commands/run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import '../device.dart';
import '../features.dart';
import '../globals.dart' as globals;
import '../ios/devices.dart';
import '../isolated/devfs_config.dart';
import '../project.dart';
import '../resident_runner.dart';
import '../run_cold.dart';
Expand Down Expand Up @@ -269,7 +270,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
/// Create a debugging options instance for the current `run` or `drive` invocation.
@visibleForTesting
@protected
Future<DebuggingOptions> createDebuggingOptions(bool webMode) async {
Future<DebuggingOptions> createDebuggingOptions({DevConfig? devConfig}) async {
final BuildInfo buildInfo = await getBuildInfo();
final int? webBrowserDebugPort =
featureFlags.isWebEnabled && argResults!.wasParsed('web-browser-debug-port')
Expand All @@ -279,18 +280,10 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
? stringsArg(FlutterOptions.kWebBrowserFlag)
: const <String>[];

final Map<String, String> webHeaders = featureFlags.isWebEnabled
? extractWebHeaders()
: const <String, String>{};

if (buildInfo.mode.isRelease) {
return DebuggingOptions.disabled(
buildInfo,
dartEntrypointArgs: stringsArg('dart-entrypoint-args'),
hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '',
port: featureFlags.isWebEnabled ? stringArg('web-port') : '',
tlsCertPath: featureFlags.isWebEnabled ? stringArg('web-tls-cert-path') : null,
tlsCertKeyPath: featureFlags.isWebEnabled ? stringArg('web-tls-cert-key-path') : null,
webUseSseForDebugProxy:
featureFlags.isWebEnabled && stringArg('web-server-debug-protocol') == 'sse',
webUseSseForDebugBackend:
Expand All @@ -302,7 +295,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
webRunHeadless: featureFlags.isWebEnabled && boolArg('web-run-headless'),
webBrowserDebugPort: webBrowserDebugPort,
webBrowserFlags: webBrowserFlags,
webHeaders: webHeaders,
webRenderer: webRenderer,
webUseWasm: useWasm,
enableImpeller: enableImpeller,
Expand All @@ -313,6 +305,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
enableEmbedderApi: enableEmbedderApi,
usingCISystem: usingCISystem,
debugLogsDirectoryPath: debugLogsDirectoryPath,
devConfig: devConfig,
);
} else {
return DebuggingOptions.enabled(
Expand Down Expand Up @@ -344,10 +337,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
ddsPort: ddsPort,
devToolsServerAddress: devToolsServerAddress,
verboseSystemLogs: boolArg('verbose-system-logs'),
hostname: featureFlags.isWebEnabled ? stringArg('web-hostname') : '',
port: featureFlags.isWebEnabled ? stringArg('web-port') : '',
tlsCertPath: featureFlags.isWebEnabled ? stringArg('web-tls-cert-path') : null,
tlsCertKeyPath: featureFlags.isWebEnabled ? stringArg('web-tls-cert-key-path') : null,
webUseSseForDebugProxy:
featureFlags.isWebEnabled && stringArg('web-server-debug-protocol') == 'sse',
webUseSseForDebugBackend:
Expand All @@ -362,7 +351,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
webEnableExpressionEvaluation:
featureFlags.isWebEnabled && boolArg('web-enable-expression-evaluation'),
webLaunchUrl: featureFlags.isWebEnabled ? stringArg('web-launch-url') : null,
webHeaders: webHeaders,
webRenderer: webRenderer,
webUseWasm: useWasm,
vmserviceOutFile: stringArg('vmservice-out-file'),
Expand All @@ -382,6 +370,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
enableDevTools: boolArg(FlutterCommand.kEnableDevTools),
ipv6: boolArg(FlutterCommand.ipv6Flag),
printDtd: boolArg(FlutterGlobalOptions.kPrintDtd, global: true),
devConfig: devConfig,
);
}
}
Expand Down Expand Up @@ -493,7 +482,7 @@ class RunCommand extends RunCommandBase {
String get category => FlutterCommandCategory.project;

List<Device>? devices;
var webMode = false;
late final DevConfig? _devConfig;

String? get userIdentifier => stringArg(FlutterOptions.kDeviceUser);

Expand Down Expand Up @@ -663,12 +652,21 @@ class RunCommand extends RunCommandBase {

// Only support "web mode" with a single web device due to resident runner
// refactoring required otherwise.
webMode =
featureFlags.isWebEnabled &&
if (featureFlags.isWebEnabled &&
devices!.length == 1 &&
await devices!.single.targetPlatform == TargetPlatform.web_javascript;
await devices!.single.targetPlatform == TargetPlatform.web_javascript) {
_devConfig = await loadDevConfig(
hostname: stringArg('web-hostname'),
port: stringArg('web-port'),
tlsCertPath: stringArg('web-tls-cert-path'),
tlsCertKeyPath: stringArg('web-tls-cert-key-path'),
headers: extractWebHeaders(),
);
} else {
_devConfig = null;
}

if (useWasm && !webMode) {
if (useWasm && _devConfig == null) {
throwToolExit('--wasm is only supported on the web platform');
}

Expand Down Expand Up @@ -696,11 +694,13 @@ class RunCommand extends RunCommandBase {
required String? applicationBinaryPath,
required FlutterProject flutterProject,
}) async {
if (hotMode && !webMode) {
final DebuggingOptions debuggingOptions = await createDebuggingOptions(devConfig: _devConfig);

if (hotMode && _devConfig == null) {
return HotRunner(
flutterDevices,
target: targetFile,
debuggingOptions: await createDebuggingOptions(webMode),
debuggingOptions: debuggingOptions,
benchmarkMode: boolArg('benchmark'),
applicationBinary: applicationBinaryPath == null
? null
Expand All @@ -711,12 +711,12 @@ class RunCommand extends RunCommandBase {
analytics: globals.analytics,
nativeAssetsYamlFile: stringArg(FlutterOptions.kNativeAssetsYamlFile),
);
} else if (webMode) {
} else if (_devConfig != null) {
return webRunnerFactory!.createWebRunner(
flutterDevices.single,
target: targetFile,
flutterProject: flutterProject,
debuggingOptions: await createDebuggingOptions(webMode),
debuggingOptions: debuggingOptions,
stayResident: stayResident,
fileSystem: globals.fs,
analytics: globals.analytics,
Expand All @@ -730,7 +730,7 @@ class RunCommand extends RunCommandBase {
return ColdRunner(
flutterDevices,
target: targetFile,
debuggingOptions: await createDebuggingOptions(webMode),
debuggingOptions: debuggingOptions,
traceStartup: traceStartup,
awaitFirstFrameWhenTracing: awaitFirstFrameWhenTracing,
applicationBinary: applicationBinaryPath == null
Expand Down Expand Up @@ -759,13 +759,15 @@ class RunCommand extends RunCommandBase {
}
final Daemon daemon = createMachineDaemon();
late AppInstance app;

final DebuggingOptions debuggingOptions = await createDebuggingOptions(devConfig: _devConfig);
try {
app = await daemon.appDomain.startApp(
devices!.first,
globals.fs.currentDirectory.path,
targetFile,
route,
await createDebuggingOptions(webMode),
debuggingOptions,
hotMode,
applicationBinary: applicationBinaryPath == null
? null
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy