-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
build.gradle.kts
204 lines (181 loc) · 6.52 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
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
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin(Config.multiplatform)
kotlin(Config.cocoapods)
id(Config.androidGradle)
id(Config.BuildPlugins.buildConfig)
`maven-publish`
}
android {
compileSdk = Config.Android.compileSdkVersion
defaultConfig {
minSdk = Config.Android.minSdkVersion
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
}
kotlin {
explicitApi()
android {
publishLibraryVariants("release")
}
jvm()
ios()
iosSimulatorArm64()
watchos()
watchosSimulatorArm64()
tvos()
tvosSimulatorArm64()
macosX64()
macosArm64()
sourceSets {
val commonMain by getting {
dependencies {
implementation(Config.Libs.kotlinStd)
}
}
val commonTest by getting {
dependencies {
implementation(Config.TestLibs.kotlinCommon)
implementation(Config.TestLibs.kotlinCommonAnnotation)
}
}
val androidMain by getting {
dependencies {
implementation(Config.Libs.sentryAndroid)
}
}
val androidUnitTest by getting
val jvmMain by getting
val jvmTest by getting
val commonJvmMain by creating {
dependsOn(commonMain)
jvmMain.dependsOn(this)
androidMain.dependsOn(this)
dependencies {
implementation(Config.Libs.sentryJava)
}
}
val commonJvmTest by creating {
dependsOn(commonTest)
jvmTest.dependsOn(this)
androidUnitTest.dependsOn(this)
dependencies {
implementation(Config.TestLibs.kotlinJunit)
}
}
cocoapods {
summary = "Official Sentry SDK Kotlin Multiplatform"
homepage = "https://github.com/getsentry/sentry-kotlin-multiplatform"
version = "0.0.1"
pod(Config.Libs.sentryCocoa, "~> ${Config.Libs.sentryCocoaVersion}")
ios.deploymentTarget = Config.Cocoa.iosDeploymentTarget
osx.deploymentTarget = Config.Cocoa.osxDeploymentTarget
tvos.deploymentTarget = Config.Cocoa.tvosDeploymentTarget
watchos.deploymentTarget = Config.Cocoa.watchosDeploymentTarget
}
val iosMain by getting
val iosSimulatorArm64Main by getting
val iosTest by getting
val iosSimulatorArm64Test by getting
val commonIosMain by creating {
iosMain.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
val commonIosTest by creating {
iosTest.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
val tvosMain by getting
val tvosSimulatorArm64Main by getting
val tvosTest by getting
val tvosSimulatorArm64Test by getting
val watchosMain by getting
val watchosSimulatorArm64Main by getting
val watchosTest by getting
val watchosSimulatorArm64Test by getting
val macosX64Main by getting
val macosArm64Main by getting
val macosX64Test by getting
val macosArm64Test by getting
val commonTvWatchMacOsMain by creating {
tvosMain.dependsOn(this)
tvosSimulatorArm64Main.dependsOn(this)
watchosMain.dependsOn(this)
watchosSimulatorArm64Main.dependsOn(this)
macosArm64Main.dependsOn(this)
macosX64Main.dependsOn(this)
}
val commonTvWatchMacOsTest by creating {
tvosTest.dependsOn(this)
tvosSimulatorArm64Test.dependsOn(this)
watchosTest.dependsOn(this)
watchosSimulatorArm64Test.dependsOn(this)
macosX64Test.dependsOn(this)
macosArm64Test.dependsOn(this)
}
val commonAppleMain by creating {
dependsOn(commonMain)
commonIosMain.dependsOn(this)
commonTvWatchMacOsMain.dependsOn(this)
}
val commonAppleTest by creating {
dependsOn(commonTest)
commonIosTest.dependsOn(this)
commonTvWatchMacOsTest.dependsOn(this)
}
}
listOf(
iosArm64(),
iosX64(),
iosSimulatorArm64(),
watchosArm32(),
watchosArm64(),
watchosX64(),
watchosSimulatorArm64(),
tvosArm64(),
tvosX64(),
tvosSimulatorArm64(),
macosX64(),
macosArm64()
).forEach {
it.compilations.getByName("main") {
cinterops.create("Sentry.NSException") {
includeDirs("$projectDir/src/nativeInterop/cinterop/SentryNSException")
}
cinterops.create("Sentry.Scope") {
includeDirs("$projectDir/src/nativeInterop/cinterop/SentryScope")
}
cinterops.create("Sentry.PrivateSentrySDKOnly") {
includeDirs("$projectDir/src/nativeInterop/cinterop/SentryPrivateSentrySDKOnly")
}
}
}
// workaround for https://youtrack.jetbrains.com/issue/KT-41709 due to having "Meta" in the class name
// if we need to use this class, we'd need to find a better way to work it out
targets.withType<KotlinNativeTarget>().all {
compilations["main"].cinterops["Sentry"].extraOpts(
"-compiler-option",
"-DSentryMechanismMeta=SentryMechanismMetaUnavailable"
)
}
}
buildkonfig {
packageName = "io.sentry.kotlin.multiplatform"
defaultConfigs {
buildConfigField(STRING, "SENTRY_KMP_COCOA_SDK_NAME", Config.Sentry.kmpCocoaSdkName)
buildConfigField(STRING, "SENTRY_KMP_JAVA_SDK_NAME", Config.Sentry.kmpJavaSdkName)
buildConfigField(STRING, "SENTRY_KMP_ANDROID_SDK_NAME", Config.Sentry.kmpAndroidSdkName)
buildConfigField(STRING, "VERSION_NAME", project.version.toString())
buildConfigField(STRING, "SENTRY_JAVA_PACKAGE_NAME", Config.Sentry.javaPackageName)
buildConfigField(STRING, "SENTRY_ANDROID_PACKAGE_NAME", Config.Sentry.androidPackageName)
buildConfigField(STRING, "SENTRY_COCOA_PACKAGE_NAME", Config.Sentry.cocoaPackageName)
buildConfigField(STRING, "SENTRY_JAVA_VERSION", Config.Libs.sentryJavaVersion)
buildConfigField(STRING, "SENTRY_ANDROID_VERSION", Config.Libs.sentryJavaVersion)
buildConfigField(STRING, "SENTRY_COCOA_VERSION", Config.Libs.sentryCocoaVersion)
}
}