Commit 958d2a6f authored by John McCutchan's avatar John McCutchan Committed by GitHub

Abort a hot reload if we detect an error in flutter.yaml (#6787)

parent b9c38711
......@@ -75,7 +75,14 @@ class AssetBundle {
}) async {
workingDirPath ??= getAssetBuildDirectory();
packagesPath ??= path.absolute(PackageMap.globalPackagesPath);
Object manifest = _loadFlutterYamlManifest(manifestPath);
Object manifest;
try {
manifest = _loadFlutterYamlManifest(manifestPath);
} catch (e) {
printStatus('Error detected in flutter.yaml:', emphasis: true);
printError(e);
return 1;
}
if (manifest == null) {
// No manifest file found for this application.
return 0;
......@@ -449,13 +456,8 @@ Future<int> _validateFlutterYamlManifest(Object manifest) async {
if (validator.validate(manifest)) {
return 0;
} else {
if (validator.errors.length == 1) {
printError('Error in flutter.yaml: ${validator.errors.first}');
} else {
printError('Error in flutter.yaml:');
printError(' ' + validator.errors.join('\n '));
}
printStatus('Error detected in flutter.yaml:', emphasis: true);
printError(validator.errors.join('\n'));
return 1;
}
}
......@@ -387,12 +387,14 @@ class HotRunner extends ResidentRunner {
// Did not update DevFS because of a Dart source error.
return false;
}
Status devFSStatus = logger.startProgress('Syncing files to device...');
final bool rebuildBundle = bundle.needsBuild();
if (rebuildBundle) {
printTrace('Updating assets');
await bundle.build();
int result = await bundle.build();
if (result != 0)
return false;
}
Status devFSStatus = logger.startProgress('Syncing files to device...');
await _devFS.update(progressReporter: progressReporter,
bundle: bundle,
bundleDirty: rebuildBundle,
......
......@@ -36,7 +36,14 @@ Future<Null> parseServiceConfigs(
return;
}
dynamic manifest = _loadYamlFile(_kFlutterManifestPath);
dynamic manifest;
try {
manifest = _loadYamlFile(_kFlutterManifestPath);
} catch (e) {
printStatus('Error detected in flutter.yaml:', emphasis: true);
printError(e);
return;
}
if (manifest == null || manifest['services'] == null) {
printTrace('No services specified in the manifest');
return;
......
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