Unverified Commit 763bf114 authored by Liam Appelbe's avatar Liam Appelbe Committed by GitHub

Experimental flags for hot reloads (#26988)

* First pass at incremental exp flags

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