Advertisement
Guest User

Untitled

a guest
Sep 12th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 3.83 KB | None | 0 0
  1. plugins {
  2.     kiscord.platform.all
  3.     kiscord.dokka
  4.     kiscord.publish
  5.     kiscord.atomicfu
  6.  
  7.     org.jetbrains.kotlin.plugin.serialization
  8. }
  9.  
  10. val codegenOutput = file("src/codegen/kotlin")
  11.  
  12. configurations.create("codegen")
  13.  
  14. dependencies {
  15.     "codegen"(project(":kiscord-codegen"))
  16. }
  17.  
  18. val codegen by tasks.registering(JavaExec::class) {
  19.     classpath = configurations["codegen"]
  20.     main = "kiscord.codegen.OAPIConverterKt"
  21.  
  22.     val openapiYaml = rootProject.file("docs/openapi/openapi.yaml")
  23.     val openapiJson = rootProject.file("docs/openapi/openapi.json")
  24.  
  25.     args(openapiYaml, openapiJson, codegenOutput)
  26.     inputs.file(openapiYaml)
  27.     val outputs = outputs
  28.     outputs.file(openapiJson)
  29.     outputs.dir(codegenOutput)
  30.     doFirst {
  31.         outputs.previousOutputFiles.forEach { it.delete() }
  32.     }
  33. }
  34.  
  35. kiscord {
  36.     buildConfig {
  37.         packageName = "kiscord"
  38.         className = "KiscordBuildConfig"
  39.  
  40.         "NAME"(project.ext["kiscord.name"] as String) {
  41.             description = "Library name, i.e. \"Kiscord\""
  42.         }
  43.         "VERSION"(project.version.toString()) {
  44.             description = "Library version"
  45.         }
  46.         "URL"(project.ext["kiscord.url"] as String) {
  47.             description = "Library homepage"
  48.         }
  49.         "KOTLIN_VERSION"(project.ext["kotlin_version"] as String) {
  50.             description = "Kotlin version built against of"
  51.         }
  52.         "KOTLIN_PLATFORM"("Unknown") {
  53.             description = "Kotlin platform"
  54.  
  55.             jvm("JVM") {
  56.                 description = "Kotlin platform, i.e. JVM"
  57.             }
  58.             js("JS") {
  59.                 description = "Kotlin platform, i.e. JS"
  60.             }
  61.             native("Native") {
  62.                 description = "Kotlin platform, i.e. Native"
  63.             }
  64.         }
  65.     }
  66.  
  67.     common {
  68.         mainDependencies {
  69.             api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common")
  70.             api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common")
  71.             api("io.ktor:ktor-client-core")
  72.             api("com.soywiz.korlibs.klock:klock")
  73.         }
  74.  
  75.         testDependencies {
  76.             implementation("io.ktor:ktor-client-mock")
  77.             implementation("com.soywiz.korlibs.klock:klock")
  78.         }
  79.  
  80.         main.kotlin.srcDir(files(codegenOutput).builtBy(codegen))
  81.     }
  82.  
  83.     jvm {
  84.         mainDependencies {
  85.             api("org.jetbrains.kotlinx:kotlinx-coroutines-core")
  86.             api("org.jetbrains.kotlinx:kotlinx-serialization-runtime")
  87.             api("org.slf4j:slf4j-api")
  88.             api("io.ktor:ktor-client-core-jvm")
  89.  
  90.             implementation("io.ktor:ktor-client-cio")
  91.         }
  92.  
  93.         testDependencies {
  94.             implementation("io.ktor:ktor-client-mock-jvm")
  95.             implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test")
  96.         }
  97.     }
  98.  
  99.     js {
  100.         mainDependencies {
  101.             api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js")
  102.             api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js")
  103.             api("io.ktor:ktor-client-core-js")
  104.  
  105.             implementation(npm("text-encoding", "^0.7.0"))
  106.             implementation(npm("node-fetch", "^2.3.0"))
  107.             implementation(npm("ws", "^6.2.1"))
  108.         }
  109.  
  110.         testDependencies {
  111.             implementation("io.ktor:ktor-client-mock-js")
  112.         }
  113.     }
  114.  
  115.     native {
  116.         mainDependencies {
  117.             api("org.jetbrains.kotlinx:kotlinx-coroutines-core-native")
  118.             api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-native")
  119.             api("io.ktor:ktor-client-core-native")
  120.         }
  121.  
  122.         testDependencies {
  123.             implementation("io.ktor:ktor-client-mock-native")
  124.         }
  125.     }
  126.  
  127.     linuxX64 {
  128.         mainDependencies {
  129.             implementation("io.ktor:ktor-client-curl")
  130.         }
  131.     }
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement