Unused dependency trimming
Add API for importing assets to force-include them in the build (for assets that serve as the root assets for the game) and allow removal of all assets that are unused.
public IEnumerable<ProjectResourceUpdate> ImportFile(ArchiveFileImporterContext context, IArchiveFile archiveFile)
{
var update = context.AuthorUpdate(archiveFile.FullName)
.WithContent(archiveFile);
// Dependency trimming API
update.AlwaysInclude(true);
yield return update;
}
This could be implemented with an IImportProcessor that removes assets at the stage in the build pipeline. This means that a user will be able to customise at which point in the build pipeline the removal of the resources occurs at.
Import = ImportPipeline.Create()
.UseJsonMetaFiles()
.UseImporter(new ImageImporter())
.UseImporter(new JsonImporter())
.UseProcessor(new ImageProcessor())
.UseProcessor(new LoggingImportProcessor())
// Dependency trimming API
.UseDependencyTrimming()
.Build();
For optimization purposes, I can also abort the writing of the IContentWriter that was created for the original assets that are no longer going to be included.
I intend to implement this on my portfolio website as a test-case. It would also be handy if there was a method for producing reports on the imported resources (and the source files that created them) that weren't included in the build.