forked from bumble-tech/appyx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
172 lines (155 loc) · 6.46 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
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("com.android.test") version libs.versions.agp.get() apply false
}
dependencyAnalysis {
issues {
all {
onIncorrectConfiguration {
severity("fail")
exclude(
// Should be ignored as it's raised in many modules due to misconfiguration.
"org.jetbrains.kotlin:kotlin-stdlib"
)
}
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",
// Convenience for convention plugins to avoid needing to define this.
"org.junit.jupiter:junit-jupiter-api",
// Some modules declare these dependencies but have not used them yet.
"androidx.compose.ui:ui-test-junit4",
"androidx.test.espresso:espresso-core",
"androidx.test.ext:junit",
":utils:testing-ui",
// This is used in:demos:appyx-interactions:android. But raised as unused.
"androidx.compose.material:material-icons-extended",
)
}
}
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(":appyx-interactions:android") {
onIncorrectConfiguration {
severity("fail")
exclude(":appyx-interactions:appyx-interactions")
}
}
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")
}
}
project(":utils:interop-ribs") {
onIncorrectConfiguration {
severity("fail")
exclude(
// Should be ignored, as they could potentially clash with dependencies
// from client code.
"com.github.badoo.RIBs:rib-compose",
)
}
onUnusedDependencies {
severity("fail")
exclude(
"androidx.activity:activity-compose",
)
}
}
}
}
allprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.bumble.appyx:customisations"))
.using(project(":utils:utils-customisations"))
.because("RIBs uses Appyx customisations as external dependency")
}
}
}
val buildNonMkdocsTask = tasks.register("buildNonMkdocs")
val jsBrowserDistributionMkdocsTask = tasks.register("jsBrowserDistributionMkdocs")
val conventionalPluginsWhiteList = listOf("benchmark-test")
subprojects {
// 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.multiplatform")
) {
if (!conventionalPluginsWhiteList.contains(project.name))
error("'$path' module must use a convention plugin")
}
}
}
}