mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
fixes
This commit is contained in:
parent
771fb5c288
commit
8b451791dd
@ -28,6 +28,8 @@
|
|||||||
* `Utils`:
|
* `Utils`:
|
||||||
* **BREAKING CHANGES** Now all new classcasts (like `Chat.ifPrivateChat` etc.) have been rewritten to be generated with `ksp` and `kotlin poet`
|
* **BREAKING CHANGES** Now all new classcasts (like `Chat.ifPrivateChat` etc.) have been rewritten to be generated with `ksp` and `kotlin poet`
|
||||||
|
|
||||||
|
*Note: Versions 3.0.0 and 3.0.1 have been published with errors and didn't recommend to use*
|
||||||
|
|
||||||
## 2.2.2
|
## 2.2.2
|
||||||
|
|
||||||
* `Utils`:
|
* `Utils`:
|
||||||
|
@ -12,8 +12,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
include ":tgbotapi.core"
|
include ":tgbotapi.core"
|
||||||
include ":tgbotapi.ksp:processor"
|
include ":tgbotapi.ksp"
|
||||||
include ":tgbotapi.ksp:lib"
|
|
||||||
include ":tgbotapi.api"
|
include ":tgbotapi.api"
|
||||||
include ":tgbotapi.utils"
|
include ":tgbotapi.utils"
|
||||||
include ":tgbotapi.behaviour_builder"
|
include ":tgbotapi.behaviour_builder"
|
||||||
|
@ -29,8 +29,6 @@ kotlin {
|
|||||||
api libs.microutils.languageCodes
|
api libs.microutils.languageCodes
|
||||||
|
|
||||||
api libs.ktor.client.core
|
api libs.ktor.client.core
|
||||||
|
|
||||||
compileOnly project(":tgbotapi.ksp:lib")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commonTest {
|
commonTest {
|
||||||
@ -52,8 +50,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
add("kspCommonMainMetadata", project(":tgbotapi.ksp:processor"))
|
add("kspJvm", project(":tgbotapi.ksp"))
|
||||||
add("kspJvm", project(":tgbotapi.ksp:processor"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ksp {
|
ksp {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.abstracts
|
package dev.inmo.tgbotapi.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.payments.abstracts.Currencied
|
import dev.inmo.tgbotapi.types.payments.abstracts.Currencied
|
||||||
import dev.inmo.tgbotapi.types.payments.abstracts.Priced
|
import dev.inmo.tgbotapi.types.payments.abstracts.Priced
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.abstracts
|
package dev.inmo.tgbotapi.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.chat.User
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
|
||||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContentSerializer
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContentSerializer
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.actions
|
package dev.inmo.tgbotapi.types.actions
|
||||||
|
|
||||||
import dev.inmo.micro_utils.common.Warning
|
import dev.inmo.micro_utils.common.Warning
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons
|
package dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.games.CallbackGame
|
import dev.inmo.tgbotapi.types.games.CallbackGame
|
||||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.buttons
|
package dev.inmo.tgbotapi.types.buttons
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable(KeyboardMarkupSerializer::class)
|
@Serializable(KeyboardMarkupSerializer::class)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.chat
|
package dev.inmo.tgbotapi.types.chat
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.dice
|
package dev.inmo.tgbotapi.types.dice
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.FileUniqueId
|
import dev.inmo.tgbotapi.types.FileUniqueId
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.location
|
package dev.inmo.tgbotapi.types.location
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.abstracts.*
|
import dev.inmo.tgbotapi.abstracts.*
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.media
|
package dev.inmo.tgbotapi.types.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
|
|
||||||
@ClassCastsIncluded
|
@ClassCastsIncluded
|
||||||
interface ChatEvent
|
interface ChatEvent
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.message
|
package dev.inmo.tgbotapi.types.message
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.abstracts.FromUser
|
import dev.inmo.tgbotapi.abstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.*
|
import dev.inmo.tgbotapi.types.chat.*
|
||||||
import dev.inmo.tgbotapi.types.chat.User
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.abstracts
|
package dev.inmo.tgbotapi.types.message.abstracts
|
||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.RawMessage
|
import dev.inmo.tgbotapi.types.message.RawMessage
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content
|
package dev.inmo.tgbotapi.types.message.content
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.textsources
|
package dev.inmo.tgbotapi.types.message.textsources
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.captionLength
|
import dev.inmo.tgbotapi.types.captionLength
|
||||||
import dev.inmo.tgbotapi.types.textLength
|
import dev.inmo.tgbotapi.types.textLength
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -5,7 +5,7 @@ package dev.inmo.tgbotapi.types.passport
|
|||||||
import dev.inmo.micro_utils.crypto.MD5
|
import dev.inmo.micro_utils.crypto.MD5
|
||||||
import dev.inmo.micro_utils.crypto.md5
|
import dev.inmo.micro_utils.crypto.md5
|
||||||
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
|
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.type
|
import dev.inmo.tgbotapi.types.passport.encrypted.type
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.passport.decrypted.abstracts
|
package dev.inmo.tgbotapi.types.passport.decrypted.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.passport.credentials.EndDataCredentials
|
import dev.inmo.tgbotapi.types.passport.credentials.EndDataCredentials
|
||||||
|
|
||||||
@ClassCastsIncluded
|
@ClassCastsIncluded
|
||||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
|||||||
|
|
||||||
import dev.inmo.micro_utils.crypto.SourceBytes
|
import dev.inmo.micro_utils.crypto.SourceBytes
|
||||||
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.JsonObject
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.types.polls
|
|||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import com.soywiz.klock.TimeSpan
|
import com.soywiz.klock.TimeSpan
|
||||||
import dev.inmo.tgbotapi.abstracts.TextedInput
|
import dev.inmo.tgbotapi.abstracts.TextedInput
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.message.*
|
import dev.inmo.tgbotapi.types.message.*
|
||||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.update.abstracts
|
package dev.inmo.tgbotapi.types.update.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
||||||
import dev.inmo.tgbotapi.types.update.RawUpdate
|
import dev.inmo.tgbotapi.types.update.RawUpdate
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package dev.inmo.tgbotapi.utils.internal
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.SOURCE)
|
||||||
|
internal annotation class ClassCastsIncluded
|
@ -9,5 +9,4 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation libs.kotlin.poet
|
implementation libs.kotlin.poet
|
||||||
implementation libs.ksp
|
implementation libs.ksp
|
||||||
implementation project(":tgbotapi.ksp:lib")
|
|
||||||
}
|
}
|
@ -1,7 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
|
||||||
}
|
|
||||||
|
|
||||||
project.description = "Class Casts generator KSP library to include into your library"
|
|
||||||
|
|
||||||
apply from: "$mppProjectWithSerializationPresetPath"
|
|
@ -1,5 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.ksp.lib
|
|
||||||
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
|
||||||
annotation class ClassCastsIncluded
|
|
@ -7,7 +7,6 @@ import com.google.devtools.ksp.symbol.KSClassDeclaration
|
|||||||
import com.squareup.kotlinpoet.AnnotationSpec
|
import com.squareup.kotlinpoet.AnnotationSpec
|
||||||
import com.squareup.kotlinpoet.FileSpec
|
import com.squareup.kotlinpoet.FileSpec
|
||||||
import com.squareup.kotlinpoet.ksp.writeTo
|
import com.squareup.kotlinpoet.ksp.writeTo
|
||||||
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class TelegramBotAPISymbolProcessor(
|
class TelegramBotAPISymbolProcessor(
|
||||||
@ -17,7 +16,7 @@ class TelegramBotAPISymbolProcessor(
|
|||||||
private val outputFolder: String? = null
|
private val outputFolder: String? = null
|
||||||
) : SymbolProcessor {
|
) : SymbolProcessor {
|
||||||
override fun process(resolver: Resolver): List<KSAnnotated> {
|
override fun process(resolver: Resolver): List<KSAnnotated> {
|
||||||
val classes = resolver.getSymbolsWithAnnotation(ClassCastsIncluded::class.qualifiedName!!).filterIsInstance<KSClassDeclaration>()
|
val classes = resolver.getSymbolsWithAnnotation("dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded").filterIsInstance<KSClassDeclaration>()
|
||||||
val classesSubtypes = mutableMapOf<KSClassDeclaration, MutableSet<KSClassDeclaration>>()
|
val classesSubtypes = mutableMapOf<KSClassDeclaration, MutableSet<KSClassDeclaration>>()
|
||||||
|
|
||||||
resolver.getAllFiles().forEach {
|
resolver.getAllFiles().forEach {
|
Loading…
Reference in New Issue
Block a user