Skip to content

Only exclude platform directories that actually exist in analysis_options.yaml - #191151

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
JayeshJain25:fix-analysis-options-web-exclude-191131
Aug 19, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
JayeshJain25:fix-analysis-options-web-exclude-191131

Conversation

@JayeshJain25

Copy link
Copy Markdown
Contributor

AnalysisOptionsMigration wrote a fixed seven-entry exclude list (android/**, ios/**, web/**, windows/**, macos/**, linux/**, plus build/**) into analysis_options.yaml on every flutter pub get / flutter analyze / flutter run / flutter build, regardless of what the project actually contains.

Two concrete problems from this:

  • A Dart-only package (e.g. dart create -t web) that uses web/ as a real source directory gets it silently excluded from analysis the first time any flutter command touches the package (this happens in mixed Flutter/Dart monorepos and Dart workspaces).
  • A Flutter app created with flutter create --platforms=android,ios still gets exclusions for web/, windows/, macos/, and linux/, which it doesn't have, and ProjectMigrator has no opt-out — every command restores the full list.

Fix:

  • AnalysisOptionsMigration.migrate() now skips entirely when the package has no flutter dependency (i.e. it isn't a Flutter project at all — the discriminator suggested in the issue).
  • The exclude list is now built conditionally from 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 by flutter 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

@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 15, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bkonyi bkonyi added the CICD Run CI/CD label Aug 18, 2026
@bkonyi
bkonyi requested review from bkonyi and chingjun August 18, 2026 15:36

@bkonyi bkonyi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 18, 2026
@chingjun chingjun added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Aug 18, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 18, 2026
@auto-submit

auto-submit Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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
@chingjun
chingjun force-pushed the fix-analysis-options-web-exclude-191131 branch from c47cafa to d564667 Compare August 18, 2026 19:40
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 18, 2026
@chingjun chingjun added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Aug 18, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 18, 2026
Merged via the queue into flutter:master with commit c7a822e Aug 19, 2026
25 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 19, 2026
@AlexV525 AlexV525 added cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch labels Aug 22, 2026
@flutteractionsbot

Copy link
Copy Markdown
Contributor

Failed to create CP due to merge conflicts.
You will need to create the PR manually. See the cherrypick wiki for more info.

@AlexV525 AlexV525 added cp: beta cherry pick this pull request to beta release candidate branch and removed cp: beta cherry pick this pull request to beta release candidate branch labels Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnalysisOptionsMigration excludes web/** unconditionally, silently dropping Dart web package sources from analysis

5 participants