-
Notifications
You must be signed in to change notification settings - Fork 168
/
Copy pathbuild.gradle.kts
144 lines (124 loc) · 3.72 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
138
139
140
141
142
143
/*
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
*/
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.konan.target.KonanTarget
version = project.property("firebase-database.version") as String
plugins {
id("com.android.library")
kotlin("multiplatform")
kotlin("plugin.serialization") version "1.5.10"
}
repositories {
google()
mavenCentral()
jcenter()
}
android {
compileSdkVersion(property("targetSdkVersion") as Int)
defaultConfig {
minSdkVersion(property("minSdkVersion") as Int)
targetSdkVersion(property("targetSdkVersion") as Int)
}
sourceSets {
getByName("main") {
manifest.srcFile("src/androidMain/AndroidManifest.xml")
}
}
testOptions {
unitTests.apply {
isIncludeAndroidResources = true
}
}
packagingOptions {
pickFirst("META-INF/kotlinx-serialization-core.kotlin_module")
pickFirst("META-INF/AL2.0")
pickFirst("META-INF/LGPL2.1")
}
lintOptions {
isAbortOnError = false
}
}
kotlin {
android {
publishAllLibraryVariants()
}
fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = {
val nativeFrameworkPaths = listOf(
rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS")
).plus(
listOf(
"FirebaseDatabase",
"leveldb-library"
).map {
val archVariant = if (konanTarget is KonanTarget.IOS_X64) "ios-arm64_i386_x86_64-simulator" else "ios-arm64_armv7"
projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/$archVariant")
}
)
binaries {
getTest("DEBUG").apply {
linkerOpts(nativeFrameworkPaths.map { "-F$it" })
linkerOpts("-ObjC")
}
}
compilations.getByName("main") {
cinterops.create("FirebaseDatabase") {
compilerOpts(nativeFrameworkPaths.map { "-F$it" })
extraOpts("-verbose")
}
}
}
if (project.extra["ideaActive"] as Boolean) {
iosX64("ios", nativeTargetConfig())
} else {
ios(configure = nativeTargetConfig())
}
js {
useCommonJs()
nodejs {
testTask {
useMocha {
timeout = "5s"
}
}
}
browser {
testTask {
useMocha {
timeout = "5s"
}
}
}
}
sourceSets {
all {
languageSettings.apply {
apiVersion = "1.5"
languageVersion = "1.5"
progressiveMode = true
useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
useExperimentalAnnotation("kotlinx.coroutines.FlowPreview")
useExperimentalAnnotation("kotlinx.serialization.InternalSerializationApi")
}
}
val commonMain by getting {
dependencies {
api(project(":firebase-app"))
implementation(project(":firebase-common"))
}
}
val androidMain by getting {
dependencies {
api("com.google.firebase:firebase-database:20.0.0")
}
}
val iosMain by getting
val jsMain by getting
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}