build: Sign release artifacts
This commit is contained in:
@ -0,0 +1,49 @@
|
||||
package app.revanced.generator
|
||||
|
||||
import app.revanced.patcher.PatchSet
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import com.google.gson.GsonBuilder
|
||||
import java.io.File
|
||||
|
||||
internal class JsonPatchesFileGenerator : 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.default,
|
||||
option.values,
|
||||
option.title,
|
||||
option.description,
|
||||
option.required,
|
||||
)
|
||||
},
|
||||
)
|
||||
}.let {
|
||||
File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
private class JsonPatch(
|
||||
val name: String? = null,
|
||||
val description: String? = null,
|
||||
val compatiblePackages: Set<Patch.CompatiblePackage>? = null,
|
||||
val use: Boolean = true,
|
||||
val requiresIntegrations: Boolean = false,
|
||||
val options: List<Option>,
|
||||
) {
|
||||
class Option(
|
||||
val key: String,
|
||||
val default: Any?,
|
||||
val values: Map<String, Any?>?,
|
||||
val title: String?,
|
||||
val description: String?,
|
||||
val required: Boolean,
|
||||
)
|
||||
}
|
||||
}
|
12
src/main/kotlin/app/revanced/generator/Main.kt
Normal file
12
src/main/kotlin/app/revanced/generator/Main.kt
Normal file
@ -0,0 +1,12 @@
|
||||
package app.revanced.generator
|
||||
|
||||
import app.revanced.patcher.PatchBundleLoader
|
||||
import java.io.File
|
||||
|
||||
internal fun main() = PatchBundleLoader.Jar(
|
||||
File("build/libs/").listFiles { it -> it.name.endsWith(".jar") }!!.first(),
|
||||
).also { loader ->
|
||||
if (loader.isEmpty()) throw IllegalStateException("No patches found")
|
||||
}.let { bundle ->
|
||||
arrayOf(JsonPatchesFileGenerator()).forEach { generator -> generator.generate(bundle) }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package app.revanced.generator
|
||||
|
||||
import app.revanced.patcher.PatchSet
|
||||
|
||||
internal interface PatchesFileGenerator {
|
||||
fun generate(patches: PatchSet)
|
||||
}
|
Reference in New Issue
Block a user