Skip to content

Unused dependency trimming #26

@fydar

Description

@fydar

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.

Metadata

Metadata

Assignees

Labels

New feature or requestPotential optimization📦 RPGCore.PackagesIssue related to the RPGCore.Packages package

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions