Add macOS hot reload test (#45264)
This commit is contained in:
@@ -121,7 +121,7 @@ void recursiveCopy(Directory source, Directory target) {
|
||||
|
||||
for (FileSystemEntity entity in source.listSync(followLinks: false)) {
|
||||
final String name = path.basename(entity.path);
|
||||
if (entity is Directory)
|
||||
if (entity is Directory && !entity.path.contains('.dart_tool'))
|
||||
recursiveCopy(entity, Directory(path.join(target.path, name)));
|
||||
else if (entity is File) {
|
||||
final File dest = File(path.join(target.path, name));
|
||||
|
||||
@@ -15,14 +15,17 @@ import '../framework/utils.dart';
|
||||
final Directory _editedFlutterGalleryDir = dir(path.join(Directory.systemTemp.path, 'edited_flutter_gallery'));
|
||||
final Directory flutterGalleryDir = dir(path.join(flutterDirectory.path, 'examples/flutter_gallery'));
|
||||
|
||||
TaskFunction createHotModeTest() {
|
||||
TaskFunction createHotModeTest({String deviceIdOverride, Map<String, String> environment}) {
|
||||
return () async {
|
||||
final Device device = await devices.workingDevice;
|
||||
await device.unlock();
|
||||
if (deviceIdOverride == null) {
|
||||
final Device device = await devices.workingDevice;
|
||||
await device.unlock();
|
||||
deviceIdOverride = device.deviceId;
|
||||
}
|
||||
final File benchmarkFile = file(path.join(_editedFlutterGalleryDir.path, 'hot_benchmark.json'));
|
||||
rm(benchmarkFile);
|
||||
final List<String> options = <String>[
|
||||
'--hot', '-d', device.deviceId, '--benchmark', '--verbose', '--resident', '--output-dill', path.join('build', 'app.dill')
|
||||
'--hot', '-d', deviceIdOverride, '--benchmark', '--verbose', '--resident', '--output-dill', path.join('build', 'app.dill')
|
||||
];
|
||||
int hotReloadCount = 0;
|
||||
Map<String, dynamic> twoReloadsData;
|
||||
@@ -33,10 +36,17 @@ TaskFunction createHotModeTest() {
|
||||
recursiveCopy(flutterGalleryDir, _editedFlutterGalleryDir);
|
||||
await inDirectory<void>(_editedFlutterGalleryDir, () async {
|
||||
{
|
||||
final Process clearProcess = await startProcess(
|
||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||
flutterCommandArgs('clean', <String>[]),
|
||||
environment: environment,
|
||||
);
|
||||
await clearProcess.exitCode;
|
||||
|
||||
final Process process = await startProcess(
|
||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||
flutterCommandArgs('run', options),
|
||||
environment: null,
|
||||
environment: environment,
|
||||
);
|
||||
|
||||
final Completer<void> stdoutDone = Completer<void>();
|
||||
@@ -90,7 +100,7 @@ TaskFunction createHotModeTest() {
|
||||
final Process process = await startProcess(
|
||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||
flutterCommandArgs('run', options),
|
||||
environment: null,
|
||||
environment: environment,
|
||||
);
|
||||
final Completer<void> stdoutDone = Completer<void>();
|
||||
final Completer<void> stderrDone = Completer<void>();
|
||||
|
||||
Reference in New Issue
Block a user