• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 import Java9Modularity.configureJava9ModuleInfo
2 import org.jetbrains.kotlin.gradle.targets.js.ir.*
3 
4 /*
5  * Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
6  */
7 
<lambda>null8 plugins {
9     kotlin("multiplatform")
10     alias(libs.plugins.serialization)
11 
12     id("native-targets-conventions")
13     id("source-sets-conventions")
14 }
15 
<lambda>null16 kotlin {
17     sourceSets {
18         jvmTest {
19             dependencies {
20                 implementation(libs.kotlintest)
21                 implementation(libs.guava.get24())
22                 implementation(libs.gson)
23                 implementation(libs.coroutines.core)
24             }
25         }
26     }
27 }
28 
29 /*
30  These manifest values help kotlinx.serialization compiler plugin determine if it is compatible with a given runtime library.
31  Plugin reads them during compilation.
32 
33  Implementation-Version is used to determine whether runtime library supports a given plugin feature (e.g. value classes serialization
34  in Kotlin 1.x may require runtime library version 1.y to work).
35  Compiler plugin may enable or disable features by looking at Implementation-Version.
36 
37  Require-Kotlin-Version is used to determine whether runtime library with new features can work with old compilers.
38  In ideal case, its value should always be 1.4, but some refactorings (e.g. adding a method to the Encoder interface)
39  may unexpectedly break old compilers, so it is left out as a safety net. Compiler plugins, starting from 1.4 are instructed
40  to reject runtime if runtime's Require-Kotlin-Version is greater then the current compiler.
41  */
<lambda>null42 tasks.withType<Jar>().named(kotlin.jvm().artifactsTaskName) {
43 
44     // adding the ProGuard rules to the jar
45     from(rootDir.resolve("rules/common.pro")) {
46         rename { "kotlinx-serialization-common.pro" }
47         into("META-INF/proguard")
48     }
49     from(rootDir.resolve("rules/common.pro")) {
50         rename { "kotlinx-serialization-common.pro" }
51         into("META-INF/com.android.tools/proguard")
52     }
53     from(rootDir.resolve("rules/common.pro")) {
54         rename { "kotlinx-serialization-common.pro" }
55         into("META-INF/com.android.tools/r8")
56     }
57     from(rootDir.resolve("rules/r8.pro")) {
58         rename { "kotlinx-serialization-r8.pro" }
59         into("META-INF/com.android.tools/r8")
60     }
61 
62 
63     manifest {
64         attributes(
65                 "Implementation-Version" to version,
66                 "Require-Kotlin-Version" to "2.0.0-RC1",
67         )
68     }
69 }
70 
71 configureJava9ModuleInfo()
72 
<lambda>null73 tasks.withType<KotlinJsIrLink>().configureEach {
74     compilerOptions.freeCompilerArgs.add("-Xwasm-enable-array-range-checks")
75 }
76