Skip to content

Commit

Permalink
feat: add a linkage checker subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
mistydemeo committed Sep 27, 2023
1 parent 815ca10 commit a1ce448
Show file tree
Hide file tree
Showing 19 changed files with 431 additions and 7 deletions.
66 changes: 66 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions cargo-dist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ include_dir = "0.7.3"
itertools = "0.11.0"
cargo-wix = "0.3.7"
uuid = { version = "1", features = ["v4"] }
mach_object = "0.1"
goblin = "0.7.1"

[dev-dependencies]
insta = { version = "1.26.0", features = ["filters"] }
Expand Down
18 changes: 18 additions & 0 deletions cargo-dist/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ pub enum Commands {
#[clap(disable_version_flag = true)]
#[clap(hide = true)]
GenerateCi(GenerateCiArgs),
/// Report on the dynamic libraries used by the built artifacts.
#[clap(disable_version_flag = true)]
Linkage(LinkageArgs),
/// Generate the final build manifest without running any builds.
///
/// This command is designed to match the exact behaviour of
Expand Down Expand Up @@ -278,6 +281,21 @@ pub struct GenerateCiArgs {
#[clap(default_value_t = false)]
pub check: bool,
}
#[derive(Args, Clone, Debug)]
pub struct LinkageArgs {
/// Print human-readable output
#[clap(long)]
#[clap(default_value_t = false)]
pub print_output: bool,
/// Print output as JSON
#[clap(long)]
#[clap(default_value_t = false)]
pub print_json: bool,
#[clap(long)]
#[clap(hide = true)]
#[clap(default_value = "")]
pub artifacts: String,
}

#[derive(Args, Clone, Debug)]
pub struct HelpMarkdownArgs {}
Expand Down
15 changes: 15 additions & 0 deletions cargo-dist/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,21 @@ pub enum DistError {
/// Name of the msi
style: String,
},
/// Linkage report can't be run for this combination of OS and target
#[error("unable to run linkage report for {target} on {host}")]
LinkageCheckInvalidOS {
/// The OS the check was run on
host: String,
/// The OS being checked
target: String,
},
/// Linkage report can't be run for this target
#[error("unable to run linkage report for this type of binary")]
LinkageCheckUnsupportedBinary {},

/// random i/o error
#[error(transparent)]
Goblin(#[from] goblin::error::Error),
}

impl From<minijinja::Error> for DistError {
Expand Down
Loading

0 comments on commit a1ce448

Please sign in to comment.