fix: Plugin install fails when preview sdk is installed #985
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.
Platforms affected
android
Motivation and Context
Fixes #981
If a plugin declares a
android-sdk
engine requirement such as<engine name="android-sdk" version=">=26" />
the plugin may unexpectedly fail if the following conditions are met:android-28
)If the android preview SDK is installed, it was treated as the highest sdk version, even if it has no numerical value. This then led to errors such as:
Description
This PR changes the
sort_by_largest_numerical_suffix
and give preview SDKs a numerical value of 0, thus preview SDKs are put to the bottom of the stack.This does mean that preview SDKs will never be chosen, but I believe this should be the default behaviour. If the user wants to use a preview SDK, I think that should be an opt-in feature, and it is out of scope of this PR.
Existing tests were modified to ensure that preview SDKs were ordered properly.
Special thanks to @timpark for supplying a patch that fixes the
sort_by_largest_numerical_suffix
method.Testing
I've ran
npm test
I've tested against the my local fork with the PR applied, using the following commands on an empty project.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)