Revert "Add a warning/additional handlers for parsingsynthetic-package." (#158078)

Reverts flutter/flutter#157934 to unblock https://github.com/flutter/flutter/pull/158076 and then flutter roll.

Reason: b/377107864
This commit is contained in:
Polina Cherkasova
2024-11-03 09:12:20 -08:00
committed by GitHub
parent a1651c684b
commit f7b24fa525
3 changed files with 5 additions and 209 deletions

View File

@@ -147,8 +147,6 @@ class GenerateLocalizationsCommand extends FlutterCommand {
'generated as a synthetic package or at a specified directory in '
'the Flutter project.\n'
'\n'
'DEPRECATED: https://flutter.dev/to/flutter-gen-deprecation.\n'
'\n'
'This flag is set to true by default.\n'
'\n'
'When synthetic-package is set to false, it will generate the '

View File

@@ -15,10 +15,10 @@ Future<void> generateLocalizationsSyntheticPackage({
required BuildSystem buildSystem,
required BuildTargets buildTargets,
}) async {
final FileSystem fileSystem = environment.fileSystem;
final File l10nYamlFile = fileSystem.file(
fileSystem.path.join(environment.projectDir.path, 'l10n.yaml'),
);
fileSystem.path.join(environment.projectDir.path, 'l10n.yaml'));
// If pubspec.yaml has generate:true and if l10n.yaml exists in the
// root project directory, check to see if a synthetic package should
@@ -30,7 +30,7 @@ Future<void> generateLocalizationsSyntheticPackage({
final YamlNode yamlNode = loadYamlNode(l10nYamlFile.readAsStringSync());
if (yamlNode.value != null && yamlNode is! YamlMap) {
throwToolExit(
'Expected ${l10nYamlFile.path} to contain a map, instead was $yamlNode',
'Expected ${l10nYamlFile.path} to contain a map, instead was $yamlNode'
);
}
@@ -41,7 +41,8 @@ Future<void> generateLocalizationsSyntheticPackage({
final Object? value = yamlMap['synthetic-package'];
if (value is! bool && value != null) {
throwToolExit(
'Expected "synthetic-package" to have a bool value, instead was "$value"',
'Expected "synthetic-package" to have a bool value, '
'instead was "$value"'
);
}
@@ -51,30 +52,8 @@ Future<void> generateLocalizationsSyntheticPackage({
if (isSyntheticL10nPackage == false) {
return;
}
} else if (!environment.useImplicitPubspecResolution) {
// --no-implicit-pubspec-resolution was passed, and synthetic-packages: true was not.
return;
}
if (!environment.useImplicitPubspecResolution) {
throwToolExit(
'Cannot generate a synthetic package when --no-implicit-pubspec-resolution is passed.\n'
'\n'
'Synthetic package output (package:flutter_gen) is deprecated: '
'https://flutter.dev/to/flutter-gen-deprecation. If you are seeing this '
'message either you have provided --no-implicit-pubspec-resolution, or '
'it is the default value (see flutter --verbose --help).',
);
}
// Log a warning: synthetic-package: true (or implicit true) is deprecated.
environment.logger.printWarning(
'Synthetic package output (package:flutter_gen) is deprecated: '
'https://flutter.dev/to/flutter-gen-deprecation. In a future release, '
'synthetic-package will default to `false` and will later be removed '
'entirely.',
);
final BuildResult result = await buildSystem.build(
buildTargets.generateLocalizationsTarget,
environment,