dependencies-patch

Crates.iodependencies-patch
lib.rsdependencies-patch
version
sourcesrc
created_at2024-05-19 15:12:53.390876
updated_at2024-10-17 07:59:02.030612
descriptionA simple tool to patch cargo dependencies with command line commands.
homepage
repositoryhttps://github.com/Azure-stars/dependencies-patch
max_upload_size
id1244984
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Firefly (Azure-stars)

documentation

README

dependencies-patch

A simple tool to patch cargo dependencies with command line commands.

Todo List

  • Support for packages from github

  • Support for packages from other URL

  • Support for packages from crates-io

  • Support for packages from other registries

Installation

$ cargo install dependencies-patch

Usage

The Cargo.toml for example_project looks like this:

[package]
edition = "2021"
name = "project1"
version = "0.1.0"

[workspace]

[dependencies]
log = "0.4"

Then run following commands to patch the log dependency to a git repository:

$ dependencies-patch --help
$ dependencies-patch -c /path/to/example_project -n log -t git --git-repo rust-lang/log

After running the command, the Cargo.toml will be updated to:

[package]
edition = "2021"
name = "project1"
version = "0.1.0"

[workspace]

[dependencies]
log = "0.4"

[patch.crates-io.log]
git = "https://github.com/rust-lang//log.git"

We can also patch the package to the local path by running the following commands:

$ dependencies-patch -c . -n log -t path --patch-path ../log

And the Cargo.toml will be updated to:

[package]
name = "helloworld"
version = "0.1.0"
edition = "2021"

[dependencies]
log = "0.4"

[patch.crates-io.log]
path = "../log"

More usages can be known by running dependencies --help command.

Notes

The tool can only add patches to the Cargo.toml file. It don't support removing patches.

Commit count: 9

cargo fmt