Move explicit package dependencies to a feature flag (#158016)

Closes https://github.com/flutter/flutter/issues/158012.

This is (effectively) a user-facing NOP, which is exchanging an
on-by-default command-line argument (`--implicit-pubspec-resolution`)
for an off-by-default global feature flag
(`explicit-package-dependencies`). It matches the mental model better,
is less painstaking to maintain and feed throughout, and will be easier
to globally flip on/off in a future PR.

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
This commit is contained in:
Matan Lurey
2024-11-13 18:33:34 -08:00
committed by GitHub
parent 9ac9049d09
commit 125b4e945e
65 changed files with 224 additions and 436 deletions

View File

@@ -482,6 +482,7 @@ class TestFeatureFlags implements FeatureFlags {
this.isNativeAssetsEnabled = false,
this.isPreviewDeviceEnabled = false,
this.isSwiftPackageManagerEnabled = false,
this.isExplicitPackageDependenciesEnabled = false,
});
@override
@@ -520,6 +521,9 @@ class TestFeatureFlags implements FeatureFlags {
@override
final bool isSwiftPackageManagerEnabled;
@override
final bool isExplicitPackageDependenciesEnabled;
@override
bool isEnabled(Feature feature) {
return switch (feature) {
@@ -533,6 +537,7 @@ class TestFeatureFlags implements FeatureFlags {
flutterCustomDevicesFeature => areCustomDevicesEnabled,
cliAnimation => isCliAnimationEnabled,
nativeAssets => isNativeAssetsEnabled,
explicitPackageDependencies => isExplicitPackageDependenciesEnabled,
_ => false,
};
}

View File

@@ -92,7 +92,7 @@ class Testbed {
///
/// `overrides` may be used to provide new context values for the single test
/// case or override any context values from the setup.
Future<T?> run<T>(FutureOr<T> Function() test, {Map<Type, Generator>? overrides, bool useImplicitPubspecResolution = true}) {
Future<T?> run<T>(FutureOr<T> Function() test, {Map<Type, Generator>? overrides}) {
final Map<Type, Generator> testOverrides = <Type, Generator>{
..._testbedDefaults,
// Add the initial setUp overrides
@@ -139,7 +139,7 @@ class Testbed {
}
return null;
});
}, useImplicitPubspecResolution: useImplicitPubspecResolution);
});
}, createHttpClient: (SecurityContext? c) => FakeHttpClient.any());
}
}