Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Break apart Abstractions.Games #895

Merged
merged 35 commits into from
Feb 1, 2024
Merged

Break apart Abstractions.Games #895

merged 35 commits into from
Feb 1, 2024

Conversation

halgari
Copy link
Collaborator

@halgari halgari commented Jan 30, 2024

Handles #890

With this change, the abstractions diagram becomes this:

classDiagram
    direction TB
    DiskState --|> GameLocators
    DiskState --|> Loadouts
    FileStore --|> GameLocators
    FileStore --|> IO
    FileStore --|> Serialization
    Games --|> CrossPlatform
    Games --|> Activities
    Games --|> DiskState
    Games --|> Installers
    Games --|> Loadouts_Synchronizers
    Games --|> Loadouts
    Games --|> NexusWebApi
    Games_Diagnostics --|> FileExtractor
    Games_Diagnostics --|> Games
    GuidedInstallers --|> Activities
    HttpDownloader --|> Activities
    Installers --|> Activities
    Installers --|> GameLocators
    Installers --|> IO
    Installers --|> Loadouts
    Loadouts --|> Activities
    Loadouts --|> FileStore
    Loadouts --|> GameLocators
    Loadouts --|> Serialization
    Loadouts --|> Triggers
    Loadouts_Synchronizers --|> DiskState
    Loadouts_Synchronizers  --|> Loadouts
    NexusWebApi --|> FileStore
    NexusWebApi --|> GameLocators
    NexusWebApi --|> Serialization
Loading

It's a bit messy, but the main win here is breaking "Game Locators" apart from "Game", this allows us to explode the contents of the old Games library out into the different parts:

  • GameLocators - Now only resolve game locations and interact with the new ILocatableGame instead of IGame
  • Game - Includes all the old IGame helpers. IGame inherits from ILocatableGame
  • Loadouts - The entities that deal with reading and storing the loadout data, this is the data storage layer
  • DiskState - the FileHashCache, and the classes that store the most recent applied loadout state
  • FileStore - Deals only with storing downloads and offering APIs for retrevial of those stored datas. Also tracks metadata associated with the stored files (like Nexus Mod Id, etc)
  • Installers - Classes that builtout loadouts based on FileStore data
@codecov-commenter
Copy link

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (dcb5e3c) 0.00% compared to head (1e133d4) 57.16%.
Report is 9 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           main     #895       +/-   ##
=========================================
+ Coverage      0   57.16%   +57.16%     
=========================================
  Files         0      619      +619     
  Lines         0    19754    +19754     
  Branches      0     1485     +1485     
=========================================
+ Hits          0    11292    +11292     
- Misses        0     8125     +8125     
- Partials      0      337      +337     
Flag Coverage Δ
Linux 56.54% <90.35%> (?)
Windows 56.40% <90.35%> (?)
clean_environment_tests 57.14% <90.35%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...NexusMods.Abstractions.DiskState/IFileHashCache.cs 100.00% <ø> (ø)
...ions.FileStore/ArchiveMetadata/AArchiveMetaData.cs 66.66% <ø> (ø)
...ions.FileStore/ArchiveMetadata/FilePathMetadata.cs 50.00% <ø> (ø)
...s.FileStore/ArchiveMetadata/GameArchiveMetadata.cs 0.00% <ø> (ø)
...stractions.FileStore/Downloads/DownloadAnalysis.cs 90.90% <ø> (ø)
...tions/NexusMods.Abstractions.FileStore/Services.cs 100.00% <100.00%> (ø)
...usMods.Abstractions.FileStore/Trees/ModFileTree.cs 98.27% <ø> (ø)
....Abstractions.FileStore/Trees/ModFileTreeSource.cs 100.00% <ø> (ø)
...ons/NexusMods.Abstractions.FileStore/TypeFinder.cs 100.00% <ø> (ø)
...ocators/GameCapabilities/IModInstallDestination.cs 100.00% <ø> (ø)
... and 206 more

... and 403 files with indirect coverage changes

@halgari halgari requested a review from Sewer56 January 31, 2024 20:35
@Al12rs
Copy link
Contributor

Al12rs commented Feb 1, 2024

I found that DataModel still depends directly on StandardGameLocators and FileExtractor:
image

It doesn't look like the dependencies are big, so it might be fast to remove them and rely solely on abstractions instead.
See if you feel like including that.

@@ -1,4 +1,5 @@
using JetBrains.Annotations;
using NexusMods.Abstractions.GameLocators;
using NexusMods.Abstractions.Games.DTO;

namespace NexusMods.Abstractions.Games;
Copy link
Contributor

Choose a reason for hiding this comment

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

There are many cases where the namespaces are no longer up to date.
Most renamed files without changes have the problem as well as a lot of other files.
Do we want to try to go through everything and fix it? Might be good to rip the band aid now since the we are already changing everything.

@Al12rs
Copy link
Contributor

Al12rs commented Feb 1, 2024

I tested this out locally and went through a lot of the files, apart from the comments above it looks good

@Al12rs
Copy link
Contributor

Al12rs commented Feb 1, 2024

Closes #890
Closes #881

Copy link
Contributor

@Al12rs Al12rs left a comment

Choose a reason for hiding this comment

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

Don't know why the test was failing before. Running again fixed it. I can't reproduce locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants