[flutter_tools] warn when main library is relocated (#62930)

This commit is contained in:
Jonah Williams
2020-08-05 15:11:15 -07:00
committed by GitHub
parent ef62463e9c
commit 762d9f7f4e
2 changed files with 71 additions and 1 deletions

View File

@@ -376,10 +376,19 @@ class HotRunner extends ResidentRunner {
asyncScanning: hotRunnerConfig.asyncScanning,
packageConfig: flutterDevices[0].devFS.lastPackageConfig,
);
final File entrypointFile = globals.fs.file(mainPath);
if (!entrypointFile.existsSync()) {
globals.printError(
'The entrypoint file (i.e. the file with main()) ${entrypointFile.path} '
'cannot be found. Moving or renaming this file will prevent changes to '
'its contents from being discovered during hot reload/restart until '
'flutter is restarted or the file is restored.'
);
}
final UpdateFSReport results = UpdateFSReport(success: true);
for (final FlutterDevice device in flutterDevices) {
results.incorporateResults(await device.updateDevFS(
mainUri: globals.fs.file(mainPath).absolute.uri,
mainUri: entrypointFile.absolute.uri,
target: target,
bundle: assetBundle,
firstBuildTime: firstBuildTime,