blob: 9f89fad4445be2e3c7943a964ebf6f031b3bddcb [file] [log] [blame]
/*
* Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
apply plugin: 'java' // Needed for protobuf plugin only
apply plugin: 'kotlin-multiplatform'
apply plugin: 'kotlinx-serialization'
ext {
jacksonVersion = '2.10.0.pr1'
}
// Protobuf plugin used in tests
apply plugin: 'com.google.protobuf'
protobuf {
protoc {
// Download from repositories
artifact = 'com.google.protobuf:protoc:3.0.0'
}
}
clean {
delete protobuf.generatedFilesBaseDir
}
apply from: rootProject.file("gradle/targets.gradle")
apply from: rootProject.file("gradle/native_mpp.gradle")
kotlin {
targets {
fromPreset(presets.jvm, 'jvm') {
withJava()
configure([compilations.main, compilations.test]) {
kotlinOptions {
jvmTarget = '1.6'
}
}
}
fromPreset(presets.js, 'js') {
nodejs {}
configure([compilations.main, compilations.test]) {
kotlinOptions {
sourceMap = true
moduleKind = "umd"
metaInfo = true
}
}
}
}
sourceSets.all {
kotlin.srcDirs = ["$it.name/src"]
resources.srcDirs = ["$it.name/resources"]
languageSettings {
progressiveMode = true
useExperimentalAnnotation("kotlin.Experimental")
useExperimentalAnnotation("kotlin.ExperimentalMultiplatform")
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
useExperimentalAnnotation("kotlinx.serialization.InternalSerializationApi")
}
}
sourceSets {
commonMain {
dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib-common'
}
}
commonTest {
dependencies {
api 'org.jetbrains.kotlin:kotlin-test-common'
api 'org.jetbrains.kotlin:kotlin-test-annotations-common'
}
}
jvmJsTest {
dependsOn commonTest
dependencies {
api 'org.jetbrains.kotlin:kotlin-test-common'
api 'org.jetbrains.kotlin:kotlin-test-annotations-common'
}
}
jvmMain {
dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib'
}
}
jvmTest {
dependsOn jvmJsTest
kotlin.srcDirs += file("${protobuf.generatedFilesBaseDir}/test/java")
dependencies {
api 'org.jetbrains.kotlin:kotlin-test-junit'
implementation 'io.kotlintest:kotlintest:2.0.7'
implementation 'com.google.guava:guava:24.1.1-jre'
implementation 'com.google.protobuf:protobuf-java:3.0.0'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-cbor', version: jacksonVersion
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
implementation group: 'com.upokecenter', name: 'cbor', version: '4.0.0-beta1'
}
}
jsMain {
dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib-js'
}
}
jsTest {
dependsOn jvmJsTest
dependencies {
api 'org.jetbrains.kotlin:kotlin-test-js'
}
}
nativeMain.dependencies {
}
}
sourceSets.findAll({ it.name.contains("Test") }).forEach { srcSet ->
srcSet.languageSettings {
it.useExperimentalAnnotation("kotlinx.serialization.UnstableDefault")
it.useExperimentalAnnotation("kotlinx.serialization.InternalSerializationApi")
if (srcSet.name.contains("jvm") || srcSet.name.contains("js")) {
it.useExperimentalAnnotation("kotlinx.serialization.ImplicitReflectionSerializer")
}
}
}
}
sourceSets.test.proto {
srcDirs = ['testProto']
}
compileTestKotlinJvm {
dependsOn 'generateTestProto'
}