import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile /* * Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ apply plugin: 'kotlin-multiplatform' apply plugin: 'kotlinx-serialization' apply from: rootProject.file("gradle/native-targets.gradle") apply from: rootProject.file("gradle/configure-source-sets.gradle") kotlin { sourceSets { jvmTest { dependencies { implementation 'io.kotlintest:kotlintest:2.0.7' implementation 'com.google.guava:guava:24.1.1-jre' implementation 'com.google.code.gson:gson:2.8.5' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" } } } } /* These manifest values help kotlinx.serialization compiler plugin determine if it is compatible with a given runtime library. Plugin reads them during compilation. Implementation-Version is used to determine whether runtime library supports a given plugin feature (e.g. value classes serialization in Kotlin 1.x may require runtime library version 1.y to work). Compiler plugin may enable or disable features by looking on Implementation-Version. Require-Kotlin-Version is used to determine whether runtime library with new features can work with old compilers. In ideal case, its value should always be 1.4, but some refactorings (e.g. adding a method to the Encoder interface) may unexpectedly break old compilers, so it is left out as a safety net. Compiler plugins, starting from 1.4 are instructed to reject runtime if runtime's Require-Kotlin-Version is greater then the current compiler. */ tasks.withType(Jar).named(kotlin.jvm().artifactsTaskName) { // adding the ProGuard rules to the jar from(rootProject.file("rules/common.pro")) { rename { "kotlinx-serialization-common.pro" } into("META-INF/proguard") } from(rootProject.file("rules/common.pro")) { rename { "kotlinx-serialization-common.pro" } into("META-INF/com.android.tools/proguard") } from(rootProject.file("rules/common.pro")) { rename { "kotlinx-serialization-common.pro" } into("META-INF/com.android.tools/r8") } from(rootProject.file("rules/r8.pro")) { rename { "kotlinx-serialization-r8.pro" } into("META-INF/com.android.tools/r8") } manifest { attributes( "Implementation-Version": version, "Require-Kotlin-Version": "1.4.30-M1", ) } } Java9Modularity.configureJava9ModuleInfo(project) tasks.withType(org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrLink.class).configureEach { kotlinOptions.freeCompilerArgs += "-Xwasm-enable-array-range-checks" }