refactor: move classes to correct places and fix their access

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
oSumAtrIX 2023-01-23 02:30:23 +01:00
parent 439343ab9d
commit e29be7c6d4
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -20,14 +20,14 @@ internal class JsonGenerator : PatchesFileGenerator {
it.version ?: "0.0.0", it.version ?: "0.0.0",
!it.include, !it.include,
it.options?.map { option -> it.options?.map { option ->
Option( JsonPatch.Option(
option.key, option.key,
option.title, option.title,
option.description, option.description,
option.required, option.required,
option.let { lo -> option.let { listOption ->
if (lo is PatchOption.ListOption<*>) { if (listOption is PatchOption.ListOption<*>) {
lo.options.toMutableList().toTypedArray() listOption.options.toMutableList().toTypedArray()
} else null } else null
} }
) )
@ -36,7 +36,7 @@ internal class JsonGenerator : PatchesFileGenerator {
dep.java.patchName dep.java.patchName
}?.toTypedArray() ?: emptyArray(), }?.toTypedArray() ?: emptyArray(),
it.compatiblePackages?.map { pkg -> it.compatiblePackages?.map { pkg ->
CompatiblePackage(pkg.name, pkg.versions) JsonPatch.CompatiblePackage(pkg.name, pkg.versions)
}?.toTypedArray() ?: emptyArray() }?.toTypedArray() ?: emptyArray()
) )
} }
@ -45,7 +45,7 @@ internal class JsonGenerator : PatchesFileGenerator {
json.writeText(GsonBuilder().serializeNulls().create().toJson(patches)) json.writeText(GsonBuilder().serializeNulls().create().toJson(patches))
} }
data class JsonPatch( private class JsonPatch(
val name: String, val name: String,
val description: String, val description: String,
val version: String, val version: String,
@ -53,18 +53,18 @@ internal class JsonGenerator : PatchesFileGenerator {
val options: Array<Option>, val options: Array<Option>,
val dependencies: Array<String>, val dependencies: Array<String>,
val compatiblePackages: Array<CompatiblePackage>, val compatiblePackages: Array<CompatiblePackage>,
) ) {
class CompatiblePackage(
val name: String,
val versions: Array<String>,
)
data class CompatiblePackage( class Option(
val name: String, val key: String,
val versions: Array<String>, val title: String,
) val description: String,
val required: Boolean,
data class Option( val choices: Array<*>?,
val key: String, )
val title: String, }
val description: String,
val required: Boolean,
val choices: Array<*>?,
)
} }