update mimes generator

This commit is contained in:
InsanusMokrassar 2020-09-26 22:20:57 +06:00
parent 58d92849fc
commit 570ca331fd
4 changed files with 9 additions and 9 deletions

View File

@ -1,12 +1,12 @@
kotlin.code.style=official
org.gradle.parallel=true
kotlin_version=1.4.0
kotlin_version=1.4.10
kotlin_coroutines_version=1.3.9
kotlin_serialisation_core_version=1.0.0-RC
kotlin_serialisation_core_version=1.0.0-RC2
ktor_version=1.4.0
ktor_version=1.4.1
klockVersion=1.12.0
klockVersion=1.12.1
uuidVersion=0.2.2
exposed_version=0.27.1

View File

@ -40,7 +40,7 @@ kotlin {
commonMain {
dependencies {
implementation kotlin('stdlib')
api "org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlin_serialisation_core_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_core_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-cbor:$kotlin_serialisation_core_version"
api projectByName("utils.common")

View File

@ -41,7 +41,7 @@ kotlin {
dependencies {
implementation kotlin('stdlib')
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlin_serialisation_core_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_core_version"
api "com.soywiz.korlibs.klock:klock:$klockVersion"
api "com.benasher44:uuid:$uuidVersion"

View File

@ -38,11 +38,11 @@ if __name__ == '__main__':
code2 += ' KnownMimeTypes.Any,\n'
for key, group in grouped:
group_name = key.capitalize()
code += 'sealed class %s(raw: String) : MimeType, KnownMimeTypes(raw) {\n' % group_name
code += ' object Any: %s ("%s/*")\n' % (group_name, key)
code += '@Serializable(MimeTypeSerializer::class)\nsealed class %s(raw: String) : MimeType, KnownMimeTypes(raw) {\n' % group_name
code += ' @Serializable(MimeTypeSerializer::class)\n object Any: %s ("%s/*")\n' % (group_name, key)
for mime in group:
name = fix_name(mime['mime_category'], mime['mime_name'])
code += ' object %s: %s ("%s/%s")\n' % (name, group_name, mime['mime_category'], mime['mime_name'])
code += ' @Serializable(MimeTypeSerializer::class)\n object %s: %s ("%s/%s")\n' % (name, group_name, mime['mime_category'], mime['mime_name'])
code2 += ' KnownMimeTypes.%s.%s,\n' % (group_name, name)
code += '}\n\n'
code2 += ')\n'