From cb8c15c4f3c9fb3c37952743422e7a1f197dc682 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Mon, 16 Dec 2024 19:11:07 -0800 Subject: [PATCH] Replace `--no-implicit-pubspec-resolution` with `flutter config --explicit-package-dependencies`. (#160400) This was a mistake, and should have already been removed and cleaned up. Part of https://github.com/flutter/flutter/issues/160257. --- .../src/commands/generate_localizations.dart | 4 ++-- .../localizations/localizations_utils.dart | 6 +++--- .../src/runner/flutter_command_runner.dart | 21 ------------------- .../hermetic/generate_localizations_test.dart | 4 ++-- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/generate_localizations.dart b/packages/flutter_tools/lib/src/commands/generate_localizations.dart index 2800d6253b..31e79c3e9a 100644 --- a/packages/flutter_tools/lib/src/commands/generate_localizations.dart +++ b/packages/flutter_tools/lib/src/commands/generate_localizations.dart @@ -8,10 +8,10 @@ import '../artifacts.dart'; import '../base/common.dart'; import '../base/file_system.dart'; import '../base/logger.dart'; +import '../features.dart'; import '../localizations/gen_l10n.dart'; import '../localizations/localizations_utils.dart'; import '../runner/flutter_command.dart'; -import '../runner/flutter_command_runner.dart'; /// A command to generate localizations source files for a Flutter project. /// @@ -249,7 +249,7 @@ class GenerateLocalizationsCommand extends FlutterCommand { file: _fileSystem.file('l10n.yaml'), logger: _logger, defaultArbDir: defaultArbDir, - defaultSyntheticPackage: globalResults!.flag(FlutterGlobalOptions.kImplicitPubspecResolution), + defaultSyntheticPackage: !featureFlags.isExplicitPackageDependenciesEnabled, ); _logger.printStatus( 'Because l10n.yaml exists, the options defined there will be used ' diff --git a/packages/flutter_tools/lib/src/localizations/localizations_utils.dart b/packages/flutter_tools/lib/src/localizations/localizations_utils.dart index d43645f640..c1b4324cf4 100644 --- a/packages/flutter_tools/lib/src/localizations/localizations_utils.dart +++ b/packages/flutter_tools/lib/src/localizations/localizations_utils.dart @@ -8,8 +8,8 @@ import 'package:yaml/yaml.dart'; import '../base/common.dart'; import '../base/file_system.dart'; import '../base/logger.dart'; +import '../features.dart'; import '../runner/flutter_command.dart'; -import '../runner/flutter_command_runner.dart'; import 'gen_l10n_types.dart'; import 'language_subtag_registry.dart'; @@ -521,8 +521,8 @@ LocalizationOptions parseLocalizationsOptionsFromCommand({ // If provided explicitly, use the explicit value. syntheticPackage = command.boolArg('synthetic-package'); } else { - // Otherwise, inherit from whatever the default of --implicit-pubspec-resolution is. - syntheticPackage = command.globalResults!.flag(FlutterGlobalOptions.kImplicitPubspecResolution); + // Otherwise, inherit from whatever the reverse of flutter config --explicit-package-dependencies. + syntheticPackage = !featureFlags.isExplicitPackageDependenciesEnabled; } return LocalizationOptions( arbDir: command.stringArg('arb-dir') ?? defaultArbDir, diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart index 3f5104b096..e604a2857c 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart @@ -33,8 +33,6 @@ abstract final class FlutterGlobalOptions { static const String kLocalEngineSrcPathOption = 'local-engine-src-path'; static const String kLocalEngineHostOption = 'local-engine-host'; static const String kLocalWebSDKOption = 'local-web-sdk'; - // TODO(matanlurey): Remove one stable after https://github.com/flutter/flutter/issues/157819. - static const String kImplicitPubspecResolution = 'implicit-pubspec-resolution'; static const String kMachineFlag = 'machine'; static const String kPackagesOption = 'packages'; static const String kPrefixedErrorsFlag = 'prefixed-errors'; @@ -127,25 +125,6 @@ class FlutterCommandRunner extends CommandRunner { hide: !verboseHelp, ); - // TODO(matanlurey): Remove after the Q2 2025 stable release; this is intended - // to give application developers a single stable release where the .flutter-plugins - // file is still supported, but is deprecated, and let folks ensure (with CI or local - // testing) that their workflows do not depend on the file. - // - // See https://github.com/flutter/flutter/issues/157532. - argParser.addFlag(FlutterGlobalOptions.kImplicitPubspecResolution, - defaultsTo: true, - help: 'Whether to support (deprecated) implicit pubspec resolution ' - 'features, each of which are slated for removal in a future stable ' - 'release. By setting to "true", the following occurs:\n' - ' 1. The generation of ".flutter-plugins" (https://flutter.dev/to/flutter-plugins-configuration).\n' - ' 2. Including plugins registered as "dev_dependencies" in release mode.\n' - ' 3. Flutter localizations are by default output to synthetic "flutter_gen" package.\n' - '\n' - 'This flag will become "false" by default, and then features removed.', - hide: !verboseHelp, - ); - if (verboseHelp) { argParser.addSeparator('Local build selection options (not normally required):'); } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart index d1ec39f7d2..8f27e7eb07 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/generate_localizations_test.dart @@ -114,7 +114,7 @@ flutter: ProcessManager: () => FakeProcessManager.any(), }); - testUsingContext('not using synthetic packages (due to --no-implicit-pubspec-resolution)', () async { + testUsingContext('not using synthetic packages (due to --explicit-package-dependencies)', () async { final Directory l10nDirectory = fileSystem.directory( fileSystem.path.join('lib', 'l10n'), ); @@ -140,7 +140,6 @@ flutter: processManager: processManager, ); await createTestCommandRunner(command).run([ - '--no-implicit-pubspec-resolution', 'gen-l10n', ]); @@ -152,6 +151,7 @@ flutter: }, overrides: { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), + FeatureFlags: enableExplicitPackageDependencies, }); testUsingContext('throws error when arguments are invalid', () async {