mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 17:14:35 +02:00
fix: JsonGenerator
does not generate patch names in lexicographic order
This commit is contained in:
parent
8b487479d9
commit
b0fb19830e
@ -6,20 +6,22 @@ import com.google.gson.GsonBuilder
|
||||
import java.io.File
|
||||
|
||||
internal class JsonGenerator : PatchesFileGenerator {
|
||||
override fun generate(patches: PatchSet) = patches.map {
|
||||
JsonPatch(
|
||||
it.name!!,
|
||||
it.description,
|
||||
it.compatiblePackages,
|
||||
it.use,
|
||||
it.requiresIntegrations,
|
||||
it.options.values.map { option ->
|
||||
JsonPatch.Option(option.key, option.value, option.title, option.description, option.required)
|
||||
}
|
||||
)
|
||||
}.let {
|
||||
File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
|
||||
}
|
||||
override fun generate(patches: PatchSet) = patches
|
||||
.sortedBy { it.name }
|
||||
.map {
|
||||
JsonPatch(
|
||||
it.name!!,
|
||||
it.description,
|
||||
it.compatiblePackages,
|
||||
it.use,
|
||||
it.requiresIntegrations,
|
||||
it.options.values.map { option ->
|
||||
JsonPatch.Option(option.key, option.value, option.title, option.description, option.required)
|
||||
}
|
||||
)
|
||||
}.let {
|
||||
File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
private class JsonPatch(
|
||||
|
Loading…
x
Reference in New Issue
Block a user