[flutter_tools] Avoid duplicated calls to l10n generation (#76066)

This commit is contained in:
Perqin
2021-02-26 04:11:03 +08:00
committed by GitHub
parent 3e5efc0235
commit 131f59f17e
3 changed files with 15 additions and 20 deletions

View File

@@ -37,15 +37,9 @@ Future<void> generateLocalizationsSyntheticPackage({
);
}
BuildResult result;
// If an l10n.yaml file exists but is empty, attempt to build synthetic
// package with default settings.
if (yamlNode.value == null) {
result = await buildSystem.build(
const GenerateLocalizationsTarget(),
environment,
);
} else {
// If an l10n.yaml file exists and is not empty, attempt to parse settings in
// it.
if (yamlNode.value != null) {
final YamlMap yamlMap = yamlNode as YamlMap;
final Object value = yamlMap['synthetic-package'];
if (value is! bool && value != null) {
@@ -63,7 +57,7 @@ Future<void> generateLocalizationsSyntheticPackage({
}
}
result = await buildSystem.build(
final BuildResult result = await buildSystem.build(
const GenerateLocalizationsTarget(),
environment,
);