mcgoo / cargo-vcpkg

Get external dependencies in one step by specifying vcpkg details in Cargo.toml
Apache License 2.0
39 stars 6 forks source link

Miss-use of the local cache when switching upstream URL. #10

Open Yamakaky opened 3 years ago

Yamakaky commented 3 years ago

With this modification and caching enabled, cargo vcpkg build seems to build with the new branch but on the old remote. I think the cache should be invalidated when either of them change.

From https://github.com/microsoft/vcpkg
   fa1bbe097..261c458af  master     -> origin/master
    Checkout rev sdl-hidapi
error: pathspec 'sdl-hidapi' did not match any file(s) known to git
kornelski commented 3 years ago

Does it work if you use branch = "sdl-hidapi" instead of rev?

waych commented 3 years ago

@kornelski is right in that branch must be used instead of rev if you intend to track a branch instead of pinning to a specific commit revision.

If "caching enabled" here refers to using actions/cache@v2 then I don't think there is a good way to generate the key for the cache such that the key gets updated when the branch being tracked moves, as the file the key is based off of (Cargo.toml in this case) isn't touched when the branch changes.