Skip to content
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

Merge cargo-upgrade into cargo #685

Open
11 tasks
epage opened this issue Mar 31, 2022 · 8 comments
Open
11 tasks

Merge cargo-upgrade into cargo #685

epage opened this issue Mar 31, 2022 · 8 comments

Comments

@epage
Copy link
Collaborator

epage commented Mar 31, 2022

A scratchpad for rust-lang/cargo#12425

Merge plan

Open questions

  • How do we represent "fail if manifest will change" and "upgrade using lock file"
    • Currently "fail if manifest will change" is --locked and "upgrade using lock file" is --to-lockfile
    • Alt: if you squint --locked could also mean "upgrade using lock file"
    • Prompt the user for each upgrade by default but also accept --choice <none|locked|latest>
@epage
Copy link
Collaborator Author

epage commented Mar 31, 2022

Bugs

Requests

Uncertain

@epage
Copy link
Collaborator Author

epage commented Mar 31, 2022

Prior art

@epage
Copy link
Collaborator Author

epage commented Mar 31, 2022

Current design

cargo-upgrade 0.8.0
Upgrade dependencies as specified in the local manifest file (i.e. Cargo.toml)

USAGE:
    cargo upgrade [OPTIONS] [DEPENDENCY]...

ARGS:
    <DEPENDENCY>...    Crates to be upgraded

OPTIONS:
        --all                     [deprecated in favor of `--workspace`]
        --allow-prerelease        Include prerelease versions when fetching from crates.io (e.g. 0.6.0-alpha')
        --dry-run                 Print changes to be made without making them
        --exclude <EXCLUDE>       Crates to exclude and not upgrade
    -h, --help                    Print help information
        --manifest-path <PATH>    Path to the manifest to upgrade
        --offline                 Run without accessing the network
    -p, --package <PKGID>         Package id of the crate to add this dependency to
        --skip-compatible         Only update a dependency if the new version is semver incompatible
        --to-lockfile             Upgrade all packages to the version in the lockfile
    -V, --version                 Print version information
        --workspace               Upgrade all packages in the workspace
    -Z <FLAG>                     Unstable (nightly-only) flags [possible values: preserve-precision]

This command differs from `cargo update`, which updates the dependency versions recorded in the local lock file (Cargo.lock).

If `<dependency>`(s) are provided, only the specified dependencies will be upgraded. The version to upgrade to for each can be specified with e.g.
`docopt@0.8.0` or `serde@>=0.9,<2.0`.

Dev, build, and all target dependencies will also be upgraded. Only dependencies from crates.io are supported. Git/path dependencies will be
ignored.

All packages in the workspace will be upgraded if the `--workspace` flag is supplied. The `--workspace` flag may be supplied in the presence of a
virtual manifest.

If the '--to-lockfile' flag is supplied, all dependencies will be upgraded to the currently locked version as recorded in the Cargo.lock file. This
flag requires that the Cargo.lock file is up-to-date. If the lock file is missing, or it needs to be updated, cargo-upgrade will exit with an
error. If the '--to-lockfile' flag is supplied then the network won't be accessed.

@epage
Copy link
Collaborator Author

epage commented Mar 31, 2022

--manfest-path and --package working like normal but --exclude being an opt-out for when no DEPENDENCY is specified and we select all, is odd.

@epage
Copy link
Collaborator Author

epage commented Mar 31, 2022

Another open question is if we should somehow integrate this into cargo update or if it should remain a distinct command. I was hoping some prior art would help clarify some decisions here but not really.

@epage
Copy link
Collaborator Author

epage commented Jul 14, 2022

I split out the main UX question to #737

@TCROC
Copy link

TCROC commented Aug 13, 2023

Any update on this issue @epage ? I would love to see this merged into the cargo update command. Or at least into the official cargo distribution.

@epage
Copy link
Collaborator Author

epage commented Aug 13, 2023

A design for a subset of the functuionality being merged into cargo update has been FCPed: rust-lang/cargo#12425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants