-
Notifications
You must be signed in to change notification settings - Fork 44
/
build.gradle.kts
119 lines (102 loc) · 3.49 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins {
alias(deps.plugins.kotlin.android) apply false
alias(deps.plugins.kotlin.jvm) apply false
alias(deps.plugins.kotlin.serialization) apply false
alias(deps.plugins.kotlin.kapt) apply false
alias(deps.plugins.android.application) apply false
alias(deps.plugins.android.library) apply false
alias(deps.plugins.hilt.android) apply false
alias(deps.plugins.google.services) apply false
alias(deps.plugins.firebase.crashlytics) apply false
alias(deps.plugins.room) apply false
}
val clean by tasks.registering {
delete(rootProject.buildDir)
}
interface Injected {
@get:Inject
val fs: FileSystemOperations
}
// Test Logging
subprojects {
tasks.withType<Test> {
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
}
}
}
val assembleInternalQA by tasks.registering {
group = "build"
description = "Builds internal APK to 'build/outputs' directory"
val appOutputApkDir = "$projectDir/app/build/outputs/apk/internal"
val rootOutputApkDir = "$buildDir/outputs"
val injected = objects.newInstance<Injected>()
dependsOn(":app:assembleInternal")
doFirst {
injected.fs.delete {
delete(appOutputApkDir)
delete("$rootOutputApkDir/app-internal.apk")
}
}
doLast {
injected.fs.copy {
from("$appOutputApkDir/app-internal.apk")
into(rootOutputApkDir)
}
}
}
val assembleExternalQA by tasks.registering {
group = "build"
description = "Builds external APK to 'build/outputs' directory"
val appOutputApkDir = "$projectDir/app/build/outputs/apk/external"
val rootOutputApkDir = "$buildDir/outputs"
val injected = objects.newInstance<Injected>()
dependsOn(":app:assembleExternal")
doFirst {
injected.fs.delete {
delete(appOutputApkDir)
delete("$rootOutputApkDir/app-external.apk")
}
}
doLast {
injected.fs.copy {
from("$appOutputApkDir/app-external.apk")
into(rootOutputApkDir)
}
}
}
val assembleQA by tasks.registering {
group = "build"
description = "Builds internal and external APKs to 'build/outputs' directory"
dependsOn(assembleInternalQA)
dependsOn(assembleExternalQA)
}
val generateComposeMetrics by tasks.registering {
group = "other"
description = "Build external APK and generates compose metrics to 'build/compose-metrics' directory"
subprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
val outputDirectory = "${project.buildDir.absolutePath}/compose_metrics"
// Metrics
freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$outputDirectory",
)
// Reports
freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$outputDirectory",
)
// Compose strong skipping mode
// freeCompilerArgs.addAll(
// "-P",
// "plugin:androidx.compose.compiler.plugins.kotlin:experimentalStrongSkipping=true",
// )
}
}
}
finalizedBy(assembleExternalQA)
}