Matthias Ernst 17b6379df5
[Kotlin Multiplatform] Update and fixes for Kotlin 1.5.10 and Kotlinx.serialization 1.2.1 (#9755)
* Update Kotlin Multiplatform with Kotlin 1.5.10, Ktor 1.6.0 and Kotlinx.serialization 1.2.1
* remove @Serializable from interfaces
* Using 'String(CharArray): String' is an error. Use CharArray.concatToString() instead
* Fix, RequestConfig needs a type to infer type variable T

Fixes from @DevSrSouzaern
* Fix `private` keyword not being handle as a reservedWords
* Fix enum serialization generation
* Migrate gradle build to Kotlin DSL

* update samples and documentation

* PR Review changes
* sample update
* revert non multiplatform kotlinx_serialization removal
* default Json{} in ApiClient
* revert accidental version push for jvm client
* Match ktor and Kotlinx Serialization version in documentation and build.gradle.kts

* remove const from JSON_DEFAULT

* Update AbstractKotlinCodegen.java

Co-authored-by: Gabriel Souza <devsrsouza@gmail.com>
Co-authored-by: ern <ern@ti8m.ch>
2021-07-03 23:33:39 +08:00

96 lines
2.5 KiB
Plaintext

import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform") version "1.5.10" // kotlin_version
kotlin("plugin.serialization") version "1.5.10" // kotlin_version
}
group = "org.openapitools"
version = "1.0.0"
val kotlin_version = "1.5.10"
val coroutines_version = "1.5.0"
val serialization_version = "1.2.1"
val ktor_version = "1.6.0"
repositories {
mavenCentral()
}
kotlin {
jvm()
ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } }
js {
browser()
nodejs()
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version")
api("io.ktor:ktor-client-core:$ktor_version")
api("io.ktor:ktor-client-json:$ktor_version")
api("io.ktor:ktor-client-serialization:$ktor_version")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("io.ktor:ktor-client-mock:$ktor_version")
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk7"))
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
}
}
val iosMain by getting {
dependencies {
api("io.ktor:ktor-client-ios:$ktor_version")
}
}
val iosTest by getting
val jsMain by getting {
dependencies {
api("io.ktor:ktor-client-js:$ktor_version")
}
}
val jsTest by getting
all {
languageSettings.apply {
useExperimentalAnnotation("kotlin.Experimental")
}
}
}
}
tasks {
register("iosTest") {
val device = project.findProperty("device")?.toString() ?: "iPhone 8"
dependsOn("linkDebugTestIosX64")
group = JavaBasePlugin.VERIFICATION_GROUP
description = "Execute unit tests on ${device} simulator"
doLast {
val binary = kotlin.targets.getByName<KotlinNativeTarget>("iosX64").binaries.getTest("DEBUG")
exec {
commandLine("xcrun", "simctl", "spawn", device, binary.outputFile)
}
}
}
}