Add and plumb useImplicitPubspecResolution across flutter_tools. (#157879)

Work towards https://github.com/flutter/flutter/issues/157819. **No behavior changes as a result of this PR**.

Based on a proof of concept by @jonahwilliams (https://github.com/flutter/flutter/pull/157818).

The existence of this flag (which for the time being, defaults to `true`) implies the following:

1. The (legacy, deprecated) `.flutter-plugins` file is not generated:
    https://docs.flutter.dev/release/breaking-changes/flutter-plugins-configuration
    
2. The (legacy, deprecated) `package:flutter_gen` is not synthetically generated:
    https://github.com/flutter/website/pull/11343
    (awaiting website approvers, but owners approve this change)

This change creates `useImplicitPubspecResolution` and plumbs it through as a required variable, parsing it from a `FlutterCommand.globalResults` where able. In tests, I've defaulted the value to `true` 100% of the time - except for places where the value itself is acted on directly, in which case there are true and false test-cases (e.g. localization and i10n based classes and functions).

I'm not extremely happy this needed to change 50+ files, but is sort of a result of how inter-connected many of the elements of the tools are. I believe keeping this as an explicit (flagged) argument will be our best way to ensure the default behavior changes consistently and that tests are running as expected.
This commit is contained in:
Matan Lurey
2024-10-31 03:43:25 -07:00
committed by GitHub
parent 6aaa387f2e
commit fb022290ff
57 changed files with 409 additions and 40 deletions

View File

@@ -183,7 +183,7 @@ void testUsingContext(
// can provide the AlwaysFalseBotDetector in the overrides, or its own
// BotDetector implementation in the overrides.
BotDetector: overrides[BotDetector] ?? () => const FakeBotDetector(true),
});
}, useImplicitPubspecResolution: true);
}, testOn: testOn, skip: skip);
// We don't support "timeout"; see ../../dart_test.yaml which
// configures all tests to have a 15 minute timeout which should

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}) {
Future<T?> run<T>(FutureOr<T> Function() test, {Map<Type, Generator>? overrides, bool useImplicitPubspecResolution = true}) {
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());
}
}