hara_native/project/production/graph/
model.rs1use super::super::source::{Diagnostic, SourceLocation};
2use super::super::unit::{NativeRootInventory, UnitAnalysis};
3use std::collections::BTreeSet;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub struct ModuleAnalysis {
7 pub name: String,
8 pub path: String,
9 pub namespace_form: String,
10 pub digest: String,
11 pub input_bytes: usize,
12 pub dependencies: Vec<String>,
13 pub unit_ids: Vec<String>,
14 pub standard_library: bool,
15}
16
17#[derive(Debug, Clone, PartialEq, Eq)]
18pub struct RetentionReason {
19 pub unit_id: String,
20 pub subject: Option<String>,
21 pub code: String,
22 pub detail: String,
23}
24
25#[derive(Debug, Clone, PartialEq, Eq)]
26pub struct Analysis {
27 pub modules: Vec<ModuleAnalysis>,
28 pub units: Vec<UnitAnalysis>,
29 pub runtime_roots: BTreeSet<String>,
30 pub runtime_closure: BTreeSet<String>,
31 pub runtime_unit_ids: BTreeSet<String>,
32 pub compile_time_roots: BTreeSet<String>,
33 pub compile_time_closure: BTreeSet<String>,
34 pub compile_time_unit_ids: BTreeSet<String>,
35 pub retained_unit_ids: BTreeSet<String>,
36 pub removed_unit_ids: BTreeSet<String>,
37 pub retained_vars: BTreeSet<String>,
38 pub removed_vars: BTreeSet<String>,
39 pub retained_namespaces: BTreeSet<String>,
40 pub removed_namespaces: BTreeSet<String>,
41 pub reasons: Vec<RetentionReason>,
42 pub diagnostics: Vec<Diagnostic>,
43 pub(crate) native_roots: NativeRootInventory,
45 pub native_primitives: BTreeSet<String>,
47 pub native_types: BTreeSet<String>,
48 pub native_protocols: BTreeSet<String>,
49 pub input_bytes: usize,
50 pub input_digest: String,
51}
52
53impl Analysis {
54 pub fn succeeded(&self) -> bool {
55 self.diagnostics.is_empty()
56 }
57}
58
59#[derive(Debug, Clone)]
60pub struct AnalysisOutput {
61 pub analysis: Analysis,
62 pub report_path: std::path::PathBuf,
63 pub report_source: String,
64}
65
66#[derive(Debug, Clone)]
67pub struct BuildOutput {
68 pub analysis: Analysis,
69 pub bundle_path: Option<std::path::PathBuf>,
70 pub report_path: std::path::PathBuf,
71 pub report_source: String,
72}
73
74pub(super) fn project_location() -> SourceLocation {
75 SourceLocation {
76 path: "project.edn".into(),
77 line: 1,
78 column: 1,
79 end_line: 1,
80 end_column: 1,
81 }
82}