-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
107 lines (94 loc) · 3.45 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
107 lines (94 loc) · 3.45 KB
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
import java.util.Properties
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.android.lint) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.google.oss.licenses) apply false
alias(libs.plugins.androidx.baselineprofile) apply false
}
val localProperties by lazy {
Properties().apply {
val file = rootProject.file("local.properties")
if (file.exists()) file.inputStream().buffered().use(::load)
}
}
extra.set("localProperties", localProperties)
val tdlibFlavors = listOf("Official", "Telemt")
val runtimeFlavors = listOf("Firebase", "Libre")
val buildTypes = listOf("Debug", "Release")
data class AppAssemblyVariant(
val tdlib: String,
val runtime: String,
val buildType: String,
) {
val name: String get() = "$tdlib$runtime$buildType"
val unitTestBuildType: String get() = "Debug"
val unitTestVariantName: String get() = "$tdlib$runtime$unitTestBuildType"
}
val appAssemblyVariants =
tdlibFlavors.flatMap { tdlib ->
runtimeFlavors.flatMap { runtime ->
buildTypes.map { buildType ->
AppAssemblyVariant(
tdlib = tdlib,
runtime = runtime,
buildType = buildType,
)
}
}
}
appAssemblyVariants.forEach { variant ->
val verifyTask = tasks.register("verify${variant.name}BeforeAssemble") {
group = "verification"
description = "Runs module unit tests before assembling the ${variant.name} APK."
dependsOn(
":app:test${variant.unitTestVariantName}UnitTest",
":data:test${variant.unitTestVariantName}UnitTest",
":presentation:test${variant.unitTestVariantName}UnitTest",
":core:test",
":domain:test",
)
}
project(":app").tasks.matching { it.name == "assemble${variant.name}" }.configureEach {
dependsOn(verifyTask)
}
}
tasks.register("assembleOfficialReleaseTdlibApks") {
group = "build"
description = "Assembles release APKs with the official TDLib prebuilts."
dependsOn(":app:assembleOfficialFirebaseRelease")
}
tasks.register("assembleTelemtReleaseTdlibApks") {
group = "build"
description = "Assembles release APKs with the Telemt TDLib prebuilts."
dependsOn(":app:assembleTelemtFirebaseRelease")
}
tasks.register("assembleAllReleaseTdlibApks") {
group = "build"
description = "Assembles release APKs for both official and Telemt TDLib variants."
dependsOn(
"assembleOfficialReleaseTdlibApks",
"assembleTelemtReleaseTdlibApks"
)
}
tasks.register("assembleOfficialDebugTdlibApks") {
group = "build"
description = "Assembles debug APKs with the official TDLib prebuilts."
dependsOn(":app:assembleOfficialFirebaseDebug")
}
tasks.register("assembleTelemtDebugTdlibApks") {
group = "build"
description = "Assembles debug APKs with the Telemt TDLib prebuilts."
dependsOn(":app:assembleTelemtFirebaseDebug")
}
tasks.register("assembleAllDebugTdlibApks") {
group = "build"
description = "Assembles debug APKs for both official and Telemt TDLib variants."
dependsOn(
"assembleOfficialDebugTdlibApks",
"assembleTelemtDebugTdlibApks"
)
}