feat: ability to get artifacts + sources (#1080)

This commit is contained in:
Bjerg 2022-03-27 16:44:23 +02:00 committed by GitHub
parent a43a9b8806
commit 919a570237
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -68,6 +68,19 @@ impl<T: ArtifactOutput> ProjectCompileOutput<T> {
.chain(compiled_artifacts.into_artifacts_with_files()) .chain(compiled_artifacts.into_artifacts_with_files())
} }
/// All artifacts together with their ID and the sources of the project.
pub fn into_artifacts_with_sources(self) -> (BTreeMap<ArtifactId, T::Artifact>, SourceFiles) {
let Self { cached_artifacts, compiled_artifacts, compiler_output, .. } = self;
(
cached_artifacts
.into_artifacts::<T>()
.chain(compiled_artifacts.into_artifacts::<T>())
.collect(),
SourceFiles(compiler_output.sources),
)
}
/// Strips the given prefix from all artifact file paths to make them relative to the given /// Strips the given prefix from all artifact file paths to make them relative to the given
/// `base` argument /// `base` argument
/// ///