diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fcf9f3..f7342bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # PlaguPoster +## 0.9.0 + +* Dependencies update + ## 0.8.0 * Dependencies update diff --git a/build.gradle b/build.gradle index 2540c45..323b197 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ buildscript { repositories { google() mavenCentral() - mavenLocal() maven { url "https://plugins.gradle.org/m2/" } + mavenLocal() } dependencies { @@ -13,12 +13,29 @@ buildscript { } } +plugins { + alias(libs.plugins.nmcp.aggregation) +} + +if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { + nmcpAggregation { + centralPortal { + username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') + password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') + validationTimeout = Duration.ofHours(4) + publishingType = System.getenv('PUBLISHING_TYPE') != "" ? System.getenv('PUBLISHING_TYPE') : "USER_MANAGED" + } + + publishAllProjectsProbablyBreakingProjectIsolation() + } +} + allprojects { repositories { - mavenLocal() mavenCentral() google() maven { url "https://nexus.inmo.dev/repository/maven-releases/" } + mavenLocal() } } diff --git a/github_release.gradle b/github_release.gradle index 9a9a67e..3e10ad6 100644 --- a/github_release.gradle +++ b/github_release.gradle @@ -11,12 +11,19 @@ private String getCurrentVersionChangelog() { return changelogDataOS.toString().trim() } -if (new File(projectDir, "secret.gradle").exists()) { - apply from: './secret.gradle' +def githubTokenVariableName = "GITHUB_RELEASE_TOKEN" +def githubTokenVariableFromEnv = System.getenv(githubTokenVariableName) + +def secretFile = new File(projectDir, "secret.gradle") +if (secretFile.exists() || project.hasProperty(githubTokenVariableName) || (githubTokenVariableFromEnv != "" && githubTokenVariableFromEnv != null)) { + if (secretFile.exists()) { + apply from: './secret.gradle' + } apply plugin: "com.github.breadmoirai.github-release" + def githubReleaseToken = project.hasProperty(githubTokenVariableName) ? project.property(githubTokenVariableName).toString() : githubTokenVariableFromEnv githubRelease { - token "${project.property('GITHUB_RELEASE_TOKEN')}" + token githubReleaseToken owner "InsanusMokrassar" repo "PlaguPoster" diff --git a/gradle.properties b/gradle.properties index aff8af0..9576c26 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ android.enableJetifier=true # Project data group=dev.inmo -version=0.8.0 +version=0.9.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7229d8d..aa7f6c4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,16 +1,18 @@ [versions] -kotlin = "2.0.21" -kotlin-serialization = "1.7.3" +kotlin = "2.1.20" +kotlin-serialization = "1.8.1" -plagubot = "10.1.0" -tgbotapi = "20.0.0" -microutils = "0.23.0" -kslog = "1.3.6" -krontab = "2.6.1" -plagubot-plugins = "0.24.0" +plagubot = "10.6.0" +tgbotapi = "26.0.0" +microutils = "0.25.8" +kslog = "1.4.2" +krontab = "2.7.2" +plagubot-plugins = "0.24.4" -dokka = "1.9.20" +nmcp="0.2.1" + +dokka = "2.0.0" psql = "42.6.0" @@ -47,3 +49,5 @@ kotlin-dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", vers kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } + +nmcp-aggregation = { id = "com.gradleup.nmcp.aggregation", version.ref = "nmcp" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1e2fbf0..2733ed5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/posts/src/jvmMain/kotlin/Plugin.kt b/posts/src/jvmMain/kotlin/Plugin.kt index 9bd7eb3..0cec4de 100644 --- a/posts/src/jvmMain/kotlin/Plugin.kt +++ b/posts/src/jvmMain/kotlin/Plugin.kt @@ -24,7 +24,7 @@ import dev.inmo.tgbotapi.extensions.api.edit.edit import dev.inmo.tgbotapi.extensions.api.send.reply import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommand -import dev.inmo.tgbotapi.types.message.textsources.regular +import dev.inmo.tgbotapi.types.message.textsources.regularTextSource import kotlinx.serialization.Serializable import kotlinx.serialization.json.* import org.koin.core.Koin @@ -90,9 +90,9 @@ object Plugin : Plugin { postsRepo.deleteById(postId) if (postsRepo.contains(postId)) { - edit(it, it.content.textSources + regular(UnsuccessfulSymbol)) + edit(it, it.content.textSources + regularTextSource(UnsuccessfulSymbol)) } else { - edit(it, it.content.textSources + regular(SuccessfulSymbol)) + edit(it, it.content.textSources + regularTextSource(SuccessfulSymbol)) } } diff --git a/posts/src/jvmMain/kotlin/exposed/ExposedPostsRepo.kt b/posts/src/jvmMain/kotlin/exposed/ExposedPostsRepo.kt index a448f9e..3698799 100644 --- a/posts/src/jvmMain/kotlin/exposed/ExposedPostsRepo.kt +++ b/posts/src/jvmMain/kotlin/exposed/ExposedPostsRepo.kt @@ -132,7 +132,7 @@ class ExposedPostsRepo( }.associateBy { it.id } val existsIds = posts.keys.toList() transaction(db = database) { - val deleted = deleteWhere(null, null) { + val deleted = deleteWhere { selectByIds(it, existsIds) } with(contentRepo) { diff --git a/publish.gradle b/publish.gradle index 6bc719e..1ce5d20 100644 --- a/publish.gradle +++ b/publish.gradle @@ -1,3 +1,4 @@ + apply plugin: 'maven-publish' task javadocsJar(type: Jar) { @@ -19,46 +20,37 @@ publishing { } developers { - - developer { - id = "InsanusMokrassar" - name = "Aleksei Ovsiannikov" - email = "ovsyannikov.alexey95@gmail.com" - } - + developer { + id = "InsanusMokrassar" + name = "Aleksei Ovsiannikov" + email = "ovsyannikov.alexey95@gmail.com" + } } licenses { - } } - repositories { - if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) { - maven { - name = "Gitea" - url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven") - - credentials(HttpHeaderCredentials) { - name = "Authorization" - value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN') - } - - authentication { - header(HttpHeaderAuthentication) - } - + } + repositories { + if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) { + maven { + name = "InmoNexus" + url = uri("https://nexus.inmo.dev/repository/maven-releases/") + + credentials { + username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER') + password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD') } } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - + } + if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { + maven { + name = "sonatype" + url = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") + + credentials { + username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') + password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') } } } @@ -67,13 +59,13 @@ publishing { if (project.hasProperty("signing.gnupg.keyName")) { apply plugin: 'signing' - + signing { useGpgCmd() - + sign publishing.publications } - + task signAll { tasks.withType(Sign).forEach { dependsOn(it) diff --git a/publish.kpsb b/publish.kpsb index 90124dc..fed588a 100644 --- a/publish.kpsb +++ b/publish.kpsb @@ -1 +1 @@ -{"licenses":[],"mavenConfig":{"name":"${project.name}","description":"${project.name}","url":"https://github.com/InsanusMokrassar/PlaguPoster","vcsUrl":"https://github.com/InsanusMokrassar/PlaguPoster.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file +{"licenses":[],"mavenConfig":{"name":"${project.name}","description":"${project.name}","url":"https://github.com/InsanusMokrassar/PlaguPoster","vcsUrl":"https://github.com/InsanusMokrassar/PlaguPoster.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file diff --git a/ratings/source/src/jvmMain/kotlin/Plugin.kt b/ratings/source/src/jvmMain/kotlin/Plugin.kt index a6cf5c0..c226da5 100644 --- a/ratings/source/src/jvmMain/kotlin/Plugin.kt +++ b/ratings/source/src/jvmMain/kotlin/Plugin.kt @@ -3,6 +3,7 @@ package dev.inmo.plaguposter.ratings.source import com.benasher44.uuid.uuid4 import dev.inmo.kslog.common.e import dev.inmo.kslog.common.logger +import dev.inmo.micro_utils.coroutines.runCatchingLogging import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.micro_utils.pagination.firstPageWithOneElementPagination @@ -42,10 +43,11 @@ import dev.inmo.tgbotapi.extensions.utils.types.buttons.flatInlineKeyboard import dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard import dev.inmo.tgbotapi.types.ReplyParameters import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton -import dev.inmo.tgbotapi.types.message.textsources.bold -import dev.inmo.tgbotapi.types.message.textsources.regular +import dev.inmo.tgbotapi.types.message.textsources.boldTextSource +import dev.inmo.tgbotapi.types.message.textsources.regularTextSource import dev.inmo.tgbotapi.types.polls.InputPollOption import dev.inmo.tgbotapi.types.polls.PollOption +import dev.inmo.tgbotapi.utils.bold import dev.inmo.tgbotapi.utils.buildEntities import dev.inmo.tgbotapi.utils.extensions.makeSourceString import kotlinx.coroutines.delay @@ -198,17 +200,17 @@ object Plugin : Plugin { } if (attachPoll(postId)) { - runCatchingSafely { + runCatchingLogging { edit( it, - it.content.textSources + regular(" $SuccessfulSymbol") + it.content.textSources + regularTextSource(" $SuccessfulSymbol") ) } } else { - runCatchingSafely { + runCatchingLogging { edit( it, - it.content.textSources + regular(" $UnsuccessfulSymbol") + it.content.textSources + regularTextSource(" $UnsuccessfulSymbol") ) } } @@ -233,17 +235,17 @@ object Plugin : Plugin { if (detachPoll(postId)) { - runCatchingSafely { + runCatchingLogging { edit( it, - it.content.textSources + regular(" $SuccessfulSymbol") + it.content.textSources + regularTextSource(" $SuccessfulSymbol") ) } } else { - runCatchingSafely { + runCatchingLogging { edit( it, - it.content.textSources + regular(" $UnsuccessfulSymbol") + it.content.textSources + regularTextSource(" $UnsuccessfulSymbol") ) } } diff --git a/triggers/command/src/jvmMain/kotlin/Plugin.kt b/triggers/command/src/jvmMain/kotlin/Plugin.kt index f3b892b..8f2e2b6 100644 --- a/triggers/command/src/jvmMain/kotlin/Plugin.kt +++ b/triggers/command/src/jvmMain/kotlin/Plugin.kt @@ -27,7 +27,7 @@ import dev.inmo.tgbotapi.extensions.utils.types.buttons.flatInlineKeyboard import dev.inmo.tgbotapi.types.ChatId import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton -import dev.inmo.tgbotapi.types.message.textsources.regular +import dev.inmo.tgbotapi.types.message.textsources.regularTextSource import kotlinx.coroutines.flow.first import kotlinx.serialization.Serializable import kotlinx.serialization.json.* @@ -90,7 +90,7 @@ object Plugin : Plugin { edit( it, - it.content.textSources + regular(SuccessfulSymbol) + it.content.textSources + regularTextSource(SuccessfulSymbol) ) }