mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 01:36:15 +00:00
[kotlin-client] add support for kotlinx-datetime (#17166)
Closes #14490
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform") version "1.7.21" // kotlin_version
|
||||
kotlin("plugin.serialization") version "1.7.21" // kotlin_version
|
||||
}
|
||||
|
||||
group = "org.openapitools"
|
||||
version = "1.0.0"
|
||||
|
||||
val kotlin_version = "1.7.21"
|
||||
val coroutines_version = "1.6.4"
|
||||
val serialization_version = "1.3.3"
|
||||
val ktor_version = "2.2.3"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
ios { binaries { framework { freeCompilerArgs += "-Xobjc-generics" } } }
|
||||
iosSimulatorArm64 { 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-serialization:$ktor_version")
|
||||
api("io.ktor:ktor-client-content-negotiation:$ktor_version")
|
||||
api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
|
||||
|
||||
api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
|
||||
}
|
||||
}
|
||||
|
||||
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"))
|
||||
implementation("io.ktor:ktor-client-cio-jvm:$ktor_version")
|
||||
}
|
||||
}
|
||||
|
||||
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 iosSimulatorArm64Main by getting
|
||||
|
||||
val iosSimulatorArm64Test by getting
|
||||
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
api("io.ktor:ktor-client-js:$ktor_version")
|
||||
}
|
||||
}
|
||||
|
||||
val jsTest by getting
|
||||
|
||||
all {
|
||||
languageSettings.apply {
|
||||
optIn("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)
|
||||
}
|
||||
}
|
||||
}
|
||||
register("test") {
|
||||
dependsOn("allTests")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user