Skip to content

add --force flag to precache - #31278

Merged
jonahwilliams merged 3 commits into
flutter:masterfrom
jonahwilliams:add_force_download
Apr 18, 2019
Merged

jonahwilliams merged 3 commits into
flutter:masterfrom
jonahwilliams:add_force_download

Conversation

@jonahwilliams

@jonahwilliams jonahwilliams commented Apr 18, 2019 •

Copy link
Copy Markdown
Contributor

Description

This allows users to force re-downloading of artifacts (due to corruption, or tools code errors) without needing to rm -rf bin/cache.

Related Issues

None

Tests

I added the following tests:

  • Downloads artifacts when --force is provided

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@zanderso zanderso left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm w/ nit

}
}
if (cache.isUpToDate()) {
if (cache.isUpToDate() && !argResults['force']) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: maybe easier to read flipped around:

final bool forceUpdate = argResult['force'];
if (forceUpdate || !cache.isUpToDate()) {
  await cache.updateAll(requiredArtifacts);
} else {
  printStatus(...);
}

Then you also don't evaluate cache.isUpToDate() when you have --force

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Perfect!

@jonahwilliams
jonahwilliams merged commit f5672b9 into flutter:master Apr 18, 2019
@jonahwilliams
jonahwilliams deleted the add_force_download branch April 18, 2019 23:05
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants