forked from Automattic/pocket-casts-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
89 lines (79 loc) · 2.9 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
import com.automattic.android.measure.reporters.InternalA8cCiReporter
import com.automattic.android.measure.reporters.SlowSlowTasksMetricsReporter
import io.sentry.android.gradle.extensions.InstrumentationFeature
import io.sentry.android.gradle.extensions.SentryPluginExtension
import java.util.EnumSet
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// Gradle Plugins
dependencies {
// Open source licenses plugin
classpath(libs.ossLicenses.plugin)
}
}
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.aboutlibraries) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.sentry) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.measure.builds)
alias(libs.plugins.protobuf) apply false
alias(libs.plugins.dependency.analysis)
}
apply(from = rootProject.file("dependencies.gradle.kts"))
apply(from = "scripts/git-hooks/install.gradle")
measureBuilds {
enable = project.extra.properties.get("measureBuildsEnabled")?.toString().toBoolean()
onBuildMetricsReadyListener {
val report = this@onBuildMetricsReadyListener
SlowSlowTasksMetricsReporter.report(report)
InternalA8cCiReporter.reportBlocking(
metricsReport = report,
projectName = "pocketcasts",
authToken = project.extra.get("appsMetricsToken").toString(),
)
}
attachGradleScanId = false
}
val ktlintVersion = libs.versions.ktlint.get()
spotless {
kotlin {
target(
"app/src/**/*.kt",
"automotive/src/**/*.kt",
"modules/**/src/**/*.kt",
"wear/src/**/*.kt",
)
ktlint(ktlintVersion)
}
kotlinGradle {
target("*.kts")
ktlint(ktlintVersion)
}
}
fun Project.configureSentry() {
extensions.getByType(SentryPluginExtension::class.java).apply {
val shouldUploadDebugFiles = System.getenv()["CI"].toBoolean() &&
!project.properties["skipSentryProguardMappingUpload"]?.toString().toBoolean()
includeProguardMapping = shouldUploadDebugFiles
includeSourceContext = shouldUploadDebugFiles
tracingInstrumentation {
features.set(EnumSet.allOf(InstrumentationFeature::class.java) - InstrumentationFeature.OKHTTP)
}
autoInstallation.enabled = false
includeDependenciesReport = false
ignoredBuildTypes = setOf("debug", "debugProd")
}
}
rootProject.subprojects {
plugins.withId(rootProject.libs.plugins.sentry.get().pluginId) {
configureSentry()
}
}