Repository navigation
Only exclude platform directories that actually exist in analysis_options.yaml - #191151
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the analysis options migration and template generation in flutter_tools to conditionally exclude platform directories (such as android, ios, web, windows, macos, and linux) only if they exist in the project. Additionally, the migration is skipped entirely for pure Dart packages that do not have a flutter dependency. Unit and integration tests have been added to verify these changes. There are no review comments, and I have no feedback to provide.
|
autosubmit label was removed for flutter/flutter/191151, because - The status or check suite ci.yaml validation has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…ions.yaml AnalysisOptionsMigration wrote a fixed seven-entry exclude list (android/**, ios/**, web/**, windows/**, macos/**, linux/**) regardless of which platforms a project actually has, so a Dart-only package using web/ as a source directory (e.g. `dart create -t web`) silently lost analysis coverage, and a Flutter app created with --platforms=android,ios still got exclusions for platforms it doesn't have. The migration now skips entirely for non-Flutter packages (no `flutter` dependency) and only excludes a platform directory if project.<platform>.existsSync() is true. The `flutter create` app template's analysis_options.yaml.tmpl is updated the same way, using the existing per-platform mustache context. Fixes flutter#191131
c47cafa to
d564667
Compare
|
Failed to create CP due to merge conflicts. |
AnalysisOptionsMigrationwrote a fixed seven-entryexcludelist (android/**,ios/**,web/**,windows/**,macos/**,linux/**, plusbuild/**) intoanalysis_options.yamlon everyflutter pub get/flutter analyze/flutter run/flutter build, regardless of what the project actually contains.Two concrete problems from this:
dart create -t web) that usesweb/as a real source directory gets it silently excluded from analysis the first time anyfluttercommand touches the package (this happens in mixed Flutter/Dart monorepos and Dart workspaces).flutter create --platforms=android,iosstill gets exclusions forweb/,windows/,macos/, andlinux/, which it doesn't have, andProjectMigratorhas no opt-out — every command restores the full list.Fix:
AnalysisOptionsMigration.migrate()now skips entirely when the package has noflutterdependency (i.e. it isn't a Flutter project at all — the discriminator suggested in the issue).project.<platform>.existsSync()for each platform, so only directories the project actually has as platform scaffolds are excluded.build/**stays unconditional.templates/app/analysis_options.yaml.tmpl(used byflutter create) gets the same per-platform conditionals via the existing mustache context ({{#android}},{{#ios}}, etc.), so newly created projects don't get the fixed list either.Fixes #191131
Pre-launch Checklist
///).