Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unused dependency trimming #26

Open
Fydar opened this issue Dec 12, 2020 · 1 comment
Open

Unused dependency trimming #26

Fydar opened this issue Dec 12, 2020 · 1 comment
Assignees
Labels
📦 RPGCore.Packages Issue related to the RPGCore.Packages package New feature or request Potential optimization

Comments

@Fydar
Copy link
Owner

Fydar commented Dec 12, 2020

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.

@Fydar Fydar added the 📦 RPGCore.Packages Issue related to the RPGCore.Packages package label Dec 12, 2020
@Fydar Fydar self-assigned this Dec 12, 2020
@Fydar
Copy link
Owner Author

Fydar commented Dec 12, 2020

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.

@Fydar Fydar added the New feature or request label Dec 12, 2020
@Fydar Fydar moved this to Todo in RPGCore Development Dec 23, 2021
@Fydar Fydar added the Potential optimization label Dec 23, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
📦 RPGCore.Packages Issue related to the RPGCore.Packages package New feature or request Potential optimization
Projects
Development

No branches or pull requests

1 participant