runPostProcessBuilder function
Future<void>
runPostProcessBuilder(
- PostProcessBuilder builder,
- AssetId inputId,
- AssetReader reader,
- AssetWriter writer,
- Logger logger, {
- required void addAsset(),
- required void deleteAsset(),
Run builder
with inputId
as the primary input.
addAsset
should update the build systems knowledge of what assets exist.
If an asset should not be written this function should throw.
deleteAsset
should remove the asset from the build system, it will not be
deleted on disk since the writer
has no mechanism for delete.
Implementation
Future<void> runPostProcessBuilder(PostProcessBuilder builder, AssetId inputId,
AssetReader reader, AssetWriter writer, Logger logger,
{required void Function(AssetId) addAsset,
required void Function(AssetId) deleteAsset}) async {
await scopeLogAsync(() async {
var buildStep =
postProcessBuildStep(inputId, reader, writer, addAsset, deleteAsset);
try {
await builder.build(buildStep);
} finally {
await buildStep.complete();
}
}, logger);
}