-
Notifications
You must be signed in to change notification settings - Fork 168
/
Copy pathbuild.gradle.kts
174 lines (149 loc) · 4.23 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
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
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
/*
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
*/
version = project.property("firebase-app.version") as String
plugins {
id("com.android.library")
kotlin("native.cocoapods")
kotlin("multiplatform")
}
android {
val minSdkVersion: Int by project
val compileSdkVersion: Int by project
compileSdk = compileSdkVersion
namespace="dev.gitlive.firebase"
defaultConfig {
minSdk = minSdkVersion
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
testOptions {
unitTests.apply {
isIncludeAndroidResources = true
}
}
packaging {
resources.pickFirsts.add("META-INF/kotlinx-serialization-core.kotlin_module")
resources.pickFirsts.add("META-INF/AL2.0")
resources.pickFirsts.add("META-INF/LGPL2.1")
}
lint {
abortOnError = false
}
}
val supportIosTarget = project.property("skipIosTarget") != "true"
kotlin {
targets.configureEach {
compilations.configureEach {
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
}
}
@Suppress("OPT_IN_USAGE")
androidTarget {
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishAllLibraryVariants()
compilations.configureEach {
kotlinOptions {
jvmTarget = "11"
}
}
}
jvm {
compilations.getByName("main") {
kotlinOptions {
jvmTarget = "17"
}
}
}
if (supportIosTarget) {
iosArm64()
iosX64()
iosSimulatorArm64()
cocoapods {
ios.deploymentTarget = "12.0"
framework {
baseName = "FirebaseApp"
}
noPodspec()
pod("FirebaseCore") {
version = "10.25.0"
}
}
}
wasmJs()
js(IR) {
useCommonJs()
nodejs {
testTask(
Action {
useKarma {
useChromeHeadless()
}
}
)
}
browser {
testTask(
Action {
useKarma {
useChromeHeadless()
}
}
)
}
}
sourceSets {
all {
languageSettings.apply {
val apiVersion: String by project
val languageVersion: String by project
this.apiVersion = apiVersion
this.languageVersion = languageVersion
progressiveMode = true
if (name.lowercase().contains("ios")) {
optIn("kotlinx.cinterop.ExperimentalForeignApi")
}
}
}
getByName("commonMain") {
dependencies {
implementation(project(":firebase-common"))
}
}
getByName("commonTest") {
dependencies {
implementation(project(":test-utils"))
}
}
getByName("androidMain") {
dependencies {
api("com.google.firebase:firebase-common-ktx")
}
}
getByName("jvmMain") {
kotlin.srcDir("src/androidMain/kotlin")
}
}
}
if (project.property("firebase-app.skipIosTests") == "true") {
tasks.forEach {
if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false }
}
}
if (project.property("firebase-app.skipJsTests") == "true") {
tasks.forEach {
if (it.name.contains("js", true) && it.name.contains("test", true)) { it.enabled = false }
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}