1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* Mitts Build — Rust-first build and package tooling with shared artifact cache
* Copyright (c) 2026 Alexander Panasenko
*
* Contact: alex@prod.codes
* Author: https://prod.codes/about/
* Project: https://github.com/alex09x/mitts
* SPDX-License-Identifier: MIT OR Apache-2.0
*/
use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap};
use std::path::PathBuf;
/// Distinct type of compilation/build action.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ActionKind {
CompileRlib,
CompileBin,
BuildScript,
Custom(String),
}
/// A language-neutral build action representing a discrete compilation unit.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Action {
pub id: String,
pub kind: ActionKind,
pub description: String,
pub toolchain: ToolchainInfo,
pub inputs: Vec<PathBuf>,
pub outputs: Vec<PathBuf>,
pub args: Vec<String>,
pub env: HashMap<String, String>,
pub dependencies: Vec<String>,
}
/// Toolchain identification independent of specific compiler details.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ToolchainInfo {
pub name: String,
pub version: String,
pub target_triple: Option<String>,
}
/// Result of executing an action.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActionResult {
pub action_id: String,
pub exit_code: i32,
pub success: bool,
pub stdout: String,
pub stderr: String,
pub cached: bool,
}
/// Full execution plan composed of ordered actions.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct BuildPlan {
pub actions: Vec<Action>,
pub target_directory: PathBuf,
/// Linkable artifact per action id, exactly as dependents consume it
/// (e.g. the `.rlib`/proc-macro library passed via `--extern`).
/// Empty when the adapter does not track it (e.g. fast-lock hits).
#[serde(default)]
pub artifacts: BTreeMap<String, PathBuf>,
/// Build cfgs / directives per action id (e.g. rustc-cfg from build scripts).
#[serde(default)]
pub unit_cfgs: BTreeMap<String, Vec<String>>,
/// Extra environment variables per unit (e.g. OUT_DIR and rustc-env from build scripts).
#[serde(default)]
pub unit_env: BTreeMap<String, HashMap<String, String>>,
/// Extra link arguments per unit (e.g. -L native=, -l from build scripts).
#[serde(default)]
pub unit_link_args: BTreeMap<String, Vec<String>>,
/// Extra tracked file/directory inputs (path -> sha256 or "<missing>") from unit dep-info and build script rerun-if-changed.
#[serde(default)]
pub tracked_extra_files: BTreeMap<PathBuf, String>,
/// Extra tracked environment variables (name -> Option<value>) from unit env!/option_env!, dep-info env-dep, and build script rerun-if-env-changed.
#[serde(default)]
pub tracked_env_vars: BTreeMap<String, Option<String>>,
/// Whether any mutable unit had incomplete/tainted input tracking during execution.
#[serde(default)]
pub inputs_incomplete: bool,
}