Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,399 changes: 1,130 additions & 269 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ keywords = ["cargo", "plugin", "security", "supply-chain"]
anyhow = "1.0.102"
clap = { version = "4.6.1", features = [ "derive" ] }
serde = { version = "1.0.228", features = [ "derive", "rc" ] }
toml = "0.8.23"
toml = "1.1.2"
serde_json = "1.0.149"
cargo_metadata = "0.18.1"
object = "0.32.2"
cargo_metadata = "0.23.1"
object = "0.39.1"
ar = "0.9.0"
gimli = { version = "0.28.1", default-features = false, features = ["read"] }
gimli = { version = "0.33.0", default-features = false, features = ["read"] }
rustc-demangle = "0.1.27"
once_cell = "1.21.4"
is-terminal = "0.4.17"
colored = "2.2.0"
ra-ap-rustc_lexer = "0.162.0"
colored = "3.1.1"
ra-ap-rustc_lexer = "0.163.0"
indoc = "2.0.7"
log = { version = "0.4.29", features = [ "std" ] }
addr2line = { version = "0.21.0", default-features = false, features = [ "std" ] }
addr2line = { version = "0.26.1", default-features = false, features = [ "std" ] }
tempfile = "3.27.0"
rustc-hash = "2.1.2"
tui-input = "0.8.0"
toml_edit = { version = "0.20.7" }
tui-input = "0.15.3"
toml_edit = { version = "0.25.11" }

ratatui = { version = "0.24.0", optional = true }
ratatui = { version = "0.30.0", optional = true }
diff = { version = "0.1.13", optional = true }
crossterm = { version = "0.27.0", optional = true }
crossterm = { version = "0.29.0", optional = true }

[features]
default = ["ui"]
Expand Down
85 changes: 64 additions & 21 deletions cackle.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ allow_unsafe = true
[pkg.serde_json]
allow_unsafe = true

[pkg.static_assertions]
allow_unsafe = true

[pkg.parking_lot]
allow_unsafe = true

Expand All @@ -204,9 +201,6 @@ allow_unsafe = true
[pkg.stable_deref_trait]
allow_unsafe = true

[pkg.byteorder]
allow_unsafe = true

[pkg.winnow]
allow_unsafe = true

Expand All @@ -215,6 +209,8 @@ allow_unsafe = true
allow_apis = [
"fs",
"process",
"rustix-other",
"termios",
]

[pkg.flate2]
Expand All @@ -228,24 +224,21 @@ allow_unsafe = true

[pkg.toml_edit]
allow_unsafe = true
allow_apis = [
"fs",
]

[pkg.memchr]
allow_unsafe = true

[pkg.once_cell]
allow_unsafe = true

[pkg.lazy_static]
allow_unsafe = true

[pkg.addr2line]
allow_unsafe = true

[pkg.object]
allow_unsafe = true
build.allow_apis = [
"process",
]

