You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #29: Convert rbmt to a cargo subcommand and move configs to the root
2aa3f6c Move config to root, not under contrib (Nick Johnson)
83680d9 Rename cargo-rbmt following cargo subcommand conventions (Nick Johnson)
Pull request description:
More learnings from working on the rust-psbt integration. The first patch renames the package and crate to `cargo-rbmt` which follows the [cargo subcommand convention](https://doc.rust-lang.org/cargo/reference/external-tools.html#custom-subcommands) so the tool can be called with `cargo rbmt...` after it is installed with `cargo install`. It can still be called with `cargo-rbmt` as well.
The second patch moves the config out of `contrib`. I put it there initially just following the style of the old shell scripts, but I think it is just confusing once it is the only thing sitting there (and is toml).
ACKs for top commit:
tcharding:
ACK 2aa3f6c
Tree-SHA512: 46db3492b4e5be6cc713df673989df176930a942b1b257b4770a0544c7f359ff4af1238eafddef0157f46dd22d2b8d4ed14ad20ae5be9c36e87943861153b6d2
Copy file name to clipboardExpand all lines: cargo-rbmt/README.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,11 @@ Maintainer tools for Rust-based projects in the Bitcoin domain. Built with [xshe
4
4
5
5
## Configuration
6
6
7
-
Configuration for `rbmt` is stored in `contrib/rbmt.toml`. The file can live at both the workspace root (e.g. `$ROOT/contrib/rbmt.toml`) as well as per-crate (e.g. `$ROOT/$CRATE/contrib/rbmt.toml`) within a repository.
7
+
Configuration for `rbmt` is stored in `rbmt.toml`. The file can live at both the workspace root (e.g. `$ROOT/rbmt.toml`) as well as per-package (e.g. `$ROOT/$PACKAGE/rbmt.toml`) within a repository.
8
8
9
9
### Lint
10
10
11
-
The `lint` command detects duplicate dependencies, but some may be unavoidable (e.g., during dependency updates where transitive dependencies haven't caught up). Configure the `[lint]` section to whitelist specific duplicates for a workspace (or a crate if only one crate in a repository).
11
+
The `lint` command detects duplicate dependencies, but some may be unavoidable (e.g., during dependency updates where transitive dependencies haven't caught up). Configure the `[lint]` section to whitelist specific duplicates for a workspace (or a package if only one package in a repository).
12
12
13
13
```toml
14
14
[lint]
@@ -20,7 +20,7 @@ allowed_duplicates = [
20
20
21
21
### Test
22
22
23
-
The `test` command can be configured to run feature matrix testing for your crate. Configure with the `contrib/rbmt.toml` file at the crate level.
23
+
The `test` command can be configured to run feature matrix testing for your package. Configure with the `rbmt.toml` file at the package level.
To ensure your crate works with the full range of declared dependency versions, `rbmt` requires two lock files in your repository.
66
+
To ensure your package works with the full range of declared dependency versions, `cargo-rbmt` requires two lock files in your repository.
67
67
68
68
*`Cargo-minimal.lock` - Minimum versions that satisfy your dependency constraints.
69
69
*`Cargo-recent.lock` - Recent/updated versions of dependencies.
70
70
71
-
The `rbmt lock` command generates and maintains these files for you. You can then use `--lock-file` with any command to test against either version set.
71
+
The `lock` command generates and maintains these files for you. You can then use `--lock-file` with any command to test against either version set.
72
72
73
73
### Usage
74
74
75
75
**Generate/update lock files**
76
76
77
77
```bash
78
-
rbmt lock
78
+
cargo rbmt lock
79
79
```
80
80
81
81
1. Verify that direct dependency versions aren't being bumped by transitive dependencies.
@@ -86,49 +86,49 @@ rbmt lock
86
86
87
87
```bash
88
88
# Test with minimal versions.
89
-
rbmt --lock-file minimal test stable
89
+
cargo rbmt --lock-file minimal test stable
90
90
91
91
# Test with recent versions.
92
-
rbmt --lock-file recent test stable
92
+
cargo rbmt --lock-file recent test stable
93
93
94
94
# Works with any command.
95
-
rbmt --lock-file minimal lint
96
-
rbmt --lock-file minimal docs
95
+
cargo rbmt --lock-file minimal lint
96
+
cargo rbmt --lock-file minimal docs
97
97
```
98
98
99
99
When you specify `--lock-file`, the tool copies that lock file to `Cargo.lock` before running the command. This allows you to test your code against different dependency version constraints.
100
100
101
101
## Workspace Integration
102
102
103
-
`rbmt` can simply be installed globally, or as a dev-dependency for more granular control of dependency versions.
103
+
`cargo-rbmt` can simply be installed globally on a system or added as a dev-dependency to a package.
104
104
105
-
### 1. Install globally
105
+
### 1. Install on system
106
106
107
107
Install the tool globally on your system with `cargo install`.
108
108
109
109
```bash
110
-
cargo install rust-bitcoin-maintainer-tools@0.1.0
110
+
cargo install cargo-rbmt@0.1.0
111
111
```
112
112
113
-
Then run from anywhere in your repository.
113
+
Then run from anywhere in your repository as a cargo subcommand. It can also be called directly as `cargo-rbmt`.
114
114
115
115
```bash
116
-
rbmt lint
116
+
cargo rbmt lint
117
117
```
118
118
119
119
### 2. Add as a dev-dependency
120
120
121
-
Add as a dev-dependency to a workspace member. This pins the tool version in your lockfile for reproducible builds.
121
+
Add as a dev-dependency to a workspace member. This pins the tool version in your lockfile for reproducible builds. But this also means that `cargo-rbmt` dependencies could influence version resolution for the workspace.
122
122
123
123
```toml
124
124
[dev-dependencies]
125
-
rust-bitcoin-maintainer-tools = "0.1.0"
125
+
cargo-rbmt = "0.1.0"
126
126
```
127
127
128
128
Then run via cargo.
129
129
130
130
```bash
131
-
cargo run --bin rbmt -- lint
131
+
cargo run --bin cargo-rbmt -- lint
132
132
```
133
133
134
134
It might be worth wrapping in an [xtask](https://github.com/matklad/cargo-xtask) package for a clean interface.
0 commit comments