Better version overrides in Netkan #3265
Merged
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.
Problems
See KSP-CKAN/NetKAN#8291; if mod authors only track compatibility on SpaceDock (i.e. don't use a KSP-AVC version file), then the handy prompt to update compatibility when a new version is released just ends up changing the single compatible game version, so that for example compatibility with 1.11 is gained while compatibility with 1.10 is lost, when they may be expecting the total compatibility with prior versions to be remembered over the long term. All of @KSPSnark's mods have been subject to this forever, see KSP-CKAN/NetKAN#6629 and KSP-CKAN/NetKAN#6639 for the last time we tried wrestling with it.
The most natural thing is to add this:
But that currently errors out:
Cause
SpaceDock's compatibility goes into
ksp_version
and nowhere else. The override would need to delete that property, because it's not valid to mixksp_version_min
withksp_version
, but then the useful info it contained would be lost, and we would be back to 100% manual maintenance for compatibility of such mods rather than pulling author-generated data from SpaceDock.Background
Our AVC processing code has some pretty good logic for combining and overriding version ranges (which is part of why version files are so useful). Essentially it calculates an overall minimum and overall maximum from two input ranges, and then figures out the right metadata to represent the resulting range. This logic has usefulness for more than just AVC handling.
Changes
AvcTransformer.ApplyVersions
is moved toModuleService
(except for the handling ofx_netkan_trust_version_file
which only makes sense for AVC), and calling code is updated to use the new locationVersionedOverrideTransformer
uses special logic to handle overrides of the compatibility properties; instead of just setting them blindly (and often generating invalid metadata), it passes them toModuleService.ApplyVersions
After these changes, the above override works as intended:
This will allow us to fix the compatibility of @KSPSnark's mods with just some slight additional manual maintenance, while still taking advantage of the author-generated data from SpaceDock.
This is the first part of fixing KSP-CKAN/NetKAN#8291 (the next part will be updating the netkans for the affected mods).