Unverified Commit 2c05d08f authored by Liam Appelbe's avatar Liam Appelbe Committed by GitHub

Experimental flags for hot reloads, fixed (#27043)

* Revert "Revert "Experimental flags for hot reloads (#26988)" (#27037)"

This reverts commit cf744198.

* Fix analysis failures
parent 7bfbc285
......@@ -333,6 +333,11 @@ class RunCommand extends RunCommandBase {
throwToolExit('Error: --train is only allowed when running as --dynamic --profile '
'(recommended) or --debug (may include unwanted debug symbols).');
List<String> expFlags;
if (argParser.options.containsKey(FlutterOptions.kEnableExperiment) &&
argResults[FlutterOptions.kEnableExperiment] != null) {
expFlags = argResults[FlutterOptions.kEnableExperiment];
}
final List<FlutterDevice> flutterDevices = devices.map<FlutterDevice>((Device device) {
return FlutterDevice(
device,
......@@ -341,6 +346,7 @@ class RunCommand extends RunCommandBase {
fileSystemRoots: argResults['filesystem-root'],
fileSystemScheme: argResults['filesystem-scheme'],
viewFilter: argResults['isolate-filter'],
experimentalFlags: expFlags,
);
}).toList();
......
......@@ -332,7 +332,8 @@ class ResidentCompiler {
CompilerMessageConsumer compilerMessageConsumer = printError,
String initializeFromDill,
TargetModel targetModel = TargetModel.flutter,
bool unsafePackageSerialization
bool unsafePackageSerialization,
List<String> experimentalFlags,
}) : assert(_sdkRoot != null),
_trackWidgetCreation = trackWidgetCreation,
_packagesPath = packagesPath,
......@@ -342,7 +343,8 @@ class ResidentCompiler {
_stdoutHandler = _StdoutHandler(consumer: compilerMessageConsumer),
_controller = StreamController<_CompilationRequest>(),
_initializeFromDill = initializeFromDill,
_unsafePackageSerialization = unsafePackageSerialization {
_unsafePackageSerialization = unsafePackageSerialization,
_experimentalFlags = experimentalFlags {
// This is a URI, not a file path, so the forward slash is correct even on Windows.
if (!_sdkRoot.endsWith('/'))
_sdkRoot = '$_sdkRoot/';
......@@ -358,6 +360,7 @@ class ResidentCompiler {
final _StdoutHandler _stdoutHandler;
String _initializeFromDill;
bool _unsafePackageSerialization;
final List<String> _experimentalFlags;
final StreamController<_CompilationRequest> _controller;
......@@ -470,6 +473,10 @@ class ResidentCompiler {
if (_unsafePackageSerialization == true) {
command.add('--unsafe-package-serialization');
}
if (_experimentalFlags != null) {
final String expFlags = _experimentalFlags.join(',');
command.add('--enable-experiment=$expFlags');
}
printTrace(command.join(' '));
_server = await processManager.start(command);
_server.stdout
......
......@@ -35,6 +35,7 @@ class FlutterDevice {
this.fileSystemScheme,
this.viewFilter,
TargetModel targetModel = TargetModel.flutter,
List<String> experimentalFlags,
ResidentCompiler generator,
}) : assert(trackWidgetCreation != null),
generator = generator ?? ResidentCompiler(
......@@ -43,6 +44,7 @@ class FlutterDevice {
fileSystemRoots: fileSystemRoots,
fileSystemScheme: fileSystemScheme,
targetModel: targetModel,
experimentalFlags: experimentalFlags,
);
final Device device;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment