particle-iot / particle-cli

Command Line Interface for Particle Cloud and devices
Apache License 2.0
212 stars 92 forks source link

Feature/sc 123873/check hash #693

Closed keeramis closed 9 months ago

keeramis commented 9 months ago

Description

Currently, particle flash --local command flashes all the assets that are provided by the Particle project or the user app bundle. This PR skips flashing an asset which is already existing on the device. The reason for this change is to improve flashing times, which can be especially beneficial for large projects or when working with devices that have a significant amount of existing assets.

This PR only makes changes to the particle flash --local command and others are unchanged.

How to Test

Setup:

  1. Point particle-usb to this branch: https://github.com/particle-iot/particle-usb/pull/96
  2. Use device-os this branch on the device: https://github.com/particle-iot/device-os/pull/2711
    • Don't forget to pull submodules

Test:

  1. Create a Particle project with a single asset (say, assetA)
  2. Create a bundle using particle bundle myApp.bin --assets /path/to/assets
  3. Flash it using particle flash --local myApp.zip. Watch the progress
  4. Verify that myApp.bin and assetA are flashed
  5. Add an additional asset to this Particle project (say, assetB)
  6. Create a new bundle using particle bundle myApp.bin --assets /path/to/assets
  7. Flash it using particle flash --local myApp.zip. Watch the progress
  8. Verify that myApp.bin and assetB are flashed. assetA will be skipped with a log message saying Skipping asset assetA because it is already on the device
Flashing p2 0a10aced202194944a02c4d4
Skipping asset random.txt because it is already on the device
[█████████████████████████] 100% | Flashing random2.txt
Flash success!

Related Issues / Discussions

SC: https://app.shortcut.com/particle/story/123873/flash-asset-only-if-it-s-not-existing-on-the-device Protobuf PR: https://github.com/particle-iot/device-os-protobuf/pull/22 Particle USB PR: https://github.com/particle-iot/particle-usb/pull/96 Device OS PR: https://github.com/particle-iot/device-os/pull/2711

Completeness