Skip to content
Open
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
13 changes: 9 additions & 4 deletions anneal/v2/src/charon.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2026 The Fuchsia Authors
//
// Licensed under the 2-Clause BSD License <LICENSE-BSD or
// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.

//! Orchestration of Charon extraction.
//!
//! This module handles the invocation of the `charon` tool to extract
Expand Down Expand Up @@ -58,10 +67,6 @@ pub fn run_charon(
};

packages.par_iter().try_for_each(|artifact| {
if artifact.start_from.is_empty() {
return Ok(());
}

let pb = mp.as_ref().map(|m| {
let pb = m.add(indicatif::ProgressBar::new_spinner());
pb.set_style(
Expand Down
9 changes: 9 additions & 0 deletions anneal/v2/src/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2026 The Fuchsia Authors
//
// Licensed under the 2-Clause BSD License <LICENSE-BSD or
// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.

// Handling of Lean diagnostics and error mapping.
//
// This module provides the [`crate::diagnostics::DiagnosticMapper`] struct, which is responsible
Expand Down
28 changes: 12 additions & 16 deletions anneal/v2/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// This file may not be copied, modified, or distributed except according to
// those terms.

use anyhow::Context as _;
use clap::Parser as _;

mod charon;
Expand Down Expand Up @@ -35,12 +36,16 @@ enum Commands {
/// Helper to acquire shared or exclusive locks for multi-process integration testing (dev only)
#[cfg(feature = "exocrate_tests")]
TestLockHelper {
/// The role to run as: 'reader-a', 'reader-b', 'writer-a', or 'reader-exclusion'
#[arg(long)]
role: String,
/// Path to the directory to lock
#[arg(long)]
lock_dir: std::path::PathBuf,
/// Path to the shared log file where lock transitions are appended
#[arg(long)]
log_file: std::path::PathBuf,
/// Path to the temporary synchronization signal file
#[arg(long)]
sig_file: std::path::PathBuf,
},
Expand All @@ -67,9 +72,9 @@ pub struct ExpandArgs {
pub no_progress: bool,
}

fn setup(args: SetupArgs) {
fn setup(args: SetupArgs) -> anyhow::Result<()> {
crate::setup::run_setup(crate::setup::SetupArgs { local_archive: args.local_archive })
.expect("failed to setup toolchain");
.context("Failed to setup toolchain")
}

fn expand(args: ExpandArgs) -> anyhow::Result<()> {
Expand All @@ -95,7 +100,7 @@ fn expand(args: ExpandArgs) -> anyhow::Result<()> {
Ok(())
}

fn main() {
fn main() -> anyhow::Result<()> {
// Suppressing timestamps removes a source of nondeterminism that is
// difficult to work around in integration tests.
env_logger::builder().format_timestamp(None).init();
Expand All @@ -110,21 +115,11 @@ fn main() {

match args.command {
Commands::Setup(args) => setup(args),
Commands::Expand(args) => {
if let Err(e) = expand(args) {
eprintln!("Error: {:?}", e);
std::process::exit(1);
}
}
Commands::Expand(args) => expand(args),

#[cfg(feature = "exocrate_tests")]
Commands::TestLockHelper { role, lock_dir, log_file, sig_file } => {
if let Err(e) =
crate::util::run_test_lock_helper(&role, &lock_dir, &log_file, &sig_file)
{
eprintln!("TestLockHelper failed: {:?}", e);
std::process::exit(1);
}
crate::util::run_test_lock_helper(&role, &lock_dir, &log_file, &sig_file)
}
}
}
Expand All @@ -139,7 +134,8 @@ mod tests {
// ASSUMPTION: Dependency builder installs archive at
// `target/anneal-exocrate.tar.zst`.
local_archive: Some("target/anneal-exocrate.tar.zst".into()),
});
})
.expect("Failed to run setup");

// 2. Once setup completes successfully, resolve the toolchain.
let toolchain = crate::setup::Toolchain::resolve().expect("Failed to resolve toolchain");
Expand Down
9 changes: 9 additions & 0 deletions anneal/v2/src/parse.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2026 The Fuchsia Authors
//
// Licensed under the 2-Clause BSD License <LICENSE-BSD or
// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.

pub mod hkd {
pub struct Safe;
pub trait ThreadSafety {}
Expand Down
9 changes: 9 additions & 0 deletions anneal/v2/src/resolve.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2026 The Fuchsia Authors
//
// Licensed under the 2-Clause BSD License <LICENSE-BSD or
// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.

use anyhow::Context as _;
use sha2::Digest as _;

Expand Down
9 changes: 9 additions & 0 deletions anneal/v2/src/scanner.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2026 The Fuchsia Authors
//
// Licensed under the 2-Clause BSD License <LICENSE-BSD or
// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.

use sha2::Digest as _;

pub struct AnnealArtifact {
Expand Down
9 changes: 9 additions & 0 deletions anneal/v2/src/setup.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2026 The Fuchsia Authors
//
// Licensed under the 2-Clause BSD License <LICENSE-BSD or
// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.

use anyhow::Context as _;

pub struct SetupArgs {
Expand Down
9 changes: 9 additions & 0 deletions anneal/v2/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2026 The Fuchsia Authors
//
// Licensed under the 2-Clause BSD License <LICENSE-BSD or
// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.

use anyhow::Context as _;
use fs2::FileExt as _;
use std::io::BufRead as _;
Expand Down
9 changes: 9 additions & 0 deletions anneal/v2/tests/integration.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2026 The Fuchsia Authors
//
// Licensed under the 2-Clause BSD License <LICENSE-BSD or
// https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.

use std::fs;
use std::process::Command;

Expand Down
Loading