mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-11 23:47:45 +01:00
fix(readme-generator): attempt sorting versions with FlexVer
(#2059)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
82e7d3bd2c
commit
a54c464522
@ -17,6 +17,13 @@ repositories {
|
|||||||
password = githubPassword
|
password = githubPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Required for FlexVer-Java
|
||||||
|
maven {
|
||||||
|
url = uri("https://repo.sleeping.town")
|
||||||
|
content {
|
||||||
|
includeGroup("com.unascribed")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -24,6 +31,8 @@ dependencies {
|
|||||||
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
||||||
// Required for meta
|
// Required for meta
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
// Required for FlexVer-Java
|
||||||
|
implementation("com.unascribed:flexver-java:1.0.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
|||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import com.unascribed.flexver.FlexVerComparator
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal class ReadmeGenerator : PatchesFileGenerator {
|
internal class ReadmeGenerator : PatchesFileGenerator {
|
||||||
@ -37,9 +38,8 @@ internal class ReadmeGenerator : PatchesFileGenerator {
|
|||||||
}
|
}
|
||||||
}.let { commonMap ->
|
}.let { commonMap ->
|
||||||
commonMap.maxByOrNull { it.value }?.value?.let {
|
commonMap.maxByOrNull { it.value }?.value?.let {
|
||||||
// This is not foolproof, because for example v1.0.0-dev.0 will be returned instead of v1.0.0-release.
|
commonMap.entries.filter { mostCommon -> mostCommon.value == it }
|
||||||
// Unfortunately this can not be solved easily because versioning can be complex.
|
.maxOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
|
||||||
commonMap.entries.filter { mostCommon -> mostCommon.value == it }.maxBy { it.key }.key
|
|
||||||
} ?: "all"
|
} ?: "all"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user