-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
225 lines (191 loc) · 6.87 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
import java.time.Duration
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.multiplatform'
id 'org.jetbrains.kotlin.plugin.serialization'
id "com.google.devtools.ksp"
}
group rootProject.group
version rootProject.version
android {
compileSdk rootProject.ext.version_android_compile_sdk
sourceSets.main.manifest.srcFile('src/androidMain/AndroidManifest.xml')
defaultConfig {
minSdkVersion 21
targetSdkVersion rootProject.ext.version_android_target_sdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'
}
testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildTypes {
release {
consumerProguardFiles 'proguard-rules.pro'
}
}
namespace 'com.ustadmobile.door.testdb'
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
androidTarget {
}
jvm {
compilations.all {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17
}
testRuns["test"].executionTask.configure {
useJUnit()
}
}
js(IR) {
browser {
testTask {
useKarma {
timeout = Duration.ofSeconds(30)
useChromeHeadless() //change to useChrome to run the actual browser
}
}
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation project(":door-runtime")
implementation project(":room-annotations")
implementation libs.kotlinx.serialization.json
implementation libs.ktor.client.content.negotiation
implementation libs.ktor.client.core
implementation libs.ktor.client.json
implementation libs.napier
implementation libs.kodein.di
implementation libs.kotlinx.coroutines.core
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
implementation libs.turbine
implementation libs.kotlinx.coroutines.test
}
}
jvmMain {
dependencies {
implementation libs.kodein.di.framework.ktor.server
implementation libs.sqlite.jdbc
implementation libs.ktor.server.content.negotiation
implementation libs.ktor.server.core
implementation libs.kotlin.reflect
}
}
jvmTest {
dependencies {
implementation kotlin('test-junit')
implementation libs.ktor.server.netty
implementation libs.mockwebserver
implementation libs.mockito.kotlin
implementation libs.ktor.client.okhttp
implementation libs.ktor.serialization.kotlinx.json
implementation libs.simple.jndi
implementation libs.apache.commons.pool2
implementation libs.apache.commons.dbcp2
implementation libs.sqlite.jdbc
implementation libs.postgres.jdbc
implementation libs.ktor.server.test.host
}
}
jsMain {
dependencies {
implementation project(":room-annotations")
implementation enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:$version_kotlin_wrappers_bom")
implementation "org.jetbrains.kotlin-wrappers:kotlin-js"
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
}
}
androidMain {
dependencies {
implementation libs.androidx.room.runtime
implementation libs.androidx.room.ktx
implementation libs.androidx.paging.runtime
implementation libs.androidx.room.paging
implementation libs.androidx.core.ktx
implementation libs.okhttp
implementation libs.okhttp.sse
implementation libs.nanohttpd
implementation libs.nanohttpd.nanolets
}
}
androidInstrumentedTest {
dependsOn commonTest
dependencies {
implementation kotlin('test-junit')
}
}
androidUnitTest {
dependsOn commonTest
dependencies {
implementation kotlin('test-junit')
implementation libs.robolectric
implementation libs.androidx.test.ext.junit
implementation libs.androidx.test.runner
implementation libs.androidx.test.rules
}
}
}
}
ksp {
arg("doordb_migrations_out", project.file("$buildDir/generated/door-migrations").absolutePath)
arg("doordb_postgres_url", rootProject.ext.localProperties["door.postgresUrl"])
arg("doordb_postgres_user", rootProject.ext.localProperties["door.postgresUser"])
arg("doordb_postgres_password", rootProject.ext.localProperties["door.postgresPass"])
}
/**
* Door uses SQLite.JS WASM Worker to run on Kotlin/JS. This is kept as a resource in door-runtime/jsMain.
*
* The default Kotlin/JS test runner does not load resources as per this bug:
* https://youtrack.jetbrains.com/issue/KT-42923
*
* This would prevent Door on Kotlin/JS loading the required WebWorker and WASM file. This workaround
* adds a resource loader to the Karma config as per:
*
* https://github.com/DaanVandenBosch/kotlin-js-karma-resources-test/tree/fix
*/
def generateKarmaConfigExtra = tasks.register("generateKarmaConfigExtra") {
def outputFile = project.file("karma.config.d/karma.config.generated.js")
outputs.file(outputFile)
doLast {
outputFile.text = "var PROJECT_PATH = '${rootProject.rootDir}';\n"
}
}
tasks.getByName("jsTest") {
dependsOn(generateKarmaConfigExtra)
}
dependencies {
kspJvm project(":door-compiler")
kspJvm project(":door-shallowcopy")
kspJs project(":door-compiler")
kspJs project(":door-shallowcopy")
kspAndroid project(":door-compiler")
kspAndroid libs.androidx.room.compiler
kspAndroid project(":door-shallowcopy")
androidTestUtil libs.androidx.test.orchestrator
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.runner
androidTestImplementation libs.androidx.test.rules
}