Skip to content

[flutter_tools] Write dart-defines to local.properties to avoid windows cmd line length restriction#186352

Open
frederikstonge wants to merge 7 commits into
flutter:masterfrom
frederikstonge:features/fred/dart-define-locale-properties
Open

[flutter_tools] Write dart-defines to local.properties to avoid windows cmd line length restriction#186352
frederikstonge wants to merge 7 commits into
flutter:masterfrom
frederikstonge:features/fred/dart-define-locale-properties

Conversation

@frederikstonge
Copy link
Copy Markdown

#186351

This PR solves an issue where big json file passed as --dart-define-from-file would cause an error in gradle on Windows :

image

This will instead write dart-defines in local.properties instead of being passed as argument to flutter.bat.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@frederikstonge frederikstonge requested a review from a team as a code owner May 11, 2026 16:07
@frederikstonge frederikstonge requested review from reidbaker and removed request for a team May 11, 2026 16:07
Copy link
Copy Markdown
Contributor

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

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 moves dart-defines from command-line arguments to the local.properties file for Android builds to prevent exceeding command-line length limits on Windows. It adds an encodedDartDefines property to the BuildInfo class and updates the Gradle plugin and utility logic accordingly. Review feedback recommends generalizing the documentation in the platform-agnostic BuildInfo class to avoid platform-specific references and broken links.

Comment thread packages/flutter_tools/lib/src/build_info.dart Outdated
Comment thread packages/flutter_tools/lib/src/build_info.dart Outdated
@github-actions github-actions Bot added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. team-android Owned by Android platform team labels May 11, 2026
@frederikstonge
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown
Contributor

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

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 transitions the handling of dart-defines for Android by writing them to local.properties and promoting them to Gradle project properties, rather than passing them as command-line arguments. Feedback highlights critical syntax errors in Dart map initializations, a potential UninitializedPropertyAccessException in the Kotlin plugin code, and a violation of the style guide regarding the removal of documentation for a public method.

Comment thread packages/flutter_tools/lib/src/build_info.dart Outdated
Comment thread packages/flutter_tools/lib/src/build_info.dart Outdated
Comment thread packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt Outdated
Comment thread packages/flutter_tools/lib/src/build_info.dart
@frederikstonge
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown
Contributor

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

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 refactors the handling of dart-defines for Android builds by moving them from Gradle configuration arguments to local.properties. The FlutterPlugin now promotes these values to Gradle project properties, and corresponding tests have been updated to verify this new implementation. I have no feedback to provide.

@frederikstonge frederikstonge changed the title Write dart-defines to local.properties to avoid windows cmd line length restriction [flutter_tools] Write dart-defines to local.properties to avoid windows cmd line length restriction May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform-android Android applications specifically team-android Owned by Android platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant