Skip to content

Does the copy task actualy do anything #173564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

reidbaker
Copy link
Contributor

@reidbaker reidbaker commented Aug 11, 2025

Reading the copyFlutterAssets gradle task there is a lot of configuration but surprisingly little copying of flutter assets.
This pr deletes most of what the task does in an effort to determine if the task is useful and/or if we have integration tests that cover flutter assets inclusion.

Related to #166550
From: packages/devicelab/
../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t module_host_with_custom_build_test

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • 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.

@reidbaker reidbaker requested a review from a team as a code owner August 11, 2025 17:43
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@reidbaker reidbaker marked this pull request as draft August 11, 2025 17:44
@reidbaker reidbaker requested a review from gmackall August 11, 2025 17:44
@github-actions github-actions bot added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Aug 11, 2025
Copy link
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 is an experiment to determine if the copyFlutterAssets Gradle task is still necessary by commenting out most of its logic. My feedback focuses on suggesting the complete removal of the commented-out code instead of leaving it in the codebase, as version control can be used to revert the changes if the experiment fails. This approach helps maintain code clarity and adheres to the project's style guide principle of optimizing for readability.

Comment on lines +752 to +778
// dependsOn(compileTask)
// with(compileTask.assets)
filePermissions {
user {
read = true
write = true
}
}
if (isUsedAsSubproject) {
// TODO(gmackall): above is always false, can delete
dependsOn(packageAssets)
dependsOn(cleanPackageAssets)
into(packageAssets!!.outputs)
}
val mergeAssets =
try {
variant.mergeAssetsProvider.get()
} catch (e: IllegalStateException) {
// TODO(gmackall): Migrate to AGPs variant api.
// https://github.com/flutter/flutter/issues/166550
@Suppress("DEPRECATION")
variant.mergeAssets
}
dependsOn(mergeAssets)
dependsOn("clean${FlutterPluginUtils.capitalize(mergeAssets.name)}")
mergeAssets.mustRunAfter("clean${FlutterPluginUtils.capitalize(mergeAssets.name)}")
into(mergeAssets.outputDir)
// if (isUsedAsSubproject) {
// // TODO(gmackall): above is always false, can delete
// dependsOn(packageAssets)
// dependsOn(cleanPackageAssets)
// into(packageAssets!!.outputs)
// }
// val mergeAssets =
// try {
// variant.mergeAssetsProvider.get()
// } catch (e: IllegalStateException) {
// // TODO(gmackall): Migrate to AGPs variant api.
// // https://github.com/flutter/flutter/issues/166550
// @Suppress("DEPRECATION")
// variant.mergeAssets
// }
// dependsOn(mergeAssets)
// dependsOn("clean${FlutterPluginUtils.capitalize(mergeAssets.name)}")
// mergeAssets.mustRunAfter("clean${FlutterPluginUtils.capitalize(mergeAssets.name)}")
// into(mergeAssets.outputDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Instead of commenting out this large block of code, it would be better to delete it entirely. The purpose of this PR is to test if this code is necessary, and version control systems like Git are excellent for managing experiments like this. If it turns out this code is still needed, it can be easily restored by reverting the commit.

Leaving commented-out code can lead to confusion and code rot. By deleting it, you make the intent clearer: this code is believed to be unused. This also aligns with the style guide's principle of optimizing for readability.1 If the experiment is successful, the code is already gone. If not, it's a simple git revert away.

                    filePermissions {
                        user {
                            read = true
                            write = true
                        }
                    }

Style Guide References

Footnotes

  1. Code should be optimized for readability. Leaving large blocks of commented-out code harms readability and should be avoided in favor of deleting the code and relying on version control history. (link)

@reidbaker reidbaker closed this Aug 12, 2025
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.

1 participant