Skip to content

Invalidate build target when new output file is added #170253

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

Merged

Conversation

vashworth
Copy link
Contributor

Build targets are re-run when invalidated. This PR changes it so when a new output file is added to the expected output files, the build target will be invalidated and re-run.

This PR also changes canSkip to an async call.

These changes are needed for #166486.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 9, 2025
@vashworth vashworth marked this pull request as ready for review June 9, 2025 15:47
@vashworth vashworth requested a review from bkonyi June 9, 2025 15:48
Copy link
Contributor

@bkonyi bkonyi left a comment

Choose a reason for hiding this comment

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

LGTM with one question.

@@ -152,7 +152,7 @@ abstract class Target {
///
/// Returning `true` will cause [build] to be skipped. This is equivalent
/// to a build that produces no outputs.
bool canSkip(Environment environment) => false;
Future<bool> canSkip(Environment environment) async => false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this need to be made async?

Copy link
Contributor Author

@vashworth vashworth Jun 9, 2025

Choose a reason for hiding this comment

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

I have a big PR coming and I'm trying to break it out into smaller bits. Eventually I want to add this, which requires it to be async:

https://github.com/vashworth/flutter/blob/f515bd0f507480566bf873330e67df11b2688f94/packages/flutter_tools/lib/src/build_system/targets/darwin.dart#L123-L171

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 9, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jun 9, 2025
Merged via the queue into flutter:master with commit 56d4b7b Jun 9, 2025
143 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 9, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants