Refactor module installer to use relative paths internally#4469
Merged
Conversation
Pull Request Test Coverage Report for Build 20049619596Details
💛 - Coveralls |
7936642 to
f51877a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
I tried switching to a different ZIP handling library after @JonnyOThan suggested supporting 7zip. That effort is still in extended debugging limbo, but one piece of it that seemed valuable enough to pull out on its own was refactoring
ModuleInstaller.FindInstallableFilesto return relative install paths instead of absolute. This has a number of benefits:FindInstallableFilesno longer needs a game instance to workFindInstallableFilesis now invariant perCkanModule, opening the door to possible future caching if it looks like that would helpChanges
ModuleInstaller.FindInstallableFilesreturns relative install paths instead of absolute. This will be more flexible and easier to maintain.Side refactorings
CkanModule.ProvidesListis now cached instead of being recomputed every timeModuleInstallDescriptor.EnsurePatternis replaced by a cachedInstallPatternpropertyCkanModule.GetInstallStanzasis created to encapuslate the logic of falling back to the default install stanza wheninstallisn't setModuleInstallDescriptor.FindInstallableFilesnow checks for updirs using a single pass regex instead of one pass withContainsand another withEndsWithModuleInstallDescriptor.FindInstallableFilesnow returns a lazily generated sequence insetad of aListSpaceWarpInfoLoaderis created to encapsulate the operation of parsing aswinfo.jsonfile and retrieving its remote counterpart via theversion_checkproperty, so we don't need to duplicate that logic in theSpaceWarpInfoTranslatorand theSpaceWarpInfoValidator