-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
101 lines (90 loc) · 3.29 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
plugins {
kotlin("multiplatform") version "1.3.61" apply false
id("net.akehurst.kotlin.kt2ts") version("1.5.0") apply false
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
val version_project: String by project
val group_project = "${rootProject.name}"
group = group_project
version = version_project
buildDir = File(rootProject.projectDir, ".gradle-build/${project.name}")
}
val mockkVersion: String by extra
subprojects {
apply(plugin = "org.jetbrains.kotlin.multiplatform")
apply(plugin = "net.akehurst.kotlin.kt2ts")
configure<KotlinMultiplatformExtension> {
jvm() {
// by default kotlin uses JavaVersion 1.6
val main by compilations.getting {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs = listOf("-Xinline-classes")
}
}
val test by compilations.getting {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
}
js() {
browser()
}
sourceSets {
val commonMain by getting {
kotlin.srcDir("common/src/main")
resources.srcDir("common/rsc")
dependencies { implementation(kotlin("stdlib")) }
}
val commonTest by getting {
kotlin.srcDir("common/src/test")
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-annotations-common"))
implementation("io.mockk:mockk-common:$mockkVersion")
}
}
val jvmMain by getting {
kotlin.srcDir("jvm/src/main")
dependencies { implementation(kotlin("stdlib-jdk8")) }
}
val jvmTest by getting {
kotlin.srcDir("jvm/src/test")
dependencies {
implementation(kotlin("test-junit"))
implementation("io.mockk:mockk:$mockkVersion")
}
}
val jsMain by getting {
kotlin.srcDir("js/src/kotlin/main")
dependencies { implementation(kotlin("stdlib-js")) }
}
val jsTest by getting {
kotlin.srcDir("js/src/kotlin/test")
dependencies {
implementation(kotlin("test-js"))
implementation("io.mockk:mockk-js:1.7.17")
}
}
// Workaround for bug https://youtrack.jetbrains.com/issue/KT -24463:
// Copy all resource files to the build directory used by IDEA run configuration
tasks {
val deployResources by creating(Copy::class) {
from(listOf(commonMain.resources, jvmMain.resources)) {
include("**/*.properties")
}
into("${buildDir.absolutePath}/classes/kotlin/jvm/main")
}
getByName("jvmMainClasses") {
dependsOn(deployResources)
}
}
}
}
}