Skip to content

Conversation

@camsim99
Copy link
Contributor

@camsim99 camsim99 commented Jan 17, 2025

Makes the following change to fix the case where dev dependencies are stripped in apps that only contain dev dependencies:

  • Changes the Flutter Gradle plugin to add the Flutter embedding as a direct dependency of a Flutter app if it contains no plugins that would include it transitively (this excludes dev dependencies in release builds)

Makes the following changes to correct + improve the integration test that checks if dev dependencies are stripped from release builds:

  • Fixes the plugin that was supposed to be as dev dependency to actually be a dev dependency
  • Changes the test structure to check the output of ./gradlew app:dependencies (see more details on this call) instead of the classes included in the APK. Checking the APK was leading us astray because it appears obfuscation occurs for release builds.
  • Adds more sections, comments, etc.

Fixes #161780.

Pre-launch Checklist

@camsim99 camsim99 marked this pull request as draft January 17, 2025 19:25
@github-actions github-actions bot added a: tests "flutter test", flutter_test, or one of our tests platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. framework flutter/packages/flutter repository. See also f: labels. f: integration_test The flutter/packages/integration_test plugin labels Jan 17, 2025
@camsim99 camsim99 changed the title [Android] Fix integration test to checl if dev dependencies are removed from release builds + address no non-dev dependency plugin edge case [Android] Fix integration test to check if dev dependencies are removed from release builds + address no non-dev dependency plugin edge case Jan 17, 2025
@github-actions github-actions bot removed a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. f: integration_test The flutter/packages/integration_test plugin labels Jan 22, 2025
Comment on lines +54 to +60
final RegExp regExpToMatchDevDependencyPlugin = RegExp(
r'--- project :dev_dependency_plugin',
);
final RegExp regExpToMatchDevDependencyPluginWithTransitiveDependencies = RegExp(
r'--- project :dev_dependency_plugin\n(\s)*\+--- org.jetbrains.kotlin.*\s\(\*\)\n(\s)*\\---\sio.flutter:flutter_embedding_' +
buildMode,
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there's any feedback on the regex I used please let me know! My intention was to make the check for release builds much looser in case the dev dependency is included in some way we don't expect. The other builds should always include the dev dependency plugin that depends on the Flutter embedding and because the default language is Kotlin (I think?), the Kotlin plugin as well.

I can include sample outputs here if helpful for review.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems reasonable for now.

@camsim99 camsim99 requested a review from matanlurey January 22, 2025 23:00
@camsim99 camsim99 marked this pull request as ready for review January 22, 2025 23:10
@camsim99
Copy link
Contributor Author

Sorry didn't mean to leave this as a draft :)

Copy link
Contributor

@matanlurey matanlurey left a comment

Choose a reason for hiding this comment

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

LGTM! I did not have a chance to try this locally but I trust you did :)

@camsim99
Copy link
Contributor Author

I did test it locally :) but in an effort to catch any outstanding issued I merged this with #160289 to see what happened. There are failures. They seem unrelated, but just going to double check before I cause a regression for modules.

@matanlurey
Copy link
Contributor

I did test it locally :) but in an effort to catch any outstanding issued I merged this with #160289 to see what happened. There are failures. They seem unrelated, but just going to double check before I cause a regression for modules.

These look like "good" failures (https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8724551273408643713/+/u/run_test.dart_for_tool_tests_shard_and_subshard_commands/stdout), that is, they would be fixed by #160289.

@camsim99
Copy link
Contributor Author

Hmm but I merged this PR with that one to get those failures? Can you elaborate on why you think it might have fixed that failure?

@matanlurey
Copy link
Contributor

Hmm but I merged this PR with that one to get those failures? Can you elaborate on why you think it might have fixed that failure?

Shoot, I mis-remembered patching those tests to read from the right directory.

I'll send you a PR instead.

@matanlurey
Copy link
Contributor

#162289

github-merge-queue bot pushed a commit that referenced this pull request Jan 29, 2025
…#162289)

@camsim99 discovered these would fail here:
#161826 (comment).

This fixes in preparation for the flag flipping, and also fixes a bug in
resolving `synthetic-package` I missed (it _can't_ be true if
`--explicit-package-dependencies` is set).
@camsim99
Copy link
Contributor Author

camsim99 commented Jan 29, 2025

Updated #162262 to check out the state of things before landing.

Specifically wanna debug https://github.com/flutter/flutter/pull/162262/checks?check_run_id=36373107100. I tested on master a few days ago and it also failed (but different error). Just want to make sure this is not related.

Update: there are failures but I'm confident this change needs to land anyway and the ones I'm concerned about passed on this PR.

@camsim99 camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 29, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jan 29, 2025
Merged via the queue into flutter:master with commit 522eda0 Jan 29, 2025
167 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 29, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 30, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 30, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 30, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 30, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 31, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 31, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 1, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 1, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 2, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 2, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 3, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 3, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
…re removed from release builds + address no non-dev dependency plugin edge case (flutter/flutter#161826)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🛑 flutter config --explicit-package-dependencies-: Gradle release build fails with only dev-dependencies

2 participants