-
-
Notifications
You must be signed in to change notification settings - Fork 98
feat(autodiscovery/cargo): switch cargo update to cargo-upgrade #4793
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
Conversation
This would be a breaking change today, what if the cargo update is not available? We uses this approach on the npm plugin which I like, it provides an easy fallback |
fbfaa2f
to
76d2175
Compare
76d2175
to
206dd9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Cargo plugin to use cargo-upgrade instead of cargo update, preventing unwanted reformatting of Cargo.toml files. Key changes include adding new helper functions to detect cargo and cargo-upgrade availability, updating test cases for various workspace and lockfile scenarios, and modifying the dependency manifest generation to run shell commands when cargo-upgrade is available.
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
pkg/plugins/resources/cargopackage/source_test.go | Adds a new test case for retrieving the latest crate-test version. |
pkg/plugins/autodiscovery/cargo/utils_test.go | Introduces additional tests for cargo file discovery and metadata parsing. |
pkg/plugins/autodiscovery/cargo/utils.go | Adds helper functions (isCargoAvailable/isCargoUpgradeAvailable) and updates getCrateMetadata. |
pkg/plugins/autodiscovery/cargo/testdata/** | Updates various Cargo.toml and source files for workspace and lock scenarios with new syntax. |
pkg/plugins/autodiscovery/cargo/main.go | Adds fields for cargo and cargo-upgrade availability, and switches version filter constant. |
pkg/plugins/autodiscovery/cargo/dependencyManifest.go | Updates the manifest template to use cargo-upgrade when available. |
pkg/plugins/autodiscovery/cargo/dependencies.go | Incorporates new metadata fields and refines manifest generation and dependency processing. |
Files not reviewed (1)
- pkg/plugins/autodiscovery/cargo/testdata/.gitignore: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
I just tested on updatecli-test/kwctl#1 |
I think it would be nice to update the documentation to highlight that Updatecli leverages cargo-edit if it's installed |
Fix #4792
Change the update in the Cargo.toml from
toml
toshell
withcargo-upgrade
.This allows for the change to not reformat the
Cargo.toml
Test
To test this pull request, you can run the following commands:
Additional Information
Checklist
Tradeoff
cargo-edit
becomes a requirement for this to workPotential improvement