blob: 20e2154b9ca2ae938d00afdf5f79a8aa39d07d70 [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.9.1'
}
// 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
}
def deployMode = property('native.deploy') == 'true'
kotlin {
infra {
target('macosX64')
target('linuxX64')
if (deployMode) {
target('mingwX64')
target('iosArm64')
target('iosArm32')
target('iosX64')
}
}
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")
}
}
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.4'
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.7'
}
}
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")
if (srcSet.name.contains("jvm") || srcSet.name.contains("js")) {
it.useExperimentalAnnotation("kotlinx.serialization.ImplicitReflectionSerializer")
}
}
}
}
sourceSets.test.proto {
srcDirs = ['testProto']
}
compileTestKotlinJvm {
dependsOn 'generateTestProto'
}