Sitelet https://github.com/flutter/flutter/pull/191082
Skip to content

[flutter_tools] Resolve includes recursively in AnalysisOptionsMigration - #191082

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:issue-191056
Aug 14, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:issue-191056

Conversation

@bkonyi

@bkonyi bkonyi commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

AnalysisOptionsMigration was ignoring include: directives in analysis_options.yaml files, causing it to repeatedly rewrite files that already inherited the required platform and build directory exclusions (such as build/**, android/**, etc.) from included files (either relative paths or package: URIs).

This PR updates AnalysisOptionsMigration to:

  • Recursively resolve and collect analyzer exclude: patterns from include: directives.
  • Support both relative paths and package: URIs for includes (using PackageConfig).
  • Support multiple includes (when include is specified as a YAML list).
  • Guard against infinite recursion on cyclic includes using canonical normalized paths.
  • Safely extract exclude patterns to prevent crashes on malformed files.
  • Pass PackageConfig from ensureReadyForPlatformSpecificTooling to AnalysisOptionsMigration.

Related Issues

Fixes #191056

Tests

  • Added unit tests in analysis_options_migration_test.dart:
    • skipped if exclusions are inherited via relative include
    • skipped if exclusions are inherited via package include
    • skipped if exclusions are inherited via multiple includes
    • handles cyclic includes without crashing
    • handles invalid exclude types without crashing

bkonyi added 2 commits August 13, 2026 18:40
AnalysisOptionsMigration was ignoring include: directives, causing it to repeatedly rewrite analysis_options.yaml files that already inherited the required exclusions.

This change updates the migrator to recursively collect excludes from includes, supporting relative paths and package: URIs, multiple includes, and cycle detection.

Fixes flutter#191056
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 13, 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 AnalysisOptionsMigration to recursively collect analyzer exclude patterns from analysis_options.yaml and any referenced configuration files via include directives, supporting both relative paths and package: URIs while preventing infinite recursion on cyclic includes. Feedback suggests using path.canonicalize to robustly handle case-insensitivity during cycle detection on Windows and macOS, and wrapping synchronous file reads in a try-catch block to gracefully handle potential FileSystemExceptions.

Comment thread packages/flutter_tools/lib/src/migrations/analysis_options_migration.dart Outdated
Comment thread packages/flutter_tools/lib/src/migrations/analysis_options_migration.dart Outdated
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 13, 2026
@bkonyi
bkonyi requested a review from chingjun August 13, 2026 20:09
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 13, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 13, 2026
Merged via the queue into flutter:master with commit 74f87bd Aug 14, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 14, 2026
@bkonyi bkonyi added the cp: stable cherry pick this pull request to stable release candidate branch label Aug 18, 2026
@AlexV525 AlexV525 added the cp: beta cherry pick this pull request to beta release candidate branch label 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 ignores include:, repeatedly rewriting analysis_options.yaml files that already inherit the exclusions

3 participants