From 33d143ea12e915f943bc947fc5fa7a413a80afb7 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 2 Dec 2020 14:01:04 +0600 Subject: [PATCH 1/4] start 0.6.2 --- CHANGELOG.md | 50 ++++++++++++++++++++++++----------------------- gradle.properties | 2 +- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81a578f..2456abd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # SauceNaoAPI Changelog +## 0.6.2 + +## 0.6.1 + +* Versions updates: + * `Kotlin`: `1.4.0` -> `1.4.10` + * `Kotlin Serialisation`: `1.0.0-RC` -> `1.0.0-RC2` + * `Klock`: `1.12.0` -> `1.12.1` + * `Ktor`: `1.4.0` -> `1.4.1` + ## 0.6.0 **MAIN PACKAGE WAS CHANGED: `com.github.insanusmokrassar` -> `com.insanusmokrassar`** @@ -12,31 +22,11 @@ * `Klock`: `1.11.14` -> `1.12.0` * `Ktor`: `1.3.2` -> `1.4.0` -### 0.6.1 - -* Versions updates: - * `Kotlin`: `1.4.0` -> `1.4.10` - * `Kotlin Serialisation`: `1.0.0-RC` -> `1.0.0-RC2` - * `Klock`: `1.12.0` -> `1.12.1` - * `Ktor`: `1.4.0` -> `1.4.1` - ## 0.5.0 * Versions updates -## 0.4.0 - -* Update libraries versions - * Kotlin `1.3.31` -> `1.3.50` - * Coroutines `1.2.1` -> `1.3.2` - * Serialization `0.11.0` -> `0.13.0` - * Joda Time `2.10.1` -> `2.10.4` - * Ktor `1.1.4` -> `1.2.5` -* Now `SauceNaoAPI` is `Closeable` -* Now `SauceNaoAPI` working with synchronous queue -* `SauceNaoAPI` now will wait for some time when one of limits will be achieved - -### 0.4.4 +## 0.4.4 * Uploading of file * Updates of versions @@ -44,15 +34,15 @@ * `SauceNaoAPI` instances now can return `limitsState` object, which will contains `LimitsState` with currently known state of limits -### 0.4.3 +## 0.4.3 Hotfix for serializer of `SauceNaoAnswer` -### 0.4.2 +## 0.4.2 Hotfix for autostop for some time when there is no remaining quotas for requests -### 0.4.1 Managers experiments and row format in answer +## 0.4.1 Managers experiments and row format in answer * Add `TimeManager` - it will manage work with requests times * Add `RequestQuotaMagager` - it will manage quota for requests and call suspend @@ -61,6 +51,18 @@ if they will be over * Now `SauceNaoAnswer` have field `row` which contains `JsonObject` with all original answer fields +## 0.4.0 + +* Update libraries versions + * Kotlin `1.3.31` -> `1.3.50` + * Coroutines `1.2.1` -> `1.3.2` + * Serialization `0.11.0` -> `0.13.0` + * Joda Time `2.10.1` -> `2.10.4` + * Ktor `1.1.4` -> `1.2.5` +* Now `SauceNaoAPI` is `Closeable` +* Now `SauceNaoAPI` working with synchronous queue +* `SauceNaoAPI` now will wait for some time when one of limits will be achieved + ## 0.3.0 * Now `results` field of `SauceNaoAnswer` is optional and is empty list by default diff --git a/gradle.properties b/gradle.properties index 74e0883..1ab6ed6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,4 +8,4 @@ ktor_version=1.4.1 gradle_github_release_plugin_version=2.2.12 gradle_bintray_plugin_version=1.8.5 -library_version=0.6.1 +library_version=0.6.2 From 18cdf4ffbe87d7890df5e138bb386ed0c679a1e9 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 2 Dec 2020 14:02:15 +0600 Subject: [PATCH 2/4] update build scripts --- build.gradle | 1 - gradle.properties | 1 - gradle/wrapper/gradle-wrapper.properties | 2 +- maven.publish.gradle | 53 ----------- publication.kpsb | 2 +- publish.gradle | 112 ++++++++++++----------- 6 files changed, 63 insertions(+), 108 deletions(-) delete mode 100644 maven.publish.gradle diff --git a/build.gradle b/build.gradle index d43072a..9655028 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,6 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" - classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version" classpath "com.github.breadmoirai:github-release:$gradle_github_release_plugin_version" } } diff --git a/gradle.properties b/gradle.properties index 1ab6ed6..3fc8bfd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,5 @@ klock_version=1.12.1 ktor_version=1.4.1 gradle_github_release_plugin_version=2.2.12 -gradle_bintray_plugin_version=1.8.5 library_version=0.6.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 17b99ce..6990f01 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip diff --git a/maven.publish.gradle b/maven.publish.gradle deleted file mode 100644 index 2acca31..0000000 --- a/maven.publish.gradle +++ /dev/null @@ -1,53 +0,0 @@ -apply plugin: 'maven-publish' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -afterEvaluate { - project.publishing.publications.all { - // rename artifacts - groupId "${project.group}" - if (it.name.contains('kotlinMultiplatform')) { - artifactId = "${project.name}" - } else { - artifactId = "${project.name}-$name" - } - } -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "SauceNao API library" - name = "SauceNao API" - url = "https://insanusmokrassar.github.io/${project.name}" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/${project.name}.git[push=]https://github.com/insanusmokrassar/${project.name}.git" - url = "https://github.com/insanusmokrassar/${project.name}.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsyannikov Alexey" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - } -} \ No newline at end of file diff --git a/publication.kpsb b/publication.kpsb index ef9424d..534a053 100644 --- a/publication.kpsb +++ b/publication.kpsb @@ -1 +1 @@ -{"bintrayConfig":{"repo":"InsanusMokrassar","packageName":"${project.name}-mpp","packageVcs":"https://github.com/InsanusMokrassar/${project.name}","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"SauceNao API","description":"SauceNao API library","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/insanusmokrassar/${project.name}.git","developers":[{"id":"InsanusMokrassar","name":"Ovsyannikov Alexey","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"} \ No newline at end of file +{"bintrayConfig":{"repo":"InsanusMokrassar","packageName":"${project.name}-mpp","packageVcs":"https://github.com/InsanusMokrassar/${project.name}","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"SauceNao API","description":"SauceNao API library","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/insanusmokrassar/${project.name}.git","developers":[{"id":"InsanusMokrassar","name":"Ovsyannikov Alexey","eMail":"ovsyannikov.alexey95@gmail.com"}]}} \ No newline at end of file diff --git a/publish.gradle b/publish.gradle index 94ebd97..5226b91 100644 --- a/publish.gradle +++ b/publish.gradle @@ -1,59 +1,69 @@ -apply plugin: 'com.jfrog.bintray' +apply plugin: 'maven-publish' -apply from: "maven.publish.gradle" - -bintray { - user = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER') - key = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : System.getenv('BINTRAY_KEY') - filesSpec { - from "${buildDir}/publications/" - eachFile { - String directorySubname = it.getFile().parentFile.name - if (it.getName() == "module.json") { - if (directorySubname == "kotlinMultiplatform") { - it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.module") - } else { - it.setPath("${project.name}-${directorySubname}/${project.version}/${project.name}-${directorySubname}-${project.version}.module") - } - } else { - if (directorySubname == "kotlinMultiplatform" && it.getName() == "pom-default.xml") { - it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.pom") - } else { - it.exclude() - } - } - } - into "${project.group}".replace(".", "/") - } - - publish = true - override = true - - pkg { - repo = "InsanusMokrassar" - name = "${project.name}-mpp" - vcsUrl = "https://github.com/InsanusMokrassar/${project.name}" - licenses = ["Apache-2.0"] - version { - name = "${project.version}" - released = new Date() - vcsTag = "${project.version}" - gpg { - sign = true - passphrase = project.hasProperty('signing.gnupg.passphrase') ? project.property('signing.gnupg.passphrase') : System.getenv('signing.gnupg.passphrase') - } - } - } +task javadocsJar(type: Jar) { + classifier = 'javadoc' +} +task sourceJar (type : Jar) { + classifier = 'sources' } -bintrayUpload.doFirst { - publications = publishing.publications.collect { +afterEvaluate { + project.publishing.publications.all { + // rename artifacts + groupId "${project.group}" if (it.name.contains('kotlinMultiplatform')) { - null + artifactId = "${project.name}" + artifact sourceJar } else { - it.name + artifactId = "${project.name}-$name" } - } - null + } } -bintrayUpload.dependsOn publishToMavenLocal \ No newline at end of file +publishing { + publications.all { + artifact javadocsJar + + pom { + description = "SauceNao API library" + name = "SauceNao API" + url = "https://insanusmokrassar.github.io/${project.name}" + + scm { + developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/${project.name}.git[push=]https://github.com/insanusmokrassar/${project.name}.git" + url = "https://github.com/insanusmokrassar/${project.name}.git" + } + + developers { + + developer { + id = "InsanusMokrassar" + name = "Ovsyannikov Alexey" + email = "ovsyannikov.alexey95@gmail.com" + } + + } + + licenses { + + license { + name = "Apache Software License 2.0" + url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" + } + + } + } + + repositories { + maven { + name = "bintray" + url = uri("https://api.bintray.com/maven/${project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')}/InsanusMokrassar/${project.name}-mpp/;publish=1;override=1") + credentials { + username = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER') + password = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : System.getenv('BINTRAY_KEY') + } + } + } + + } +} \ No newline at end of file From 4fcdb6f7280d6976882ea56a6b0927d8c0051e13 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 2 Dec 2020 14:08:19 +0600 Subject: [PATCH 3/4] update versions --- CHANGELOG.md | 6 ++++++ build.gradle | 9 ++------- gradle.properties | 8 ++++---- .../exceptions/TooManyRequestsException.kt | 17 ++++++++--------- .../utils/CommonMultivariantStringSerializer.kt | 3 --- 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2456abd..b98ad2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## 0.6.2 +* Versions updates: + * `Kotlin`: `1.4.10` -> `1.4.20` + * `Kotlin Serialisation`: `1.0.0-RC2` -> `1.0.1` + * `Kotlin Coroutines`: `1.3.9` -> `1.4.2` + * `Klock`: `1.12.1` -> `2.0.0` + ## 0.6.1 * Versions updates: diff --git a/build.gradle b/build.gradle index 9655028..abc8d13 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ kotlin { implementation kotlin('stdlib') api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" - api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_runtime_version" + api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_version" api "com.soywiz.korlibs.klock:klock:$klock_version" api "io.ktor:ktor-client-core:$ktor_version" } @@ -55,18 +55,13 @@ kotlin { implementation kotlin('test-annotations-common') } } - jvmMain { - dependencies { - implementation kotlin('stdlib') - } - } jvmTest { dependencies { implementation kotlin('test-junit') implementation "io.ktor:ktor-client-okhttp:$ktor_version" } } - jsMain { + jsTest { dependencies { implementation kotlin('test-js') } diff --git a/gradle.properties b/gradle.properties index 3fc8bfd..65b2b06 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ kotlin.code.style=official -kotlin_version=1.4.10 -kotlin_coroutines_version=1.3.9 -kotlin_serialisation_runtime_version=1.0.0-RC2 -klock_version=1.12.1 +kotlin_version=1.4.20 +kotlin_coroutines_version=1.4.2 +kotlin_serialisation_version=1.0.1 +klock_version=2.0.0 ktor_version=1.4.1 gradle_github_release_plugin_version=2.2.12 diff --git a/src/commonMain/kotlin/com/insanusmokrassar/SauceNaoAPI/exceptions/TooManyRequestsException.kt b/src/commonMain/kotlin/com/insanusmokrassar/SauceNaoAPI/exceptions/TooManyRequestsException.kt index 8356d2a..d150009 100644 --- a/src/commonMain/kotlin/com/insanusmokrassar/SauceNaoAPI/exceptions/TooManyRequestsException.kt +++ b/src/commonMain/kotlin/com/insanusmokrassar/SauceNaoAPI/exceptions/TooManyRequestsException.kt @@ -9,18 +9,17 @@ import io.ktor.http.HttpStatusCode.Companion.TooManyRequests import io.ktor.utils.io.errors.IOException internal suspend fun ClientRequestException.sauceNaoAPIException(): Exception { - val response = response ?: return this - return when (response.status) { - TooManyRequests -> { - val answerContent = response.readText() - when { - answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent) - else -> TooManyRequestsShortException(answerContent) - } + return when (response.status) { + TooManyRequests -> { + val answerContent = response.readText() + when { + answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent) + else -> TooManyRequestsShortException(answerContent) } - else -> this } + else -> this } +} sealed class TooManyRequestsException(message: String, cause: Throwable? = null) : IOException(message, cause) { abstract val answerContent: String diff --git a/src/commonMain/kotlin/com/insanusmokrassar/SauceNaoAPI/utils/CommonMultivariantStringSerializer.kt b/src/commonMain/kotlin/com/insanusmokrassar/SauceNaoAPI/utils/CommonMultivariantStringSerializer.kt index a531c0d..5f8265b 100644 --- a/src/commonMain/kotlin/com/insanusmokrassar/SauceNaoAPI/utils/CommonMultivariantStringSerializer.kt +++ b/src/commonMain/kotlin/com/insanusmokrassar/SauceNaoAPI/utils/CommonMultivariantStringSerializer.kt @@ -7,11 +7,8 @@ import kotlinx.serialization.builtins.serializer import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.json.* - @Serializer(String::class) object CommonMultivariantStringSerializer : KSerializer by String.serializer() { - private val stringArraySerializer = ListSerializer(String.serializer()) - override fun deserialize(decoder: Decoder): String { return when (val parsed = JsonElement.serializer().deserialize(decoder)) { is JsonPrimitive -> parsed.content From f52eb2ad6e06b83c13a9a4e3ab799c16638c366f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 2 Dec 2020 14:13:42 +0600 Subject: [PATCH 4/4] update ktor --- CHANGELOG.md | 1 + gradle.properties | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b98ad2d..f9aafe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * `Kotlin Serialisation`: `1.0.0-RC2` -> `1.0.1` * `Kotlin Coroutines`: `1.3.9` -> `1.4.2` * `Klock`: `1.12.1` -> `2.0.0` + * `Ktor`: `1.4.1` -> `1.4.3` ## 0.6.1 diff --git a/gradle.properties b/gradle.properties index 65b2b06..0356736 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ kotlin_version=1.4.20 kotlin_coroutines_version=1.4.2 kotlin_serialisation_version=1.0.1 klock_version=2.0.0 -ktor_version=1.4.1 +ktor_version=1.4.3 gradle_github_release_plugin_version=2.2.12