Skip to content

Refactor GenericProfileInstaller into a simple wrapper for PackageInstaller calls#2121

Open
anttimaki wants to merge 3 commits intoIRPI-04from
IRPI-05
Open

Refactor GenericProfileInstaller into a simple wrapper for PackageInstaller calls#2121
anttimaki wants to merge 3 commits intoIRPI-04from
IRPI-05

Conversation

@anttimaki
Copy link
Copy Markdown
Collaborator

No description provided.

All PackageInstaller implementations, for both mod loaders and plugins,
now implement the method so it can be required to ensure future
implementations don't skip it.

Disable/Enable methods are implemented for all plugin installers as
well, but the operation is not supported for mod loader packages, so
the methods remain optional in the interface.
- Define InstallRulePluginInstaller as the PackageInstaller in registry
  for all games that don't use custom one
- GenericProfileInstaller becomes a simple wrapper for calling
  PackageInstaller methods
- By default InstallRulePluginInstaller no longer takes the rules as a
  constuctor argument, but reads them from Thunderstore ecosystem
  schema instead. This allows initiating the installer in registry
  before the active game is selected
  - Rules can still be passed as arguments to constructor, in which
    case those rules are used instead. This is used by
    ReturnOfModdingPluginInstaller and can be used for testing
    purposes as well
- Installer: use the InstallRulePluginInstaller directly rather than
  awkwardly access it through GenericProfileInstaller
- Shimloader: set install rules used in the tests directly as
  InstallRulePluginInstaller args rather than accessing them through
  InstallationRules.RULES
- MelonLoader: ensure active game is set before
  GenericProfileInstaller is initiated, as it now depends on active
  game internally

Current intallation logic tests in the codebase were written when game
specific installation rules were hard coded in the code base and the
implemenation of GenericProfileInstaller contained convoluted
installation logic. Now the installation rules are loaded from
Thunderstore ecosystem schema and installation logic is encapsulated
in PackageLoader implementations. The tests should be reworked so we
have separate test for the GenericProfileInstaller and
PackageInstallers. Game specific test cases should be repThe scope of
such changes require separate PR.
comprehensive test suite for InstallRulePluginInstaller.
@anttimaki anttimaki requested a review from ebkr April 12, 2026 13:27

private readonly rule: CoreRuleType | undefined;
private readonly legacyInstaller: InstallRulePluginInstaller;
private readonly loaderInstaller: PackageInstaller;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Might be worth being a little more explicit and calling it "modLoaderInstaller"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants