Skip to content

Commit

Permalink
feat(xtask): 'changes' xtask
Browse files Browse the repository at this point in the history
This will report what commits affect each publishable package and serves
as an alternative to rust-lang#12085.

CI can run this as `cargo changes HEAD~ HEAD^2` and that will capture
all of the commits within the PR (this is the range I used in
`committed`).

There is still work needed to integrate this with an action; this is
just a rough base-line implementation.

I originally tried to use `cargo package --list` to determine what files
belong to what packages but that was taking too long for some reason (it
works well in `cargo release` for my crates).  We can either look into
that in the future or do our own heuristics to filter out content.
  • Loading branch information
epage committed May 5, 2023
1 parent 2d693e2 commit 32818f3
Show file tree
Hide file tree
Showing 6 changed files with 497 additions and 0 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
build-man = "run --package xtask-build-man --"
stale-label = "run --package xtask-stale-label --"
unpublished = "run --package xtask-unpublished --"
changes = "run --package xtask-changes --"
32 changes: 32 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ env_logger = "0.10.0"
filetime = "0.2.9"
flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] }
fwdansi = "1.1.0"
git-conventional = "0.12.3"
git2 = "0.17.0"
git2-curl = "0.18.0"
gix = { version = "0.44.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] }
Expand Down
16 changes: 16 additions & 0 deletions crates/xtask-changes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "xtask-changes"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies]
anyhow.workspace = true
cargo.workspace = true
clap.workspace = true
env_logger.workspace = true
git-conventional.workspace = true
git2.workspace = true
log.workspace = true
semver.workspace = true
termcolor.workspace = true
15 changes: 15 additions & 0 deletions crates/xtask-changes/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
mod xtask;

fn main() {
env_logger::init_from_env("CARGO_LOG");
let cli = xtask::cli();
let matches = cli.get_matches();

let mut config = cargo::util::config::Config::default().unwrap_or_else(|e| {
let mut eval = cargo::core::shell::Shell::new();
cargo::exit_with_error(e.into(), &mut eval)
});
if let Err(e) = xtask::exec(&matches, &mut config) {
cargo::exit_with_error(e, &mut config.shell())
}
}
Loading

0 comments on commit 32818f3

Please sign in to comment.