-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
137 lines (127 loc) · 4.16 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* Copyright 2022 Nikolai Kotchetkov.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("EXPERIMENTAL_API_USAGE")
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl
plugins {
id("org.jetbrains.kotlin.multiplatform")
id("org.jetbrains.kotlin.plugin.serialization")
id("org.jetbrains.dokka")
}
group = rootProject.group
version = rootProject.version
kotlin {
val iosArm64 = iosArm64("iosArm64")
val iosX64 = iosX64("iosX64")
configure(listOf(iosArm64, iosX64)) {
binaries {
framework(listOf(RELEASE))
}
}
iosSimulatorArm64("iosSimulatorArm64") {
binaries {
framework(listOf(DEBUG))
}
}
val outputIos by tasks.creating(org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask::class) {
group = "output"
destinationDirProperty = file("$projectDir/output/ios/Fat")
from(
iosArm64.binaries.getFramework("RELEASE"),
iosX64.binaries.getFramework("RELEASE")
)
}
val outputIosArm64 by tasks.creating(Copy::class) {
group = "output"
into(file("$projectDir/output/ios/Arm64"))
from(iosArm64.binaries.getFramework("RELEASE").linkTask)
}
val outputIosX64 by tasks.creating(Copy::class) {
group = "output"
into(file("$projectDir/output/ios/X64"))
from(iosX64.binaries.getFramework("RELEASE").linkTask)
}
jvm {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
testRuns["test"].executionTask.configure {
useJUnit()
}
}
js(IR) {
moduleName = "testaction"
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.js.ExperimentalJsExport")
}
generateTypeScriptDefinitions()
binaries.library()
useCommonJs()
nodejs {
testTask {
useMocha {
timeout = "10s"
}
}
// On customizing JS builds and distribution:
// https://kotlinlang.org/docs/reference/js-project-setup.html#choosing-execution-environment
@OptIn(ExperimentalDistributionDsl::class)
distribution {
outputDirectory.set(file("$projectDir/output/npm"))
}
}
browser {
testTask {
useMocha {
timeout = "10s"
}
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(project(":uri"))
implementation(project(":deeplink"))
implementation(project(":mocks"))
implementation(libs.kotlin.serialization.core)
}
}
val commonTest by getting {
dependencies {
implementation(libs.kotlin.serialization.json)
implementation(libs.test.kotlin.common)
implementation(libs.test.kotlin.annotations.common)
}
}
val jvmMain by getting
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
}
}
val jsMain by getting
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
val javadocJar by tasks.creating(Jar::class) {
group = "documentation"
archiveClassifier.set("javadoc")
from(tasks.dokkaHtml)
}