forked from bumble-tech/appyx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
133 lines (121 loc) · 4.93 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
}
dependencies {
classpath(libs.plugin.android)
classpath(libs.plugin.kotlin)
}
}
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
kotlin("multiplatform") version libs.versions.kotlin.get() apply false
kotlin("plugin.serialization") version libs.versions.kotlin.get() apply false
id("appyx-collect-sarif")
id("com.android.application") version libs.versions.agp.get() apply false
id("com.google.devtools.ksp") version libs.versions.ksp.get() apply false
id("com.autonomousapps.dependency-analysis") version libs.versions.dependencyAnalysis.get()
id("org.jetbrains.compose") version libs.versions.composePlugin.get() apply false
id("org.jetbrains.kotlin.android") version libs.versions.kotlin.get() apply false
id("release-dependencies-diff-compare")
id("release-dependencies-diff-create") apply false
}
dependencyAnalysis {
issues {
all {
onIncorrectConfiguration {
severity("fail")
}
onUnusedDependencies {
severity("fail")
exclude(
// Needed for compose '@Preview'. The annotation is actually within
// androidx.compose.ui:ui-tooling-preview, hence the need to exclude.
"androidx.compose.ui:ui-tooling",
// This is used to add the testing activity to the debug manifest
// However since not code is referenced, it is raised as unused.
":utils:testing-ui-activity"
)
}
}
project(":utils:testing-junit4") {
onUnusedDependencies {
severity("fail")
// Not used by the module, but exposed via api to avoid adding two dependencies.
exclude(":utils:testing-unit-common")
}
}
project(":utils:testing-junit5") {
onUnusedDependencies {
severity("fail")
// Not used by the module, but exposed via api to avoid adding two dependencies.
exclude(":utils:testing-unit-common")
}
}
}
}
allprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.bumble.appyx:customisations"))
.using(project(":utils:customisations"))
.because("RIBs uses Appyx customisations as external dependency")
}
}
}
val buildNonMkdocsTask = tasks.register("buildNonMkdocs")
val jsBrowserDistributionMkdocsTask = tasks.register("jsBrowserDistributionMkdocs")
subprojects {
plugins.apply("release-dependencies-diff-create")
// Allows avoiding building these modules as part of CI as they are also built for mkdocs.
if (!path.startsWith(":demos:mkdocs:")) {
plugins.withId("com.android.application") {
buildNonMkdocsTask.configure { dependsOn(tasks.named("build")) }
}
plugins.withId("com.android.library") {
buildNonMkdocsTask.configure { dependsOn(tasks.named("build")) }
}
plugins.withId("org.jetbrains.kotlin.multiplatform") {
buildNonMkdocsTask.configure { dependsOn(tasks.named("build")) }
}
plugins.withId("java-library") {
buildNonMkdocsTask.configure { dependsOn(tasks.named("build")) }
}
} else {
plugins.withId("org.jetbrains.kotlin.multiplatform") {
jsBrowserDistributionMkdocsTask
.configure { dependsOn(tasks.named("jsBrowserDistribution")) }
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
if (project.findProperty("enableComposeCompilerReports") == "true") {
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
File(project.buildDir, "compose_metrics").absolutePath
)
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
File(project.buildDir, "compose_metrics").absolutePath
)
}
}
}
afterEvaluate {
// Ensure that all project modules use convention plugins
if (childProjects.isEmpty()) {
if (!pluginManager.hasPlugin("com.bumble.appyx.android.application") &&
!pluginManager.hasPlugin("com.bumble.appyx.android.library") &&
!pluginManager.hasPlugin("com.bumble.appyx.java") &&
!pluginManager.hasPlugin("com.bumble.appyx.multiplatform")
) {
error("'$path' module must use a convention plugin")
}
}
}
}