Add flutter: config: {...} section to pubspec.yaml to influence FeatureFlags#167953
Conversation
| /// The value is resolved, if possible, in the following order, where if a | ||
| /// step resolves to a boolean value, no further steps are attempted. | ||
| /// | ||
| /// ## Environment Variable |
There was a problem hiding this comment.
Consider making it clearer this is an ordered list:
| /// The value is resolved, if possible, in the following order, where if a | |
| /// step resolves to a boolean value, no further steps are attempted. | |
| /// | |
| /// ## Environment Variable | |
| /// The value is resolved, if possible, in the following order, where if a | |
| /// step resolves to a boolean value, no further steps are attempted: | |
| /// | |
| /// ## 1. Environment Variable |
| /// The value is resolved, if possible, in the following order, where if a | ||
| /// step resolves to a boolean value, no further steps are attempted. | ||
| /// | ||
| /// ## Environment Variable |
There was a problem hiding this comment.
In the current implementation, the environment variable has lower priority than the global config. Could we keep that order and make the local project configuration the highest priority?
| /// | ||
| /// [globalConfig] reads values stored by the `flutter config` tool, which | ||
| /// are normally in the user's `%HOME` directory (varies by system), while | ||
| /// [projectManfiest] reads values from the _current_ Flutter project's |
There was a problem hiding this comment.
| /// [projectManfiest] reads values from the _current_ Flutter project's | |
| /// [projectManifest] reads values from the _current_ Flutter project's |
| expect( | ||
| flutterMacOSDesktopFeature.generateHelpMessage(), | ||
| 'Enable or disable support for desktop on macOS.', | ||
| testWithoutContext('reads from configuration if avaialble', () { |
There was a problem hiding this comment.
| testWithoutContext('reads from configuration if avaialble', () { | |
| testWithoutContext('reads from configuration if available', () { |
| ); | ||
| }, overrides: <Type, Generator>{Analytics: () => fakeAnalytics}); | ||
|
|
||
| testUsingContext('overriden by the content in pubspec.yaml', () async {}); |
There was a problem hiding this comment.
Looks like this can be deleted
loic-sharma
left a comment
There was a problem hiding this comment.
Looks good overall, one open question on ordering
|
Thanks for the review! Will come back to this shortly, agree on changes. |
bkonyi
left a comment
There was a problem hiding this comment.
LGTM once @loic-sharma's comments are addressed.
| }); | ||
| } | ||
|
|
||
| const Feature _noConfigFeature = Feature(name: 'example'); |
There was a problem hiding this comment.
Ubernit: should these constants be top of file for readability?
| }); | ||
|
|
||
| /// Flutter Web | ||
| FileSystem createFsWithPubspec(String pubspec) { |
There was a problem hiding this comment.
Nit: Since we're only using this in one place, can we instead hardcode the contents of pubspec here and not take a parameter? That way it's obvious what the contents of the pubspec are without scrolling to the bottom of the test.
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
| } | ||
| return isEnabled; | ||
|
|
||
| // Otherwise, read it from environment variable > project manifest > global config |
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
added missing '/' https://github.comflutter/flutter/pull/167953 => flutter/flutter#167953
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…FeatureFlags` (flutter#167953) Closes flutter#167667. In this PR: - `FlutterFeaturesConfig` reads from the global config, current pubspec.yaml, and environment - `FeatureFlags` now delegates "was this configured" to `FlutterFeaturesConfig` - `featureFlags` (`Context`) now is created with knowledge of the current `pubpec.yaml`, if any Once this lands and we play with it a bit (i.e. migrate `disable-swift-package-manager`), we can publicize it and update website documentation (it won't make it into this beta/stable release anyway). I did a significant rewrite of `feature_test`, as lots of what was being tested no longer made sense.
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
…luence `FeatureFlags` (flutter/flutter#167953)
#12925) ## Description Updates the Swift Package Manager documentation to use the new `flutter: config:` section format for pubspec.yaml configuration, replacing the deprecated `disable-swift-package-manager` field. ## Changes **File:** `src/_includes/docs/swift-package-manager/how-to-enable-disable.md` ### Before (deprecated) ```yaml flutter: disable-swift-package-manager: true ``` ### After (current) ```yaml flutter: config: enable-swift-package-manager: false ``` ## Additional Changes - Added a migration note to help users who were using the deprecated syntax - The note explains that the old syntax produces an error in Flutter 3.38 and later ## Context This change aligns the Swift Package Manager documentation with: - The [pubspec options documentation](https://docs.flutter.dev/tools/pubspec) which already uses the new syntax - [flutter/flutter#168433](flutter/flutter#168433) which moved the config to the `config` section - [flutter/flutter#167953](flutter/flutter#167953) which introduced the `flutter: config:` section ## Testing - Verified the new syntax matches what's documented in `src/content/tools/pubspec.md` - Confirmed the markdown formatting follows existing patterns in the file ## Related Issues Fixes #12924 ## Pre-launch Checklist - [x] I read the [Contributor Guide](https://github.com/flutter/website/blob/main/CONTRIBUTING.md) - [x] I signed the [CLA](https://cla.developers.google.com/clas) - [x] I listed at least one issue that this PR fixes in the description above
Closes #167667.
In this PR:
FlutterFeaturesConfigreads from the global config, current pubspec.yaml, and environmentFeatureFlagsnow delegates "was this configured" toFlutterFeaturesConfigfeatureFlags(Context) now is created with knowledge of the currentpubpec.yaml, if anyOnce this lands and we play with it a bit (i.e. migrate
disable-swift-package-manager), we can publicize it and update website documentation (it won't make it into this beta/stable release anyway).I did a significant rewrite of
feature_test, as lots of what was being tested no longer made sense.