mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-30 06:34:37 +02:00
chore: ReadmeGenerator
does not generate correct version
This commit is contained in:
parent
bb47c3fe43
commit
750ef33b20
@ -11,13 +11,6 @@ repositories {
|
||||
mavenLocal()
|
||||
google()
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
// Required for FlexVer-Java
|
||||
maven {
|
||||
url = uri("https://repo.sleeping.town")
|
||||
content {
|
||||
includeGroup("com.unascribed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -25,7 +18,6 @@ dependencies {
|
||||
implementation(libs.smali)
|
||||
// Used in JsonGenerator.
|
||||
implementation(libs.gson)
|
||||
implementation(libs.flexver)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
@ -2,10 +2,8 @@
|
||||
revanced-patcher = "19.0.0"
|
||||
smali = "3.0.3"
|
||||
gson = "2.10.1"
|
||||
flexver = "1.1.1"
|
||||
|
||||
[libraries]
|
||||
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
|
||||
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
|
||||
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
||||
flexver = { module = "com.unascribed:flexver-java", version.ref = "flexver" }
|
||||
|
@ -2,7 +2,6 @@ package app.revanced.meta
|
||||
|
||||
import app.revanced.patcher.PatchSet
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import com.unascribed.flexver.FlexVerComparator
|
||||
import java.io.File
|
||||
|
||||
internal class ReadmeGenerator : PatchesFileGenerator {
|
||||
@ -27,36 +26,18 @@ internal class ReadmeGenerator : PatchesFileGenerator {
|
||||
.entries
|
||||
.sortedByDescending { it.value.size }
|
||||
.forEach { (`package`, patches) ->
|
||||
val supportVersions = buildMap {
|
||||
patches.forEach { patch ->
|
||||
patch.compatiblePackages?.single { compatiblePackage -> compatiblePackage.name == `package` }?.versions?.let {
|
||||
it.forEach { version -> merge(version, 1, Integer::sum) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val minVersion = supportVersions.let { commonMap ->
|
||||
commonMap.maxByOrNull { it.value }?.value?.let {
|
||||
commonMap.entries.filter { supported -> supported.value == it }
|
||||
.minOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
|
||||
} ?: "all"
|
||||
}
|
||||
val maxVersion = supportVersions.let { commonMap ->
|
||||
commonMap.maxByOrNull { it.value }?.value?.let {
|
||||
commonMap.entries.filter { supported -> supported.value == it }
|
||||
.maxOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
|
||||
} ?: "all"
|
||||
}
|
||||
|
||||
output.apply {
|
||||
appendLine("### [\uD83D\uDCE6 `${`package`}`](https://play.google.com/store/apps/details?id=${`package`})")
|
||||
appendLine("<details>\n")
|
||||
appendLine(TABLE_HEADER)
|
||||
patches.sortedBy { it.name }.forEach { patch ->
|
||||
val supportedVersionArray =
|
||||
patch.compatiblePackages?.single { it.name == `package` }?.versions
|
||||
val supportedVersion =
|
||||
if (
|
||||
patch.compatiblePackages?.single { it.name == `package` }?.versions?.isNotEmpty() == true
|
||||
) {
|
||||
if (supportedVersionArray?.isNotEmpty() == true) {
|
||||
val minVersion = supportedVersionArray.elementAt(0)
|
||||
val maxVersion =
|
||||
supportedVersionArray.elementAt(supportedVersionArray.size - 1)
|
||||
if (minVersion == maxVersion)
|
||||
maxVersion
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user