-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
112 lines (106 loc) · 4.18 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
val ktlint: Configuration by configurations.creating
plugins {
// apply false: only load
jacoco
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.secrets) apply false
alias(libs.plugins.roborazzi) apply false
alias(libs.plugins.gms) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.firebase.perf) apply false
alias(libs.plugins.firebase.appdistribution) apply false
alias(libs.plugins.aboutLibraries) apply false
}
tasks.register<JacocoReport>("jacocoTestReport") {
reports {
html.required.set(true)
xml.required.set(true)
}
gradle.allprojects {
if (project.rootProject != this.project &&
(project.plugins.hasPlugin("hiraganaconverter.android.application.jacoco") ||
project.plugins.hasPlugin("hiraganaconverter.android.library.jacoco")
)
) {
executionData.from.add(fileTree("${project.layout.buildDirectory.get()}/jacoco"))
sourceDirectories.from.add(files("$projectDir/src/main/java", "$projectDir/src/main/kotlin"))
classDirectories.from.add(
fileTree("${project.layout.buildDirectory.get()}/tmp/kotlin-classes/prodDebug") {
exclude(
"**/R.class",
"**/R\$*.class",
"**/*Fake*.*",
"**/*Preview*.*",
"**/BuildConfig.*",
"**/*Manifest*.*",
"**/*Test*.*",
"**/*Hilt*.*",
"**/*Factory*.*",
"**/*Module*.*",
"**/*Key*.*",
"**/*Screen*.*",
"**/*Content*.*",
"**/*Dialog*.*",
"**/*Drawer*.*",
"**/*Navigation*.*",
"**/*MainActivity.*",
"**/*ConvertTextUseCaseError*.*",
"**/*ResponseData*.*",
"**/*RequestData*.*",
"**/*ErrorInterceptor*.*",
"**/*Application*.*",
"**/view/**",
"**/mock/**",
"**/*Mock*.*",
"**/*Navigation*.*",
"**/*State*.*",
)
}
)
}
}
}
subprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions {
val composeCompilerDir = "${project.layout.buildDirectory.get()}/compose_compiler"
if (project.findProperty("composeCompilerReports") == "true") {
freeCompilerArgs.add("-P=plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$composeCompilerDir")
}
if (project.findProperty("composeCompilerMetrics") == "true") {
freeCompilerArgs.add("-P=plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$composeCompilerDir")
}
}
}
}
dependencies {
// ktlint
ktlint(libs.ktlint) {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
}
}
tasks.register<JavaExec>("ktlintCheck") {
description = "Check Kotlin code style."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf(
"**src/**/*.kt",
"--reporter=checkstyle,output=${layout.buildDirectory.get()}/reports/ktlint/ktlint-result.xml",
)
isIgnoreExitValue = true
}
tasks.register<JavaExec>("ktlintFormatting") {
description = "Fix Kotlin code style deviations."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args("-F", "**src/**/*.kt")
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
}