forked from GitLiveApp/firebase-kotlin-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
167 lines (143 loc) · 4.51 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
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
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-perf.version") as String
plugins {
id("com.android.library")
kotlin("multiplatform")
kotlin("native.cocoapods")
id("testOptionsConvention")
}
android {
val minSdkVersion: Int by project
val compileSdkVersion: Int by project
compileSdk = compileSdkVersion
namespace = "dev.gitlive.firebase.perf"
defaultConfig {
minSdk = minSdkVersion
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
testOptions.configureTestOptions()
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 {
explicitApi()
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
targets.configureEach {
compilations.configureEach {
compileTaskProvider.configure {
compilerOptions {
if (this is KotlinJvmCompilerOptions) {
jvmTarget = JvmTarget.JVM_17
}
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
}
@Suppress("OPT_IN_USAGE")
androidTarget {
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishAllLibraryVariants()
}
jvm()
if (supportIosTarget) {
iosArm64()
iosX64()
iosSimulatorArm64()
cocoapods {
ios.deploymentTarget = "12.0"
framework {
baseName = "FirebasePerformance"
}
noPodspec()
pod("FirebasePerformance") {
version = libs.versions.firebase.cocoapods.get()
}
}
}
js(IR) {
useCommonJs()
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
}
sourceSets {
all {
languageSettings.apply {
this.apiVersion = libs.versions.settings.api.get()
this.languageVersion = libs.versions.settings.language.get()
progressiveMode = true
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
if (name.lowercase().contains("ios")) {
optIn("kotlinx.cinterop.ExperimentalForeignApi")
}
}
}
getByName("commonMain") {
dependencies {
api(project(":firebase-app"))
implementation(project(":firebase-common"))
}
}
getByName("commonTest") {
dependencies {
implementation(project(":test-utils"))
}
}
getByName("androidMain") {
dependencies {
api(libs.google.firebase.perf.ktx)
}
}
// getByName("jvmMain") {
// kotlin.srcDir("src/androidMain/kotlin")
// }
}
}
if (project.property("firebase-perf.skipIosTests") == "true") {
tasks.forEach {
if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false }
}
}
if (project.property("firebase-perf.skipJvmTests") == "true") {
tasks.forEach {
if (it.name.contains("jvm", true) && it.name.contains("test", true)) { it.enabled = false }
}
}
if (project.property("firebase-perf.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)
}