-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathbuild.gradle
179 lines (147 loc) · 3.6 KB
/
build.gradle
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.multiplatform'
apply plugin: 'com.vanniktech.maven.publish'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'app.cash.molecule'
apply plugin: 'org.jetbrains.kotlinx.binary-compatibility-validator'
kotlin {
explicitApi()
androidTarget {
publishLibraryVariants('release')
}
iosArm64()
iosSimulatorArm64()
iosX64()
js {
browser()
}
jvm()
linuxArm64()
linuxX64()
macosArm64()
macosX64()
mingwX64()
tvosArm64()
tvosSimulatorArm64()
tvosX64()
wasmJs {
browser()
}
watchosArm32()
watchosArm64()
watchosSimulatorArm64()
watchosX64()
applyDefaultHierarchyTemplate()
sourceSets {
configureEach {
languageSettings.optIn("kotlinx.cinterop.BetaInteropApi")
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
}
commonMain {
dependencies {
api libs.jetbrains.compose.runtime
api libs.kotlinx.coroutines.core
}
}
commonTest {
dependencies {
implementation libs.kotlin.test
implementation libs.assertk
implementation libs.kotlinx.coroutines.test
}
}
androidMain {
dependencies {
implementation libs.androidx.core
}
}
// We use a common folder instead of a common source set because there is no commonizer
// which exposes the browser APIs across these two targets.
jsMain {
kotlin.srcDir('src/browserMain/kotlin')
}
wasmJsMain {
kotlin.srcDir('src/browserMain/kotlin')
}
darwinMain {
dependsOn(commonMain)
}
displayLinkMain {
dependsOn(darwinMain)
}
displayLinkTest {
dependsOn(commonTest)
}
quartzCoreMain {
dependsOn(displayLinkMain)
}
iosMain {
dependsOn(quartzCoreMain)
}
iosTest {
// TODO Link against XCTest in order to get frame pulses on iOS.
// dependsOn(displayLinkTest)
}
tvosMain {
dependsOn(quartzCoreMain)
}
tvosTest {
// TODO Link against XCTest in order to get frame pulses on tvOS.
// dependsOn(displayLinkTest)
}
macosMain {
dependsOn(displayLinkMain)
}
macosTest {
dependsOn(displayLinkTest)
}
watchosMain {
dependsOn(darwinMain)
}
}
}
dependencies {
androidTestImplementation libs.androidx.test.runner
androidTestImplementation libs.junit
androidTestImplementation libs.assertk
androidTestImplementation libs.kotlinx.coroutines.test
// The kotlin.test library provides JVM variants for multiple testing frameworks. When used
// as a test dependency this selection is transparent. But since we are using from an Android
// configuration we have to select the desired variant via an explicit capability.
add("androidTestImplementation", libs.kotlin.test) {
capabilities {
requireCapability(
"org.jetbrains.kotlin:kotlin-test-framework-junit:${libs.versions.kotlin.get()}")
}
}
}
android {
namespace 'app.cash.molecule'
sourceSets {
androidTest {
java.srcDirs += 'src/commonTest/kotlin'
}
}
defaultConfig {
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
testOptions {
unitTests.returnDefaultValues = true
}
packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
}
}
apiValidation {
klib.enabled = true
}
spotless {
kotlin {
targetExclude(
// Apache 2-licensed files from AOSP.
"src/androidMain/kotlin/app/cash/molecule/AndroidUiDispatcher.kt",
"src/androidMain/kotlin/app/cash/molecule/AndroidUiFrameClock.kt",
)
}
}