[pkg.colored]
allow_unsafe = true
Expand Down Expand Up @@ -280,12 +273,6 @@ allow_apis = [
[pkg.anstyle-query]
allow_unsafe = true

[pkg.paste]
allow_proc_macro = true
build.allow_apis = [
"process",
]

[pkg.tempfile]
allow_apis = [
"fs",
Expand Down Expand Up @@ -316,9 +303,6 @@ allow_unsafe = true
[pkg.lru]
allow_unsafe = true

[pkg.derive_more]
allow_proc_macro = true

[pkg.foldhash]
allow_unsafe = true

Expand Down Expand Up @@ -353,3 +337,62 @@ allow_unsafe = true

[pkg.errno]
allow_unsafe = true

[pkg.toml_parser]
allow_unsafe = true

[pkg.toml]
allow_apis = [
"fs",
]

[pkg.document-features]
allow_proc_macro = true
allow_apis = [
"fs",
]

[pkg.wasm-bindgen-macro]
allow_proc_macro = true

[pkg.instability]
allow_proc_macro = true

[pkg.num-derive]
allow_proc_macro = true

[pkg.pest_derive]
allow_proc_macro = true

[pkg.wezterm-dynamic-derive]
allow_proc_macro = true

[pkg.phf_macros]
allow_proc_macro = true

[pkg.darling_macro]
allow_proc_macro = true

[pkg.derive_more-impl]
allow_proc_macro = true

[pkg.static_assertions]
allow_unsafe = true

[pkg.ryu]
allow_unsafe = true

[pkg.powerfmt]
allow_unsafe = true

[pkg.castaway]
allow_unsafe = true

[pkg.deranged]
allow_unsafe = true

[pkg.compact_str]
allow_unsafe = true

[pkg.time]
allow_unsafe = true
8 changes: 4 additions & 4 deletions src/config_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ use std::borrow::Cow;
use std::fmt::Display;
use std::path::Path;
use toml_edit::Array;
use toml_edit::Document;
use toml_edit::DocumentMut;
use toml_edit::Formatted;
use toml_edit::Item;
use toml_edit::Value;

#[derive(Clone)]
pub(crate) struct ConfigEditor {
document: Document,
document: DocumentMut,
}

pub(crate) trait Edit {
Expand Down Expand Up @@ -1119,9 +1119,9 @@ fn set_table_value(
) {
table[key] = item;
if let Some(comment) = &opts.comment
&& let Some(decor) = table.key_decor_mut(key)
&& let Some(mut key) = table.key_mut(key)
{
*decor = toml_edit::Decor::new(format!("# {comment}\n"), " ");
*key.leaf_decor_mut() = toml_edit::Decor::new(format!("# {comment}\n"), " ");
}
}

Expand Down
12 changes: 10 additions & 2 deletions src/crate_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use anyhow::Context;
use anyhow::Result;
use anyhow::bail;
use cargo_metadata::DependencyKind;
use cargo_metadata::TargetKind;
use cargo_metadata::camino::Utf8PathBuf;
use cargo_metadata::semver::Version;
use rustc_hash::FxHashMap;
Expand Down Expand Up @@ -97,10 +98,17 @@ impl CrateIndex {
let mut has_build_script = false;
let mut has_test = false;
for target in &package.targets {
if target.kind.iter().any(|kind| kind == "proc-macro") {
if target
.kind
.iter()
.any(|kind| kind == &TargetKind::ProcMacro)
{
is_proc_macro = true;
}
has_build_script |= target.kind.iter().any(|kind| kind == "custom-build");
has_build_script |= target
.kind
.iter()
.any(|kind| kind == &TargetKind::CustomBuild);
has_test |= target.test;
}
if let Some(dir) = package.manifest_path.parent() {
Expand Down
52 changes: 26 additions & 26 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use symbol_graph::ScanOutputs;
use tmpdir::TempDir;

#[derive(Parser, Debug, Clone)]
#[clap()]
#[command()]
struct OuterArgs {
#[command(subcommand)]
command: OuterCommand,
Expand All @@ -79,100 +79,100 @@ enum OuterCommand {
}

#[derive(Parser, Debug, Clone, Default)]
#[clap(version, about)]
#[command(version, about)]
struct Args {
/// Directory containing crate to analyze. Defaults to current working directory.
#[clap(long)]
#[arg(long)]
path: Option<PathBuf>,

/// Path to cackle.toml. Defaults to cackle.toml in the directory containing Cargo.toml.
#[clap(short, long)]
#[arg(short, long)]
cackle_path: Option<PathBuf>,

/// Print the mapping from paths to crate names. Useful for debugging.
#[clap(long, hide = true)]
#[arg(long, hide = true)]
print_path_to_crate_map: bool,

/// Promotes warnings (e.g. due to unused permissions) to errors.
#[clap(long)]
#[arg(long)]
fail_on_warnings: bool,

/// Ignore newer config versions.
#[clap(long)]
#[arg(long)]
ignore_newer_config_versions: bool,

/// Whether to use coloured output.
#[clap(long, alias = "color", default_value = "auto")]
#[arg(long, alias = "color", default_value = "auto")]
colour: colour::Colour,

/// Don't print anything on success.
#[clap(long)]
#[arg(long)]
quiet: bool,

/// Override the target used when compiling. e.g. "x86_64-unknown-linux-gnu".
#[clap(long)]
#[arg(long)]
target: Option<String>,

/// Override build profile.
#[clap(long)]
#[arg(long)]
profile: Option<String>,

/// Features to pass to cargo. Overrides common.features in config.
#[clap(long)]
#[arg(long)]
features: Option<String>,

/// Print how long various things take to run.
#[clap(long)]
#[arg(long)]
print_timing: bool,

/// Print additional information that's probably only useful for debugging.
#[clap(long)]
#[arg(long)]
debug: bool,

/// Output file for logs that might be useful for diagnosing problems.
#[clap(long)]
#[arg(long)]
log_file: Option<PathBuf>,

/// How detailed the logs should be.
#[clap(long, default_value = "info")]
#[arg(long, default_value = "info")]
log_level: logging::LevelFilter,

/// When specified, writes all requests into a subdirectory of the target directory. For
/// debugging use.
#[clap(long, hide = true)]
#[arg(long, hide = true)]
save_requests: bool,

/// Instead of running `cargo build`, replay requests saved by a previous run where
/// --write-requests was specified. For debugging use.
#[clap(long, hide = true)]
#[arg(long, hide = true)]
replay_requests: bool,

/// Temporary directory for Cackle to use. This is intended for testing purposes.
#[clap(long, hide = true)]
#[arg(long, hide = true)]
tmpdir: Option<PathBuf>,

/// What kind of user interface to use.
#[clap(long)]
#[arg(long)]
ui: Option<ui::Kind>,

/// Disable interactive UI.
#[clap(long, short)]
#[arg(long, short)]
no_ui: bool,

/// Automatically accept the default (first) fix for all problems.
/// When multiple fixes are available, always applies the most sensible option.
/// Useful for automated configuration generation.
#[clap(long)]
#[arg(long)]
auto_accept_fixes: bool,

/// Disable backtraces (may reduce peak memory consumption).
#[clap(long)]
#[arg(long)]
no_backtrace: bool,

// We may at some point allow this to be a short flag, but should probably wait a few releases.
// -p was previously accepted for --path.
/// Packages to build and analyse.
#[clap(long)]
#[arg(long)]
package: Vec<String>,

#[command(subcommand)]
Expand All @@ -190,13 +190,13 @@ enum Command {
/// Run `cargo run`, analysing whatever gets built.
Run(CargoOptions),

#[clap(hide = true, name = PROXY_BIN_ARG)]
#[command(hide = true, name = PROXY_BIN_ARG)]
ProxyBin(ProxyBinOptions),
}

#[derive(Parser, Debug, Clone)]
pub(crate) struct ProxyBinOptions {
#[clap(allow_hyphen_values = true)]
#[arg(allow_hyphen_values = true)]
remaining: Vec<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/proxy/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub(crate) const PROFILE_NAME_ENV: &str = "CACKLE_BUILD_PROFILE";

#[derive(Parser, Debug, Clone)]
pub(crate) struct CargoOptions {
#[clap(allow_hyphen_values = true)]
#[arg(allow_hyphen_values = true)]
remaining: Vec<String>,
}

Expand Down
Loading