Add experimental hot reload flag support to flutter tools (#162889)
Rather than ask users to pass the complicated and long string `--extra-front-end-options=--dartdevc-canary,--dartdevc-module-format=ddc` we want a simpler flag to enable the new DDC module system/hot reload. Technically this flag enables the new module system, not necessarily hot reload directly. But we only expect people to use the flag to enable hot reload so I've chosen the name based on that. --------- Co-authored-by: Nate Biggs <natebiggs@google.com>
This commit is contained in:
parent
33a4c95de0
commit
1d766ed8d9
@ -151,6 +151,7 @@ abstract final class FlutterOptions {
|
||||
static const String kWebBrowserFlag = 'web-browser-flag';
|
||||
static const String kWebResourcesCdnFlag = 'web-resources-cdn';
|
||||
static const String kWebWasmFlag = 'wasm';
|
||||
static const String kWebExperimentalHotReload = 'web-experimental-hot-reload';
|
||||
}
|
||||
|
||||
/// flutter command categories for usage.
|
||||
@ -336,6 +337,11 @@ abstract class FlutterCommand extends Command<void> {
|
||||
help: 'Enables expression evaluation in the debugger.',
|
||||
hide: !verboseHelp,
|
||||
);
|
||||
argParser.addFlag(
|
||||
FlutterOptions.kWebExperimentalHotReload,
|
||||
help: 'Enables new module format that supports hot reload.',
|
||||
hide: !verboseHelp,
|
||||
);
|
||||
argParser.addOption(
|
||||
'web-launch-url',
|
||||
help:
|
||||
@ -1328,6 +1334,12 @@ abstract class FlutterCommand extends Command<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(natebiggs): Delete this when new DDC module system is the default.
|
||||
if (argParser.options.containsKey(FlutterOptions.kWebExperimentalHotReload) &&
|
||||
boolArg(FlutterOptions.kWebExperimentalHotReload)) {
|
||||
extraFrontEndOptions.addAll(<String>['--dartdevc-canary', '--dartdevc-module-format=ddc']);
|
||||
}
|
||||
|
||||
String? codeSizeDirectory;
|
||||
if (argParser.options.containsKey(FlutterOptions.kAnalyzeSize) &&
|
||||
boolArg(FlutterOptions.kAnalyzeSize)) {
|
||||
|
@ -11,9 +11,7 @@ import '../src/common.dart';
|
||||
void main() {
|
||||
testAll(
|
||||
chrome: true,
|
||||
additionalCommandArgs: <String>[
|
||||
'--extra-front-end-options=--dartdevc-canary,--dartdevc-module-format=ddc',
|
||||
],
|
||||
additionalCommandArgs: <String>['--web-experimental-hot-reload'],
|
||||
// TODO(srujzs): Remove this custom message once we have the delta inspector emitting the same
|
||||
// string as the VM.
|
||||
constClassFieldRemovalErrorMessage: 'Const class cannot remove fields',
|
||||
|
@ -9,10 +9,5 @@ import '../integration.shard/test_data/hot_reload_test_common.dart';
|
||||
import '../src/common.dart';
|
||||
|
||||
void main() {
|
||||
testAll(
|
||||
chrome: true,
|
||||
additionalCommandArgs: <String>[
|
||||
'--extra-front-end-options=--dartdevc-canary,--dartdevc-module-format=ddc',
|
||||
],
|
||||
);
|
||||
testAll(chrome: true, additionalCommandArgs: <String>['--web-experimental-hot-reload']);
|
||||
}
|
||||
|
@ -9,10 +9,5 @@ import '../integration.shard/test_data/hot_reload_with_asset_test_common.dart';
|
||||
import '../src/common.dart';
|
||||
|
||||
void main() {
|
||||
testAll(
|
||||
chrome: true,
|
||||
additionalCommandArgs: <String>[
|
||||
'--extra-front-end-options=--dartdevc-canary,--dartdevc-module-format=ddc',
|
||||
],
|
||||
);
|
||||
testAll(chrome: true, additionalCommandArgs: <String>['--web-experimental-hot-reload']);
|
||||
}
|
||||
|
@ -9,10 +9,5 @@ import '../integration.shard/test_data/stateless_stateful_hot_reload_test_common
|
||||
import '../src/common.dart';
|
||||
|
||||
void main() {
|
||||
testAll(
|
||||
chrome: true,
|
||||
additionalCommandArgs: <String>[
|
||||
'--extra-front-end-options=--dartdevc-canary,--dartdevc-module-format=ddc',
|
||||
],
|
||||
);
|
||||
testAll(chrome: true, additionalCommandArgs: <String>['--web-experimental-hot-reload']);
|
||||
}
|
||||
|
@ -73,9 +73,7 @@ Future<void> _testProject(
|
||||
late FlutterRunTestDriver flutter;
|
||||
|
||||
final List<String> additionalCommandArgs =
|
||||
useDDCLibraryBundleFormat
|
||||
? <String>['--extra-front-end-options=--dartdevc-canary,--dartdevc-module-format=ddc']
|
||||
: <String>[];
|
||||
useDDCLibraryBundleFormat ? <String>['--web-experimental-hot-reload'] : <String>[];
|
||||
final String testName =
|
||||
'Hot restart (index.html: $name)'
|
||||
'${additionalCommandArgs.isEmpty ? '' : ' with args: $additionalCommandArgs'}';
|
||||
|
Loading…
x
Reference in New Issue
Block a user