1use std::process::Command;
4
5pub mod adoption;
6mod artifact_io;
7mod bootstrap_store;
8mod build_profile;
9pub mod build_provenance;
10pub mod candid_endpoints;
11pub mod canic_metadata;
12pub mod canister_build;
13pub mod canister_ready;
14mod cargo_metadata;
15pub mod cycle_balance;
16pub mod deployment_catalog;
17pub mod deployment_truth;
18pub mod durable_io;
19pub mod duration;
20pub mod evidence_envelope;
21pub mod format;
22pub mod icp;
23pub mod icp_config;
24pub mod install_root;
25pub mod installed_deployment;
26pub mod policy_gate;
27pub mod registry;
28pub mod release_set;
29pub mod replica_query;
30pub mod response_parse;
31pub mod role_contract;
32pub mod state_manifest;
33pub mod subnet_registry;
34pub mod table;
35#[cfg(test)]
36mod test_support;
37mod workspace_discovery;
38
39pub(crate) fn cargo_command() -> Command {
40 let cargo = std::env::var_os("CARGO").unwrap_or_else(|| "cargo".into());
41 let mut command = Command::new(cargo);
42
43 if let Some(toolchain) = std::env::var_os("RUSTUP_TOOLCHAIN") {
44 command.env("RUSTUP_TOOLCHAIN", toolchain);
45 }
46 command
47}
48
49pub(crate) fn should_export_candid_artifacts(environment: &str) -> bool {
50 environment == "local"
51}
52
53pub(crate) fn remove_optional_file(path: &std::path::Path) -> std::io::Result<()> {
54 match std::fs::remove_file(path) {
55 Ok(()) => Ok(()),
56 Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(()),
57 Err(err) => Err(err),
58 }
59}
60
61#[cfg(test)]
62mod tests;