From b393dffe0bcf39ba6607bed6ff982217a49cd193 Mon Sep 17 00:00:00 2001 From: Sergey Morgunov Date: Thu, 3 Jun 2021 21:48:51 +0300 Subject: [PATCH] Update Kotlin to 1.5.10 --- build.gradle.kts | 6 +-- buildSrc/src/main/kotlin/Versions.kt | 8 ++-- core/build.gradle.kts | 4 +- .../internal/openapi/AnnotationExtensions.kt | 8 ++-- .../lagom/internal/openapi/ClassLevelInfo.kt | 2 +- .../lagom/internal/openapi/LagomCallInfo.kt | 2 +- .../internal/openapi/LagomServiceInfo.kt | 2 +- .../openapi/OperationMethodProcessor.kt | 44 +++++++++++-------- .../lagom/internal/openapi/SpecGenerator.kt | 2 +- .../taymyr/lagom/internal/openapi/Utils.kt | 2 +- java/api/build.gradle.kts | 4 +- .../lagom/javadsl/openapi/LagomError.kt | 2 +- java/impl/build.gradle.kts | 4 +- .../lagom/javadsl/openapi/SpecGenerator.kt | 10 +++-- 14 files changed, 55 insertions(+), 45 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e6da786..841ef37 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,11 +14,7 @@ allprojects { repositories { mavenCentral() } -} - -subprojects { apply() - jacoco { toolVersion = Versions.jacoco } @@ -61,7 +57,7 @@ val jacocoAggregateReport by tasks.creating(JacocoReport::class) { listOf("scala", "kotlin").map { project.buildDir.path + "/classes/$it/main" } })) additionalSourceDirs(files(subprojects.flatMap { project -> - listOf("scala", "kotlin").map { project.file("src/main/$it").absolutePath } + listOf("scala", "kotlin", "kotlin-2.11", "kotlin-2.12-2.13").map { project.file("src/main/$it").absolutePath } })) dependsOn(jacocoAggregateMerge) } diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index eae7f35..5630be5 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,13 +1,13 @@ @Suppress("ObjectPropertyName") object Versions { - const val kotlin = "1.3.70" + const val kotlin = "1.5.10" const val scalaBinary = "2.13" const val lagom = "1.6.1" // "1.4.13" - const val ktlint = "0.32.0" - const val `ktlint-plugin` = "8.0.0" + const val ktlint = "0.41.0" + const val `ktlint-plugin` = "10.1.0" const val `kotlin-logging` = "1.6.10" const val swagger = "2.0.7" - const val jacoco = "0.8.4" + const val jacoco = "0.8.7" const val junit5 = "5.3.2" const val assertj = "3.11.1" const val `json-unit` = "2.6.1" diff --git a/core/build.gradle.kts b/core/build.gradle.kts index cbe9670..be354ea 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -38,7 +38,9 @@ configurations { ktlint { version.set(Versions.ktlint) outputToConsole.set(true) - reporters.set(setOf(ReporterType.CHECKSTYLE)) + reporters { + reporter(ReporterType.CHECKSTYLE) + } } tasks.withType { diff --git a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/AnnotationExtensions.kt b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/AnnotationExtensions.kt index d71e243..56832fd 100644 --- a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/AnnotationExtensions.kt +++ b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/AnnotationExtensions.kt @@ -70,10 +70,10 @@ private val OAuthFlow.passwordModel: ModelOAuthFlow? get() = common?.tokenUrl(to private fun OAuthFlows.isEmpty() = authorizationCode.isEmpty() && - clientCredentials.isEmpty() && - implicit.isEmpty() && - password.isEmpty() && - extensions.isNullOrEmpty() + clientCredentials.isEmpty() && + implicit.isEmpty() && + password.isEmpty() && + extensions.isNullOrEmpty() private val OAuthFlows?.model: ModelOAuthFlows? get() = when { this == null || this.isEmpty() -> null diff --git a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/ClassLevelInfo.kt b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/ClassLevelInfo.kt index 4189ed5..d7ed107 100644 --- a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/ClassLevelInfo.kt +++ b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/ClassLevelInfo.kt @@ -10,4 +10,4 @@ data class ClassLevelInfo( val tags: List, val servers: List, val externalDocumentation: ExternalDocumentation? -) \ No newline at end of file +) diff --git a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomCallInfo.kt b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomCallInfo.kt index b7d6084..ef93333 100644 --- a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomCallInfo.kt +++ b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomCallInfo.kt @@ -11,4 +11,4 @@ data class LagomCallInfo(val method: Method, val path: String, val httpMethod: S val hidden = method.getAnnotationInherited(Hidden::class.java) return operation == null || operation.hidden || hidden != null } -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomServiceInfo.kt b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomServiceInfo.kt index 87cda27..2114cfe 100644 --- a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomServiceInfo.kt +++ b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/LagomServiceInfo.kt @@ -3,4 +3,4 @@ package org.taymyr.lagom.internal.openapi data class LagomServiceInfo( val service: Class<*>, val calls: List -) \ No newline at end of file +) diff --git a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/OperationMethodProcessor.kt b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/OperationMethodProcessor.kt index aa1e70a..9424a76 100644 --- a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/OperationMethodProcessor.kt +++ b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/OperationMethodProcessor.kt @@ -73,14 +73,16 @@ object OperationMethodProcessor { else ModelRequestBody() .description(requestBody.description.ifBlank { null }) .required(if (requestBody.required) requestBody.required else null) - .content(AnnotationsUtils.getContent( - requestBody.content, - null, - null, - null, - spec.components, - null - ).orElse(null)) + .content( + AnnotationsUtils.getContent( + requestBody.content, + null, + null, + null, + spec.components, + null + ).orElse(null) + ) .`$ref`(requestBody.ref.ifBlank { null }) ) @@ -113,14 +115,16 @@ object OperationMethodProcessor { response.responseCode to ModelApiResponse() .description(response.description) .headers(AnnotationsUtils.getHeaders(response.headers, null).orElse(null)) - .content(AnnotationsUtils.getContent( - response.content, - null, - null, - null, - spec.components, - null - ).orElse(null)) + .content( + AnnotationsUtils.getContent( + response.content, + null, + null, + null, + spec.components, + null + ).orElse(null) + ) .`$ref`(response.ref.ifBlank { null }) .apply { links = AnnotationsUtils.getLinks(response.links).ifEmpty { null } @@ -140,8 +144,10 @@ object OperationMethodProcessor { operation.deprecated(annotation.deprecated.takeIf { annotation.deprecated }) operation.externalDocs( AnnotationsUtils.getExternalDocumentation(annotation.externalDocs) - .orElse(AnnotationsUtils.getExternalDocumentation(classInfo.externalDocumentation) - .orElse(null)) + .orElse( + AnnotationsUtils.getExternalDocumentation(classInfo.externalDocumentation) + .orElse(null) + ) ) processParameters(annotation.parameters, spec, operation) processRequestBody(annotation.requestBody, spec, operation) @@ -167,4 +173,4 @@ object OperationMethodProcessor { .operation(PathItem.HttpMethod.valueOf(call.httpMethod), operation) } } -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/SpecGenerator.kt b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/SpecGenerator.kt index bb073f0..1c5cb92 100644 --- a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/SpecGenerator.kt +++ b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/SpecGenerator.kt @@ -29,4 +29,4 @@ open class SpecGenerator(protected val spec: OpenAPI = OpenAPI()) { service.calls.forEach { OperationMethodProcessor.process(it, classInfo, spec) } return spec } -} \ No newline at end of file +} diff --git a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/Utils.kt b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/Utils.kt index bbcd173..2d2c6b6 100644 --- a/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/Utils.kt +++ b/core/src/main/kotlin/org/taymyr/lagom/internal/openapi/Utils.kt @@ -19,4 +19,4 @@ fun jsonToYaml(json: String?): String? = try { json?.let { yamlMapper.writeValueAsString(jsonMapper.readValue(it, Any::class.java)) } } catch (e: IOException) { null -} \ No newline at end of file +} diff --git a/java/api/build.gradle.kts b/java/api/build.gradle.kts index e1ed395..583f2fe 100644 --- a/java/api/build.gradle.kts +++ b/java/api/build.gradle.kts @@ -24,7 +24,9 @@ dependencies { ktlint { version.set(Versions.ktlint) outputToConsole.set(true) - reporters.set(setOf(ReporterType.CHECKSTYLE)) + reporters { + reporter(ReporterType.CHECKSTYLE) + } } val sourcesJar by tasks.creating(Jar::class) { diff --git a/java/api/src/main/kotlin/org/taymyr/lagom/javadsl/openapi/LagomError.kt b/java/api/src/main/kotlin/org/taymyr/lagom/javadsl/openapi/LagomError.kt index f017629..d8157f0 100644 --- a/java/api/src/main/kotlin/org/taymyr/lagom/javadsl/openapi/LagomError.kt +++ b/java/api/src/main/kotlin/org/taymyr/lagom/javadsl/openapi/LagomError.kt @@ -8,4 +8,4 @@ class LagomError { fun getName() = "" @Schema(description = "Exception detail message") fun getDetail() = "" -} \ No newline at end of file +} diff --git a/java/impl/build.gradle.kts b/java/impl/build.gradle.kts index e5310ba..2d14966 100644 --- a/java/impl/build.gradle.kts +++ b/java/impl/build.gradle.kts @@ -52,7 +52,9 @@ configurations { ktlint { version.set(Versions.ktlint) outputToConsole.set(true) - reporters.set(setOf(ReporterType.CHECKSTYLE)) + reporters { + reporter(ReporterType.CHECKSTYLE) + } } tasks.withType { diff --git a/java/impl/src/main/kotlin/org/taymyr/lagom/javadsl/openapi/SpecGenerator.kt b/java/impl/src/main/kotlin/org/taymyr/lagom/javadsl/openapi/SpecGenerator.kt index 5f79fbb..a6e0ee6 100644 --- a/java/impl/src/main/kotlin/org/taymyr/lagom/javadsl/openapi/SpecGenerator.kt +++ b/java/impl/src/main/kotlin/org/taymyr/lagom/javadsl/openapi/SpecGenerator.kt @@ -28,9 +28,11 @@ internal class SpecGenerator(spec: OpenAPI = OpenAPI()) : SpecGenerator(spec) { } catch (t: Throwable) { throw IllegalStateException( """Unable to resolve method for service call. - Ensure that the you have passed a method reference (ie, this::someMethod). Passing anything else, - for example lambdas, anonymous classes or actual implementation classes, is forbidden in declaring a - service descriptor.""".trimIndent(), t + Ensure that the you have passed a method reference (ie, this::someMethod). Passing anything else, + for example lambdas, anonymous classes or actual implementation classes, is forbidden in declaring a + service descriptor. + """.trimIndent(), + t ) } } @@ -75,4 +77,4 @@ internal class SpecGenerator(spec: OpenAPI = OpenAPI()) : SpecGenerator(spec) { ) fun generate(service: Service): OpenAPI = generate(parseServiceInfo(service)) -} \ No newline at end of file +}