(out: &str)
| 762 | const ARTIFACT_SUFFIX: &str = ".spv.json"; |
| 763 | |
| 764 | fn get_sole_artifact(out: &str) -> Option<PathBuf> { |
| 765 | let last = out |
| 766 | .lines() |
| 767 | .filter_map(|line| { |
| 768 | if let Ok(line) = serde_json::from_str::<RustcOutput>(line) { |
| 769 | Some(line) |
| 770 | } else { |
| 771 | // Pass through invalid lines |
| 772 | println!("{line}"); |
| 773 | None |
| 774 | } |
| 775 | }) |
| 776 | .filter(|line| line.reason == "compiler-artifact") |
| 777 | .last() |
| 778 | .expect("Did not find output file in rustc output"); |
| 779 | |
| 780 | let mut filenames = last |
| 781 | .filenames |
| 782 | .unwrap() |
| 783 | .into_iter() |
| 784 | .filter(|v| v.ends_with(ARTIFACT_SUFFIX)); |
| 785 | let filename = filenames.next()?; |
| 786 | assert_eq!( |
| 787 | filenames.next(), |
| 788 | None, |
| 789 | "build had multiple `{ARTIFACT_SUFFIX}` artifacts" |
| 790 | ); |
| 791 | Some(filename.into()) |
| 792 | } |
| 793 | |
| 794 | /// Internally iterate through the leaf dependencies of the artifact at `artifact` |
| 795 | fn leaf_deps(artifact: &Path, mut handle: impl FnMut(&RawStr)) -> std::io::Result<()> { |
no test coverage detected