Skip to content

Commit

Permalink
Add ordinal indicating what order products appeared in logs (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezyang authored Apr 22, 2024
1 parent 8758e74 commit fcf8984
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu

let mut expected_rank: Option<Option<u32>> = None;

let mut directory: FxIndexMap<Option<CompileId>, Vec<PathBuf>> = FxIndexMap::default();
let mut directory: FxIndexMap<Option<CompileId>, Vec<(PathBuf, i32)>> = FxIndexMap::default();

// Store results in an output Vec<PathBuf, String>
let mut output: Vec<(PathBuf, String)> = Vec::new();
Expand All @@ -73,6 +73,8 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
tt.add_template("dynamo_guards.html", TEMPLATE_DYNAMO_GUARDS)?;
tt.add_template("compilation_metrics.html", TEMPLATE_COMPILATION_METRICS)?;

let mut output_count = 0;

let mut breaks = RestartsAndFailuresContext {
css: TEMPLATE_FAILURES_CSS,
failures: Vec::new(),
Expand Down Expand Up @@ -187,7 +189,8 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
Ok(results) => {
for (filename, out) in results {
output.push((filename.clone(), out));
compile_directory.push(filename);
compile_directory.push((filename, output_count));
output_count += 1;
}
}
Err(err) => match parser.name() {
Expand Down
4 changes: 2 additions & 2 deletions src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ Build products below:
{{ for compile_directory in directory }}
<li><a id="{compile_directory.0}">{compile_directory.0}</a>
<ul>
{{ for path in compile_directory.1 }}
<li><a href="{path}">{path}</a></li>
{{ for path_idx in compile_directory.1 }}
<li><a href="{path_idx.0}">{path_idx.0}</a> ({path_idx.1})</li>
{{ endfor }}
</ul>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ pub struct DynamoGuardsContext {
#[derive(Debug, Serialize)]
pub struct IndexContext {
pub css: &'static str,
pub directory: Vec<(String, Vec<PathBuf>)>,
pub directory: Vec<(String, Vec<(PathBuf, i32)>)>,
pub stack_trie_html: String,
pub unknown_stack_trie_html: String,
pub has_unknown_stack_trie: bool,
Expand Down

0 comments on commit fcf8984

Please sign in to comment.